forked from OSchip/llvm-project
Improve unreachable code warnings for with respect to c-style casts.
llvm-svn: 94094
This commit is contained in:
parent
c18c403670
commit
d12e495f17
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue