[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
Tue Jan 12 15:52:30 PST 2016


ahatanak added a comment.

In http://reviews.llvm.org/D15599#325113, @hans wrote:

> Just out of curiosity, where does this come up in practice?


I only have a short test case a user provided so t's not really clear whether it was necessary to mark a member function naked or there were other ways to get the same behavior. But unless we want to disallow marking member functions as naked, we shouldn't let clang crash when it compiles such functions.

> It seems a little backward that we're first emitting a bunch of instructions, only to remove them later. It would be nice if for naked function we wouldn't emit them in the first place. But maybe that's not practical.


I initially tried to block the instructions from being emitted but I ended up checking hasAttr<NakedAttr>() in a lot of places. I agree approach taken in this patch might look a bit backward, but it seemed better than the alternative.

> Anyway, this seems OK to me but I'd like to hear what Reid thinks too.



http://reviews.llvm.org/D15599





More information about the cfe-commits mailing list