aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CodeGenModule.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2010-02-18 21:31:48 +0000
committerJohn McCall <rjmccall@apple.com>2010-02-18 21:31:48 +0000
commit8e51a1f5da6ef4a1a168d14116c6eed3a578a263 (patch)
tree5491283b764974f5718025ac6ff4dbb87591dc29 /lib/CodeGen/CodeGenModule.cpp
parentb372b0ff1f1a0c6814163e0fe2f22f343bac87a8 (diff)
Revert the ctor/dtor alias optimization for now; the buildbots can detect
some failure here that I can't. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@96612 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CodeGenModule.cpp')
-rw-r--r--lib/CodeGen/CodeGenModule.cpp29
1 files changed, 12 insertions, 17 deletions
diff --git a/lib/CodeGen/CodeGenModule.cpp b/lib/CodeGen/CodeGenModule.cpp
index 41575e41e5..5a552c490a 100644
--- a/lib/CodeGen/CodeGenModule.cpp
+++ b/lib/CodeGen/CodeGenModule.cpp
@@ -316,20 +316,24 @@ GetLinkageForFunction(ASTContext &Context, const FunctionDecl *FD,
return CodeGenModule::GVA_CXXInline;
}
-llvm::GlobalValue::LinkageTypes
-CodeGenModule::getFunctionLinkage(const FunctionDecl *D) {
+/// SetFunctionDefinitionAttributes - Set attributes for a global.
+///
+/// FIXME: This is currently only done for aliases and functions, but not for
+/// variables (these details are set in EmitGlobalVarDefinition for variables).
+void CodeGenModule::SetFunctionDefinitionAttributes(const FunctionDecl *D,
+ llvm::GlobalValue *GV) {
GVALinkage Linkage = GetLinkageForFunction(getContext(), D, Features);
if (Linkage == GVA_Internal) {
- return llvm::Function::InternalLinkage;
+ GV->setLinkage(llvm::Function::InternalLinkage);
} else if (D->hasAttr<DLLExportAttr>()) {
- return llvm::Function::DLLExportLinkage;
+ GV->setLinkage(llvm::Function::DLLExportLinkage);
} else if (D->hasAttr<WeakAttr>()) {
- return llvm::Function::WeakAnyLinkage;
+ GV->setLinkage(llvm::Function::WeakAnyLinkage);
} else if (Linkage == GVA_C99Inline) {
// In C99 mode, 'inline' functions are guaranteed to have a strong
// definition somewhere else, so we can use available_externally linkage.
- return llvm::Function::AvailableExternallyLinkage;
+ GV->setLinkage(llvm::Function::AvailableExternallyLinkage);
} else if (Linkage == GVA_CXXInline || Linkage == GVA_TemplateInstantiation) {
// In C++, the compiler has to emit a definition in every translation unit
// that references the function. We should use linkonce_odr because
@@ -337,22 +341,13 @@ CodeGenModule::getFunctionLinkage(const FunctionDecl *D) {
// don't need to codegen it. b) if the function persists, it needs to be
// merged with other definitions. c) C++ has the ODR, so we know the
// definition is dependable.
- return llvm::Function::LinkOnceODRLinkage;
+ GV->setLinkage(llvm::Function::LinkOnceODRLinkage);
} else {
assert(Linkage == GVA_StrongExternal);
// Otherwise, we have strong external linkage.
- return llvm::Function::ExternalLinkage;
+ GV->setLinkage(llvm::Function::ExternalLinkage);
}
-}
-
-/// SetFunctionDefinitionAttributes - Set attributes for a global.
-///
-/// FIXME: This is currently only done for aliases and functions, but not for
-/// variables (these details are set in EmitGlobalVarDefinition for variables).
-void CodeGenModule::SetFunctionDefinitionAttributes(const FunctionDecl *D,
- llvm::GlobalValue *GV) {
- GV->setLinkage(getFunctionLinkage(D));
SetCommonAttributes(D, GV);
}