Skip to content
Snippets Groups Projects
Commit d3bf5b7e authored by Ted Kremenek's avatar Ted Kremenek
Browse files

[-Wunreachable-code] Tweak isTrivialDoWhile() to handle implicit casts.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@204376 91177308-0d34-0410-b5e6-96231b3b80d8
parent a8554f53
No related branches found
No related tags found
No related merge requests found
......@@ -51,7 +51,7 @@ static bool isTrivialDoWhile(const CFGBlock *B, const Stmt *S) {
// condition.
if (const Stmt *Term = B->getTerminator()) {
if (const DoStmt *DS = dyn_cast<DoStmt>(Term)) {
const Expr *Cond = DS->getCond();
const Expr *Cond = DS->getCond()->IgnoreParenCasts();
return Cond == S && isTrivialExpression(Cond);
}
}
......
......@@ -218,6 +218,14 @@ int test_treat_non_const_bool_local_as_non_config_value() {
return 0;
}
void test_do_while(int x) {
// Handle trivial expressions with
// implicit casts to bool.
do {
break;
} while (0); // no-warning
}
class Frobozz {
public:
Frobozz(int x);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment