From 81ebbde0fb30a40df0f5e913d8a1f71c383d271a Mon Sep 17 00:00:00 2001 From: Anders Carlsson Date: Thu, 19 Feb 2009 19:22:11 +0000 Subject: [PATCH] Add irgen support for the noinline attribute. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65056 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/CodeGen/CodeGenModule.cpp | 3 +++ test/CodeGen/attr-noinline.c | 9 +++++++++ 2 files changed, 12 insertions(+) create mode 100644 test/CodeGen/attr-noinline.c diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp index ae472f01ce..3d01770cd3 100644 --- a/lib/CodeGen/CodeGenModule.cpp +++ b/lib/CodeGen/CodeGenModule.cpp @@ -339,6 +339,9 @@ void CodeGenModule::SetFunctionAttributesForDefinition(const Decl *D, if (D->getAttr()) F->addFnAttr(llvm::Attribute::AlwaysInline); + + if (D->getAttr()) + F->addFnAttr(llvm::Attribute::NoInline); } void CodeGenModule::SetMethodAttributes(const ObjCMethodDecl *MD, diff --git a/test/CodeGen/attr-noinline.c b/test/CodeGen/attr-noinline.c new file mode 100644 index 0000000000..5aacf64a94 --- /dev/null +++ b/test/CodeGen/attr-noinline.c @@ -0,0 +1,9 @@ +// RUN: clang -g -emit-llvm -o %t %s && +// RUN: grep 'noinline' %t + +void t1() __attribute__((noinline)); + +void t1() +{ +} + -- 2.40.0