зеркало из https://github.com/microsoft/clang-1.git
Improve unreachable code warnings for with respect to dead functional casts in C++.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@94106 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Родитель
2332c117b1
Коммит
2d6ceab0ad
|
@ -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());
|
||||
}
|
||||
|
|
Загрузка…
Ссылка в новой задаче