Improve unreachable code warnings for with respect to c-style casts.

llvm-svn: 94094
This commit is contained in:
Mike Stump 2010-01-21 19:51:34 +00:00
parent c18c403670
commit d12e495f17
2 changed files with 8 additions and 0 deletions

View File

@ -2116,6 +2116,11 @@ static SourceLocation GetUnreachableLoc(CFGBlock &b, SourceRange &R1,
const ConditionalOperator *CO = cast<ConditionalOperator>(S);
return CO->getQuestionLoc();
}
case Expr::CStyleCastExprClass: {
const CStyleCastExpr *CSC = cast<CStyleCastExpr>(S);
R1 = CSC->getSubExpr()->getSourceRange();
return CSC->getLParenLoc();
}
case Expr::ImplicitCastExprClass:
++sn;
goto top;

View File

@ -87,5 +87,8 @@ void test2() {
halt()
? // expected-warning {{will never be executed}}
dead() : dead();
case 10:
( // expected-warning {{will never be executed}}
float)halt();
}
}