[cfe-commits] r69031 - /cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Chris Lattner sabre at nondot.org
Mon Apr 13 23:32:05 PDT 2009


Author: lattner
Date: Tue Apr 14 01:32:05 2009
New Revision: 69031

URL: http://llvm.org/viewvc/llvm-project?rev=69031&view=rev
Log:
give always_inline functions internal linkage.  If they cannot be 
inlined for some reason, then we don't want a strong or even weak
definition.

Modified:
    cfe/trunk/lib/CodeGen/CodeGenModule.cpp

Modified: cfe/trunk/lib/CodeGen/CodeGenModule.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CodeGenModule.cpp?rev=69031&r1=69030&r2=69031&view=diff

==============================================================================
--- cfe/trunk/lib/CodeGen/CodeGenModule.cpp (original)
+++ cfe/trunk/lib/CodeGen/CodeGenModule.cpp Tue Apr 14 01:32:05 2009
@@ -325,7 +325,9 @@
 static CodeGenModule::GVALinkage 
 GetLinkageForFunctionOrMethodDecl(const Decl *D) {
   if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) {
-    if (FD->getStorageClass() == FunctionDecl::Static)
+    // "static" and attr(always_inline) functions get internal linkage.
+    if (FD->getStorageClass() == FunctionDecl::Static ||
+        FD->hasAttr<AlwaysInlineAttr>())
       return CodeGenModule::GVA_Internal;
     if (FD->isInline()) {
       if (FD->getStorageClass() == FunctionDecl::Extern)





More information about the cfe-commits mailing list