aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2009-04-14 06:44:48 +0000
committerChris Lattner <sabre@nondot.org>2009-04-14 06:44:48 +0000
commitdbb5a376c8b9272813a30c5519031e9ea2fb071f (patch)
tree91bc12076b85ed1569d71d20ac4d49941dcb28bd /lib/CodeGen/CodeGenModule.cpp
parentd5ee6677c5f22409039a019accf41ec3937afe99 (diff)
defer emission of always_inline, extern_inline, and inline functions (when
not in c89 mode). git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69032 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--lib/CodeGen/CodeGenModule.cpp27
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 5ef57ffdcc..c771461704 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -482,18 +482,23 @@ bool CodeGenModule::MayDeferGeneration(const ValueDecl *Global) {
if (FD->hasAttr<ConstructorAttr>() || FD->hasAttr<DestructorAttr>())
return false;
- // FIXME: What about inline, and/or extern inline?
- if (FD->getStorageClass() != FunctionDecl::Static)
- return false;
- } else {
- const VarDecl *VD = cast<VarDecl>(Global);
- assert(VD->isFileVarDecl() && "Invalid decl");
-
- if (VD->getStorageClass() != VarDecl::Static)
- return false;
+ GVALinkage Linkage = GetLinkageForFunctionOrMethodDecl(FD);
+
+ // static, static inline, always_inline, and extern inline functions can
+ // always be deferred.
+ if (Linkage == GVA_Internal || Linkage == GVA_ExternInline)
+ return true;
+
+ // inline functions can be deferred unless we're in C89 mode.
+ if (Linkage == GVA_Inline && (Features.C99 || Features.CPlusPlus))
+ return true;
+
+ return false;
}
-
- return true;
+
+ const VarDecl *VD = cast<VarDecl>(Global);
+ assert(VD->isFileVarDecl() && "Invalid decl");
+ return VD->getStorageClass() == VarDecl::Static;
}
void CodeGenModule::EmitGlobal(const ValueDecl *Global) {