[cfe-commits] r50632 - /cfe/trunk/lib/Lex/PPExpressions.cpp
Chris Lattner
sabre at nondot.org
Sun May 4 16:46:17 PDT 2008
Author: lattner
Date: Sun May 4 18:46:17 2008
New Revision: 50632
URL: http://llvm.org/viewvc/llvm-project?rev=50632&view=rev
Log:
||/&& do not do UAC's either. This silences a bogus warning on #if -1 || 4U.
Modified:
cfe/trunk/lib/Lex/PPExpressions.cpp
Modified: cfe/trunk/lib/Lex/PPExpressions.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Lex/PPExpressions.cpp?rev=50632&r1=50631&r2=50632&view=diff
==============================================================================
--- cfe/trunk/lib/Lex/PPExpressions.cpp (original)
+++ cfe/trunk/lib/Lex/PPExpressions.cpp Sun May 4 18:46:17 2008
@@ -409,11 +409,17 @@
assert(PeekPrec <= ThisPrec && "Recursion didn't work!");
// Usual arithmetic conversions (C99 6.3.1.8p1): result is unsigned if
- // either operand is unsigned. Don't do this for x and y in "x ? y : z" or
- // for shifts.
+ // either operand is unsigned.
llvm::APSInt Res(LHS.getBitWidth());
- if (Operator != tok::question && Operator != tok::lessless &&
- Operator != tok::greatergreater && Operator != tok::comma) {
+ switch (Operator) {
+ case tok::question: // No UAC for x and y in "x ? y : z".
+ case tok::lessless: // Shift amount doesn't UAC with shift value.
+ case tok::greatergreater: // Shift amount doesn't UAC with shift value.
+ case tok::comma: // Comma operands are not subject to UACs.
+ case tok::pipepipe: // Logical || does not do UACs.
+ case tok::ampamp: // Logical && does not do UACs.
+ break; // No UAC
+ default:
Res.setIsUnsigned(LHS.isUnsigned()|RHS.isUnsigned());
// If this just promoted something from signed to unsigned, and if the
// value was negative, warn about it.
More information about the cfe-commits
mailing list