aboutsummaryrefslogtreecommitdiff
path: root/lib/Lex/PPExpressions.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2008-05-04 07:15:21 +0000
committerChris Lattner <sabre@nondot.org>2008-05-04 07:15:21 +0000
commit3b6911527a78875ff4846259da1db6fb802fcbf5 (patch)
tree285b3e2dc45de0be2a2ab228a137b93995eb6bff /lib/Lex/PPExpressions.cpp
parenta212c56e9b7533bcc2d6be90efd52ad241bf894e (diff)
fix a nasty bug that Neil identifier in pp-expr parsing (this is PR2279 part D).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50617 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Lex/PPExpressions.cpp')
-rw-r--r--lib/Lex/PPExpressions.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/Lex/PPExpressions.cpp b/lib/Lex/PPExpressions.cpp
index 398567be36..6317015137 100644
--- a/lib/Lex/PPExpressions.cpp
+++ b/lib/Lex/PPExpressions.cpp
@@ -433,20 +433,28 @@ static bool EvaluateDirectiveSubExpr(llvm::APSInt &LHS, unsigned MinPrec,
default: assert(0 && "Unknown operator token!");
case tok::percent:
if (RHS == 0) {
- if (ValueLive) PP.Diag(OpToken, diag::err_pp_remainder_by_zero);
- return true;
+ if (ValueLive) {
+ PP.Diag(OpToken, diag::err_pp_remainder_by_zero);
+ return true;
+ }
+ } else {
+ Res = LHS % RHS;
}
- Res = LHS % RHS;
break;
case tok::slash:
if (RHS == 0) {
- if (ValueLive) PP.Diag(OpToken, diag::err_pp_division_by_zero);
- return true;
+ if (ValueLive) {
+ PP.Diag(OpToken, diag::err_pp_division_by_zero);
+ return true;
+ }
+ break;
}
+
Res = LHS / RHS;
if (LHS.isSigned())
Overflow = LHS.isMinSignedValue() && RHS.isAllOnesValue(); // MININT/-1
break;
+
case tok::star:
Res = LHS * RHS;
if (LHS != 0 && RHS != 0)