[PATCH] D15599: [CodeGen] Fix a crash that occurs when attribute "naked" is attached to a c++ member function

Akira Hatanaka via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 22 13:01:13 PST 2016


ahatanak added inline comments.

================
Comment at: lib/CodeGen/CodeGenFunction.cpp:1962
@@ +1961,3 @@
+    for (auto *U : I->users())
+      InstrsToRemove.push_back(cast<llvm::Instruction>(U));
+
----------------
manmanren wrote:
> Do we need to check if the user has been erased? I am not sure if the same instruction can be pushed multiple times into InstrsToRemove.
I think you are right: it's incorrect to assume an instruction cannot be pushed twice. I'll change the type of InstrsToRemove to a set to prevent that from happenning.

================
Comment at: lib/CodeGen/CodeGenFunction.cpp:1979
@@ +1978,3 @@
+  if (auto *T = EntryBB->getTerminator())
+    T->eraseFromParent();
+
----------------
manmanren wrote:
> Is it possible that T has been erased in the above?
I'm not sure I understand. getTerminator will return null if there is no terminator or the basic block is empty, so I think this code is safe?


http://reviews.llvm.org/D15599





More information about the cfe-commits mailing list