diff options
| author | John McCall <rjmccall@apple.com> | 2010-03-19 18:53:26 +0000 |
|---|---|---|
| committer | John McCall <rjmccall@apple.com> | 2010-03-19 18:53:26 +0000 |
| commit | ce5cbdc4ff01100ec8f29a347f4d7722f8ffad94 (patch) | |
| tree | ae6f32782b996745f5c1bc96fe73afae2a6d20e9 /clang/lib/Sema | |
| parent | 1a81ad3559c839ccc362a0a18e322a288c9d46ac (diff) | |
| download | bcm5719-llvm-ce5cbdc4ff01100ec8f29a347f4d7722f8ffad94.tar.gz bcm5719-llvm-ce5cbdc4ff01100ec8f29a347f4d7722f8ffad94.zip | |
Promote enum types during -Wsign-compare. Fixes some spurious warnings,
mostly during conditional expressions.
llvm-svn: 98975
Diffstat (limited to 'clang/lib/Sema')
| -rw-r--r-- | clang/lib/Sema/SemaChecking.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/clang/lib/Sema/SemaChecking.cpp b/clang/lib/Sema/SemaChecking.cpp index 3fac79deba4..522a7c10763 100644 --- a/clang/lib/Sema/SemaChecking.cpp +++ b/clang/lib/Sema/SemaChecking.cpp @@ -2045,6 +2045,11 @@ void Sema::CheckSignCompare(Expr *lex, Expr *rex, SourceLocation OpLoc, if (!tmp.isNull()) rt = tmp; } + if (const EnumType *E = lt->getAs<EnumType>()) + lt = E->getDecl()->getPromotionType(); + if (const EnumType *E = rt->getAs<EnumType>()) + rt = E->getDecl()->getPromotionType(); + // The rule is that the signed operand becomes unsigned, so isolate the // signed operand. Expr *signedOperand = lex, *unsignedOperand = rex; |

