From 11ab38baa112fe187f37dd67c684fcbb4aac23d7 Mon Sep 17 00:00:00 2001 From: Ted Kremenek Date: Wed, 16 Apr 2014 07:26:09 +0000 Subject: -Wunreachable-code: refine recognition of unreachable "sigil" to cope with implicit casts in C++. Fixes . git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@206360 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Analysis/ReachableCode.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'lib/Analysis/ReachableCode.cpp') 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(S)) + S = Ex->IgnoreCasts(); + // Special case looking for the sigil '()' around an integer literal. if (const ParenExpr *PE = dyn_cast(S)) if (!PE->getLocStart().isMacroID()) @@ -146,7 +149,7 @@ static bool isConfigurationValue(const Stmt *S, IncludeIntegers, true); if (const Expr *Ex = dyn_cast(S)) - S = Ex->IgnoreParenCasts(); + S = Ex->IgnoreCasts(); bool IgnoreYES_NO = false; -- cgit v1.2.3