This revision was automatically updated to reflect the committed changes.
Closed by commit rL285657: [ReachableCode] Skip over ExprWithCleanups in 
isConfigurationValue (authored by timshen).

Changed prior to commit:
  https://reviews.llvm.org/D24010?vs=75644&id=76508#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D24010

Files:
  cfe/trunk/include/clang/AST/Stmt.h
  cfe/trunk/lib/Analysis/ReachableCode.cpp
  cfe/trunk/test/SemaCXX/PR29152.cpp


Index: cfe/trunk/include/clang/AST/Stmt.h
===================================================================
--- cfe/trunk/include/clang/AST/Stmt.h
+++ cfe/trunk/include/clang/AST/Stmt.h
@@ -387,6 +387,9 @@
   /// Skip past any implicit AST nodes which might surround this
   /// statement, such as ExprWithCleanups or ImplicitCastExpr nodes.
   Stmt *IgnoreImplicit();
+  const Stmt *IgnoreImplicit() const {
+    return const_cast<Stmt *>(this)->IgnoreImplicit();
+  }
 
   /// \brief Skip no-op (attributed, compound) container stmts and skip 
captured
   /// stmt at the top, if \a IgnoreCaptured is true.
Index: cfe/trunk/test/SemaCXX/PR29152.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/PR29152.cpp
+++ cfe/trunk/test/SemaCXX/PR29152.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -Wunreachable-code -verify %s
+
+static const bool False = false;
+
+struct A {
+  ~A();
+  operator bool();
+};
+void Bar();
+
+void Foo() {
+  if (False && A()) {
+    Bar(); // expected-no-diagnostics
+  }
+}
Index: cfe/trunk/lib/Analysis/ReachableCode.cpp
===================================================================
--- cfe/trunk/lib/Analysis/ReachableCode.cpp
+++ cfe/trunk/lib/Analysis/ReachableCode.cpp
@@ -164,6 +164,8 @@
   if (!S)
     return false;
 
+  S = S->IgnoreImplicit();
+
   if (const Expr *Ex = dyn_cast<Expr>(S))
     S = Ex->IgnoreCasts();
 


Index: cfe/trunk/include/clang/AST/Stmt.h
===================================================================
--- cfe/trunk/include/clang/AST/Stmt.h
+++ cfe/trunk/include/clang/AST/Stmt.h
@@ -387,6 +387,9 @@
   /// Skip past any implicit AST nodes which might surround this
   /// statement, such as ExprWithCleanups or ImplicitCastExpr nodes.
   Stmt *IgnoreImplicit();
+  const Stmt *IgnoreImplicit() const {
+    return const_cast<Stmt *>(this)->IgnoreImplicit();
+  }
 
   /// \brief Skip no-op (attributed, compound) container stmts and skip captured
   /// stmt at the top, if \a IgnoreCaptured is true.
Index: cfe/trunk/test/SemaCXX/PR29152.cpp
===================================================================
--- cfe/trunk/test/SemaCXX/PR29152.cpp
+++ cfe/trunk/test/SemaCXX/PR29152.cpp
@@ -0,0 +1,15 @@
+// RUN: %clang_cc1 -fsyntax-only -Wunreachable-code -verify %s
+
+static const bool False = false;
+
+struct A {
+  ~A();
+  operator bool();
+};
+void Bar();
+
+void Foo() {
+  if (False && A()) {
+    Bar(); // expected-no-diagnostics
+  }
+}
Index: cfe/trunk/lib/Analysis/ReachableCode.cpp
===================================================================
--- cfe/trunk/lib/Analysis/ReachableCode.cpp
+++ cfe/trunk/lib/Analysis/ReachableCode.cpp
@@ -164,6 +164,8 @@
   if (!S)
     return false;
 
+  S = S->IgnoreImplicit();
+
   if (const Expr *Ex = dyn_cast<Expr>(S))
     S = Ex->IgnoreCasts();
 
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to