[PATCH] Fix crash when resolving branch conditions for temporary destructor condition blocks.

Alex McCarthy alexmc at google.com
Tue Apr 29 13:25:31 PDT 2014


Awesome, thanks for this fix, Manuel!

================
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:1389
@@ -1363,1 +1388,3 @@
 
+  // FIXME: This is a workaround until we handle temporary destructor branches
+  // correctly; currently, temporary destructor branches lead to blocks that
----------------
Consider linking to http://lists.cs.uiuc.edu/pipermail/cfe-dev/2014-April/036653.html for context

================
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:1392
@@ +1391,3 @@
+  // only have a terminator (and no statements). These blocks violate the
+  // invariant this funcion assumes.
+  if (B->getTerminator().isTemporaryDtorsBranch())
----------------
funcion -> function

================
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:1414
@@ -1390,3 +1413,3 @@
   }
   llvm_unreachable("could not resolve condition");
 }
----------------
What happens if we actually hit an llvm_unreachable? Does it die like an assert?

If not, maybe assert before this?

================
Comment at: test/Analysis/temporaries.cpp:193
@@ -194,3 +192,3 @@
 
-    FIXME: This shouldn't cause a warning.
-    if (compute(i == 5 &&
+    if (check(NoReturnDtor()) &&
+        compute(i == 5 &&
----------------
Out of curiosity, why the change to this test case?

http://reviews.llvm.org/D3552






More information about the cfe-commits mailing list