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 | a2936be04fb800d93a0a8d3358f35c7b3b2ded16 (patch) | |
tree | 0211be41c177480ba87adf88d0608bfa805a458f /lib/Sema/SemaChecking.cpp | |
parent | d4c60909ae7ad1ab603feedf04d457d72e85fbc4 (diff) |
Promote enum types during -Wsign-compare. Fixes some spurious warnings,
mostly during conditional expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@98975 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaChecking.cpp')
-rw-r--r-- | lib/Sema/SemaChecking.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/lib/Sema/SemaChecking.cpp b/lib/Sema/SemaChecking.cpp index 3fac79deba..522a7c1076 100644 --- a/lib/Sema/SemaChecking.cpp +++ b/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; |