[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
Mon Jan 25 13:37:59 PST 2016

ahatanak added inline comments.

Comment at: lib/CodeGen/CodeGenFunction.cpp:1954
@@ +1953,3 @@
+  // Erase all allocas and their users.
+  for (auto I = EntryBB->begin(); &*I != &*AllocaInsertPt; ++I)
+    if (auto Alloca = dyn_cast<llvm::AllocaInst>(&*I))
hans wrote:
> would declaring I as llvm::Instruction* allow you to get rid off the "&*" stuff here and below? If so, same for "auto BB" further down.
We can git rid of the "&*" in the code here if we declare I as Instruction*, but we will need to add "&*" to Entry->begin() to convert it to an Instruction*. In addition, we will have to use getNextNode instead of ++II or I++, so it seems to me that using an iterator is better in this case.


More information about the cfe-commits mailing list