]> granicus.if.org Git - clang/commitdiff
Add irgen support for the noinline attribute.
authorAnders Carlsson <andersca@mac.com>
Thu, 19 Feb 2009 19:22:11 +0000 (19:22 +0000)
committerAnders Carlsson <andersca@mac.com>
Thu, 19 Feb 2009 19:22:11 +0000 (19:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@65056 91177308-0d34-0410-b5e6-96231b3b80d8

lib/CodeGen/CodeGenModule.cpp
test/CodeGen/attr-noinline.c [new file with mode: 0644]

index ae472f01ce62190d89dacc1d83c6b00a814c6130..3d01770cd3a07bf2b38a2e6a9df607542183d870 100644 (file)
@@ -339,6 +339,9 @@ void CodeGenModule::SetFunctionAttributesForDefinition(const Decl *D,
 
   if (D->getAttr<AlwaysInlineAttr>())
     F->addFnAttr(llvm::Attribute::AlwaysInline);
+  
+  if (D->getAttr<NoinlineAttr>())
+    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 (file)
index 0000000..5aacf64
--- /dev/null
@@ -0,0 +1,9 @@
+// RUN: clang -g -emit-llvm -o %t %s &&
+// RUN: grep 'noinline' %t
+
+void t1() __attribute__((noinline));
+
+void t1()
+{
+}
+