summaryrefslogtreecommitdiff
path: root/lib/Analysis/ReachableCode.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
commit11ab38baa112fe187f37dd67c684fcbb4aac23d7 (patch)
tree46fd34115101f5b5b610c1d986d562c2b974fce6 /lib/Analysis/ReachableCode.cpp
parente6ff2fc8ac80ce4441d1a7f1ddd9f0964ed2ba1e (diff)
downloadclang-11ab38baa112fe187f37dd67c684fcbb4aac23d7.tar.gz
clang-11ab38baa112fe187f37dd67c684fcbb4aac23d7.tar.bz2
clang-11ab38baa112fe187f37dd67c684fcbb4aac23d7.tar.xz
-Wunreachable-code: refine recognition of unreachable "sigil" to cope with implicit casts in C++.
Fixes <rdar://problem/16631033>. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206360 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/ReachableCode.cpp')
-rw-r--r--lib/Analysis/ReachableCode.cpp5
1 files changed, 4 insertions, 1 deletions
diff --git a/lib/Analysis/ReachableCode.cpp b/lib/Analysis/ReachableCode.cpp
index 3cc8ae4a08..8be1af7cef 100644
--- a/lib/Analysis/ReachableCode.cpp
+++ b/lib/Analysis/ReachableCode.cpp
@@ -139,6 +139,9 @@ static bool isConfigurationValue(const Stmt *S,
if (!S)
return false;
+ if (const Expr *Ex = dyn_cast<Expr>(S))
+ S = Ex->IgnoreCasts();
+
// Special case looking for the sigil '()' around an integer literal.
if (const ParenExpr *PE = dyn_cast<ParenExpr>(S))
if (!PE->getLocStart().isMacroID())
@@ -146,7 +149,7 @@ static bool isConfigurationValue(const Stmt *S,
IncludeIntegers, true);
if (const Expr *Ex = dyn_cast<Expr>(S))
- S = Ex->IgnoreParenCasts();
+ S = Ex->IgnoreCasts();
bool IgnoreYES_NO = false;