Improve unreachable code warnings for with respect to dead functional casts in C++.

llvm-svn: 94106
This commit is contained in:
Mike Stump 2010-01-21 22:12:18 +00:00
parent 32bfe1e837
commit fcd6f94ba7
3 changed files with 9 additions and 2 deletions

View File

@ -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 {

View File

@ -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;

View File

@ -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());
}