[PATCH] Proposal on how to fix temporary dtors.

Manuel Klimek klimek at google.com
Sun May 25 23:16:49 PDT 2014


The question where to put the FoldingSetTraits is still open (see http://reviews.llvm.org/D3895 and my reply on-list (I really need to sit down and implement better mail parsing for phab)).

================
Comment at: lib/StaticAnalyzer/Core/ExprEngine.cpp:1436
@@ -1423,1 +1435,3 @@
                                const CFGBlock *DstF) {
+  assert((!Condition || !llvm::isa<CXXBindTemporaryExpr>(Condition)) &&
+         "CXXBindTemporaryExprs are handled by processBindTemporary.");
----------------
Jordan Rose wrote:
> No need for `llvm::` qualification here.
Done.

================
Comment at: test/Analysis/temporaries.cpp:284
@@ +283,3 @@
+    if (isInner || check(NoReturnDtor()) || testRecursiveFrames(true)) {
+      *(volatile int *)0 = 1;  // expected-warning{{null pointer}}
+    }
----------------
Jordan Rose wrote:
> clang_analyzer_checkReached is probably better here. Old habits.
Assuming you mean clang_analyzer_warnIfReached, done.

================
Comment at: test/Analysis/temporaries.cpp:291-294
@@ +290,6 @@
+    if (value) {
+      // FIXME: Find a way to verify construction order.
+      // ~Dtor should run before ~NoReturnDtor() because construction order is
+      // guaranteed by comma operator.
+      if (!value || check((NoReturnDtor(), Dtor())) || value) {
+        clang_analyzer_eval(true);  // no warning, unreachable code
----------------
Jordan Rose wrote:
> Yeah, I can't think of a way to fix this without inlining destructors. But that's the next thing to turn on!
\o/

http://reviews.llvm.org/D3627






More information about the cfe-commits mailing list