[PATCH] D22715: Don't crash when generating code for __attribute__((naked)) member functions.
Justin Lebar via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 27 15:12:11 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL276925: Don't crash when generating code for __attribute__((naked)) member functions. (authored by jlebar).
Changed prior to commit:
https://reviews.llvm.org/D22715?vs=65207&id=65814#toc
Repository:
rL LLVM
https://reviews.llvm.org/D22715
Files:
cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
cfe/trunk/test/CodeGenCXX/naked.cpp
Index: cfe/trunk/test/CodeGenCXX/naked.cpp
===================================================================
--- cfe/trunk/test/CodeGenCXX/naked.cpp
+++ cfe/trunk/test/CodeGenCXX/naked.cpp
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s
+// RUN: %clang_cc1 -triple x86_64-windows -emit-llvm %s -o - | FileCheck %s
+
+class TestNaked {
+public:
+ void NakedFunction();
+};
+
+__attribute__((naked)) void TestNaked::NakedFunction() {
+ // CHECK-LABEL: define void @
+ // CHECK: call void asm sideeffect
+ asm("");
+}
Index: cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
+++ cfe/trunk/lib/CodeGen/MicrosoftCXXABI.cpp
@@ -1417,6 +1417,10 @@
}
void MicrosoftCXXABI::EmitInstanceFunctionProlog(CodeGenFunction &CGF) {
+ // Naked functions have no prolog.
+ if (CGF.CurFuncDecl && CGF.CurFuncDecl->hasAttr<NakedAttr>())
+ return;
+
EmitThisParam(CGF);
/// If this is a function that the ABI specifies returns 'this', initialize
Index: cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
===================================================================
--- cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
+++ cfe/trunk/lib/CodeGen/ItaniumCXXABI.cpp
@@ -1390,6 +1390,10 @@
}
void ItaniumCXXABI::EmitInstanceFunctionProlog(CodeGenFunction &CGF) {
+ // Naked functions have no prolog.
+ if (CGF.CurFuncDecl && CGF.CurFuncDecl->hasAttr<NakedAttr>())
+ return;
+
/// Initialize the 'this' slot.
EmitThisParam(CGF);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D22715.65814.patch
Type: text/x-patch
Size: 1558 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160727/5c799bcd/attachment.bin>
More information about the llvm-commits
mailing list