forked from OSchip/llvm-project
[-Wunreachable-code] Tweak isTrivialDoWhile() to handle implicit casts.
llvm-svn: 204376
This commit is contained in:
parent
3d84c96dd3
commit
d4576318b4
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue