[PATCH] D13973: CFG: Delay creating Dtors for CompoundStmts which end in ReturnStmt

Matthias Gehre via cfe-commits cfe-commits at lists.llvm.org
Sun Nov 1 13:38:57 PST 2015

mgehre added inline comments.

Comment at: lib/Analysis/CFG.cpp:1949-1952
@@ +1948,6 @@
+  }
+  if (!C->body_empty() && !isa<ReturnStmt>(*C->body_rbegin())) {
+    // If the body ends with a ReturnStmt, the dtors will be added in VisitReturnStmt
+    addAutomaticObjDtors(ScopePos, scopeBeginPos, C);
+  }
Yes, sorry, I was busy with something else. I was reluctant to fix the more general case, because that would introduce a second loop, and may (or may not) have performance implications. On the other hand, unreachable block don't seem to have any negative impact.


More information about the cfe-commits mailing list