diff options
author | Chris Lattner <sabre@nondot.org> | 2010-04-16 23:34:13 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2010-04-16 23:34:13 +0000 |
commit | 2b334bb3126a67895813e49e6228dad4aec0b4d6 (patch) | |
tree | 31b73e76f2200e7fcb761d6c026242895d1f8dfa /lib/Sema/SemaStmt.cpp | |
parent | ca7eaeeed817001dc7cee4852a7e41f0982da1ef (diff) |
make our existing "switch on bool" warning work for C. Since
the result of comparisons are 'int' in C, it doesn't work to
test just the result type of the expression.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@101576 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Sema/SemaStmt.cpp')
-rw-r--r-- | lib/Sema/SemaStmt.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/lib/Sema/SemaStmt.cpp b/lib/Sema/SemaStmt.cpp index 74c64d3881..cb55393259 100644 --- a/lib/Sema/SemaStmt.cpp +++ b/lib/Sema/SemaStmt.cpp @@ -593,7 +593,7 @@ Sema::ActOnFinishSwitchStmt(SourceLocation SwitchLoc, StmtArg Switch, return StmtError(); } - if (CondTypeBeforePromotion->isBooleanType()) { + if (CondExpr->isKnownToHaveBooleanValue()) { // switch(bool_expr) {...} is often a programmer error, e.g. // switch(n && mask) { ... } // Doh - should be "n & mask". // One can always use an if statement instead of switch(bool_expr). |