forked from OSchip/llvm-project
Improve unreachable code warnings for with respect to dead functional casts in C++.
llvm-svn: 94106
This commit is contained in:
parent
32bfe1e837
commit
fcd6f94ba7
|
@ -24,7 +24,6 @@
|
|||
#include "llvm/ADT/SmallVector.h"
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include <string>
|
||||
#include <iterator>
|
||||
using llvm::dyn_cast_or_null;
|
||||
|
||||
namespace llvm {
|
||||
|
|
|
@ -2121,6 +2121,11 @@ static SourceLocation GetUnreachableLoc(CFGBlock &b, SourceRange &R1,
|
|||
R1 = CSC->getSubExpr()->getSourceRange();
|
||||
return CSC->getLParenLoc();
|
||||
}
|
||||
case Expr::CXXFunctionalCastExprClass: {
|
||||
const CXXFunctionalCastExpr *CE = cast <CXXFunctionalCastExpr>(S);
|
||||
R1 = CE->getSubExpr()->getSourceRange();
|
||||
return CE->getTypeBeginLoc();
|
||||
}
|
||||
case Expr::ImplicitCastExprClass:
|
||||
++sn;
|
||||
goto top;
|
||||
|
|
|
@ -40,6 +40,9 @@ void test3() {
|
|||
halt()
|
||||
--; // expected-warning {{will never be executed}}
|
||||
halt()
|
||||
? // expected-warning {{will never be executed}}
|
||||
? // expected-warning {{will never be executed}}
|
||||
dead() : dead();
|
||||
live(),
|
||||
float // expected-warning {{will never be executed}}
|
||||
(halt());
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue