[PATCH] D45382: [CodeGen] Avoid destructing a struct type that has already been destructed by a delegated constructor

John McCall via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sat Apr 21 05:49:54 PDT 2018


rjmccall added inline comments.
Herald added a reviewer: javed.absar.


================
Comment at: lib/CodeGen/CodeGenFunction.h:847
+    CurrentCleanupStackDepth = C;
+  }
+
----------------
You don't need (or want) these accessors, I think; this is just private state of the CGF object, and nobody else should be using it.


================
Comment at: lib/CodeGen/CodeGenFunction.h:1112
+  llvm::DenseMap<const ParmVarDecl *, EHScopeStack::stable_iterator>
+      CalleeDestructedParamCleanups;
+
----------------
It's too bad that we need this DenseMap in every CGF when actually only a very specific set of thunk functions will actually use it.  But I guess DenseMap is at least trivial to construct/destroy when empty, which will be the most common case.


================
Comment at: lib/CodeGen/CodeGenFunction.h:1116
+  EHScopeStack::stable_iterator CurrentCleanupStackDepth =
+      EHScopeStack::stable_end();
+
----------------
How about `CurrentCleanupScopeDepth`?  The current name makes it sound like it's the active depth of the cleanup stack.


Repository:
  rC Clang

https://reviews.llvm.org/D45382





More information about the cfe-commits mailing list