[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
Wed Dec 16 18:42:06 PST 2015


ahatanak created this revision.
ahatanak added a subscriber: cfe-commits.

clang crashes when it compiles a member function or a lambda is marked as "naked":

struct S {
  __attribute__((naked)) S() {}
}

To fix this bug, this patch defines a function that cleans up the naked function removing all allocas and their users and all basic blocks except the entry block. Also, it makes changes so that, if a non-void function is marked as naked, llvm.trap isn't inserted into the function even if it doesn't have a return statement.

http://reviews.llvm.org/D15599

Files:
  lib/CodeGen/CGCall.cpp
  lib/CodeGen/CGStmt.cpp
  lib/CodeGen/CodeGenFunction.cpp
  lib/CodeGen/CodeGenFunction.h
  test/CodeGen/attr-naked.c
  test/CodeGenCXX/attr-naked.cpp
  test/CodeGenCXX/ms-inline-asm-return.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D15599.43095.patch
Type: text/x-patch
Size: 8178 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20151217/1956d919/attachment.bin>


More information about the cfe-commits mailing list