summaryrefslogtreecommitdiffstats
path: root/clang/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
commit0a9718eab099688d4a9fa189ffce9a670a9fa7ea (patch)
tree27daa6ce5b56e5656e1691440db81a92b7e62aab /clang/lib/Lex/PPExpressions.cpp
parent60d2d99b117190bc559f7eedc626fee168ca1436 (diff)
downloadbcm5719-llvm-0a9718eab099688d4a9fa189ffce9a670a9fa7ea.tar.gz
bcm5719-llvm-0a9718eab099688d4a9fa189ffce9a670a9fa7ea.zip
fix a nasty bug that Neil identifier in pp-expr parsing (this is PR2279 part D).
llvm-svn: 50617
Diffstat (limited to 'clang/lib/Lex/PPExpressions.cpp')
-rw-r--r--clang/lib/Lex/PPExpressions.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/clang/lib/Lex/PPExpressions.cpp b/clang/lib/Lex/PPExpressions.cpp
index 398567be367..63170151377 100644
--- a/clang/lib/Lex/PPExpressions.cpp
+++ b/clang/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)
OpenPOWER on IntegriCloud