summaryrefslogtreecommitdiffstats
path: root/clang/lib/AST/Expr.cpp
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2014-04-16 07:26:09 +0000
committerTed Kremenek <kremenek@apple.com>2014-04-16 07:26:09 +0000
commit6f375e5604590fc9c23d8a75176feb951de84211 (patch)
treea061ed0d5b01dacd33ee93addc23c1468e42af47 /clang/lib/AST/Expr.cpp
parent057094c6f6bfacf22808ff7f70e895616d9474cc (diff)
downloadbcm5719-llvm-6f375e5604590fc9c23d8a75176feb951de84211.tar.gz
bcm5719-llvm-6f375e5604590fc9c23d8a75176feb951de84211.zip
-Wunreachable-code: refine recognition of unreachable "sigil" to cope with implicit casts in C++.
Fixes <rdar://problem/16631033>. llvm-svn: 206360
Diffstat (limited to 'clang/lib/AST/Expr.cpp')
-rw-r--r--clang/lib/AST/Expr.cpp21
1 files changed, 21 insertions, 0 deletions
diff --git a/clang/lib/AST/Expr.cpp b/clang/lib/AST/Expr.cpp
index f023fe804b6..4ddd0a239aa 100644
--- a/clang/lib/AST/Expr.cpp
+++ b/clang/lib/AST/Expr.cpp
@@ -2400,6 +2400,27 @@ Expr *Expr::IgnoreParenCasts() {
}
}
+Expr *Expr::IgnoreCasts() {
+ Expr *E = this;
+ while (true) {
+ if (CastExpr *P = dyn_cast<CastExpr>(E)) {
+ E = P->getSubExpr();
+ continue;
+ }
+ if (MaterializeTemporaryExpr *Materialize
+ = dyn_cast<MaterializeTemporaryExpr>(E)) {
+ E = Materialize->GetTemporaryExpr();
+ continue;
+ }
+ if (SubstNonTypeTemplateParmExpr *NTTP
+ = dyn_cast<SubstNonTypeTemplateParmExpr>(E)) {
+ E = NTTP->getReplacement();
+ continue;
+ }
+ return E;
+ }
+}
+
/// IgnoreParenLValueCasts - Ignore parentheses and lvalue-to-rvalue
/// casts. This is intended purely as a temporary workaround for code
/// that hasn't yet been rewritten to do the right thing about those
OpenPOWER on IntegriCloud