[cfe-commits] r94106 - in /cfe/trunk: include/clang/AST/Stmt.h lib/Sema/SemaChecking.cpp test/SemaCXX/warn-unreachable.cpp
Mike Stump
mrs at apple.com
Thu Jan 21 14:12:19 PST 2010
Author: mrs
Date: Thu Jan 21 16:12:18 2010
New Revision: 94106
URL: http://llvm.org/viewvc/llvm-project?rev=94106&view=rev
Log:
Improve unreachable code warnings for with respect to dead functional casts in C++.
Modified:
cfe/trunk/include/clang/AST/Stmt.h
cfe/trunk/lib/Sema/SemaChecking.cpp
cfe/trunk/test/SemaCXX/warn-unreachable.cpp
Modified: cfe/trunk/include/clang/AST/Stmt.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Stmt.h?rev=94106&r1=94105&r2=94106&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/Stmt.h (original)
+++ cfe/trunk/include/clang/AST/Stmt.h Thu Jan 21 16:12:18 2010
@@ -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 {
Modified: cfe/trunk/lib/Sema/SemaChecking.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaChecking.cpp?rev=94106&r1=94105&r2=94106&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaChecking.cpp (original)
+++ cfe/trunk/lib/Sema/SemaChecking.cpp Thu Jan 21 16:12:18 2010
@@ -2121,6 +2121,11 @@
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;
Modified: cfe/trunk/test/SemaCXX/warn-unreachable.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaCXX/warn-unreachable.cpp?rev=94106&r1=94105&r2=94106&view=diff
==============================================================================
--- cfe/trunk/test/SemaCXX/warn-unreachable.cpp (original)
+++ cfe/trunk/test/SemaCXX/warn-unreachable.cpp Thu Jan 21 16:12:18 2010
@@ -40,6 +40,9 @@
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());
}
More information about the cfe-commits
mailing list