Fix PR2279 part C: shifts don't perform the UACs, thanks to Neil
for pointing this out.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@50624 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Lex/PPExpressions.cpp b/lib/Lex/PPExpressions.cpp
index 6317015..6343a3c 100644
--- a/lib/Lex/PPExpressions.cpp
+++ b/lib/Lex/PPExpressions.cpp
@@ -409,9 +409,11 @@
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".
+ // either operand is unsigned. Don't do this for x and y in "x ? y : z" or
+ // for shifts.
llvm::APSInt Res(LHS.getBitWidth());
- if (Operator != tok::question) {
+ if (Operator != tok::question && Operator != tok::lessless &&
+ Operator != tok::greatergreater) {
Res.setIsUnsigned(LHS.isUnsigned()|RHS.isUnsigned());
// If this just promoted something from signed to unsigned, and if the
// value was negative, warn about it.