[PATCH] Proposal on how to fix temporary dtors.

Jordan Rose jordan_rose at apple.com
Fri May 23 21:30:10 PDT 2014


This generally looks good to me but I'd like to take one more look when I'm a bit more awake.

================
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.");
----------------
No need for `llvm::` qualification here.

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

================
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
----------------
Yeah, I can't think of a way to fix this without inlining destructors. But that's the next thing to turn on!

http://reviews.llvm.org/D3627






More information about the cfe-commits mailing list