summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CGObjCMac.cpp
diff options
context:
space:
mode:
authorRafael Espindola <rafael.espindola@gmail.com>2014-03-06 18:54:12 +0000
committerRafael Espindola <rafael.espindola@gmail.com>2014-03-06 18:54:12 +0000
commit70efc5b4dba3fc68dbd8a92af7f3f24061f26e5c (patch)
treec1b391be00ed0085ad0fc7e511297a379a579e2c /clang/lib/CodeGen/CGObjCMac.cpp
parent6f548ec37e670f9a46c7a3e937d10b60bf71f802 (diff)
downloadbcm5719-llvm-70efc5b4dba3fc68dbd8a92af7f3f24061f26e5c.tar.gz
bcm5719-llvm-70efc5b4dba3fc68dbd8a92af7f3f24061f26e5c.zip
Revert "Use private linkage for remaining GlobalVariables with private names."
This reverts commit r203059. Revert while we discuss what does it mean to be private and weak. llvm-svn: 203141
Diffstat (limited to 'clang/lib/CodeGen/CGObjCMac.cpp')
-rw-r--r--clang/lib/CodeGen/CGObjCMac.cpp22
1 files changed, 11 insertions, 11 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp
index 55bd7235112..0cb38f27aa0 100644
--- a/clang/lib/CodeGen/CGObjCMac.cpp
+++ b/clang/lib/CodeGen/CGObjCMac.cpp
@@ -5955,11 +5955,11 @@ llvm::Value *CGObjCNonFragileABIMac::GenerateProtocolRef(CodeGenFunction &CGF,
PTGV = new llvm::GlobalVariable(
CGM.getModule(),
Init->getType(), false,
- llvm::GlobalValue::PrivateLinkage,
+ llvm::GlobalValue::WeakAnyLinkage,
Init,
ProtocolName);
- assertPrivateName(PTGV);
PTGV->setSection("__DATA, __objc_protorefs, coalesced, no_dead_strip");
+ PTGV->setVisibility(llvm::GlobalValue::HiddenVisibility);
CGM.AddUsedGlobal(PTGV);
return CGF.Builder.CreateLoad(PTGV);
}
@@ -6243,11 +6243,10 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocolRef(
// contents for protocols which were referenced but never defined.
Entry =
new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ProtocolnfABITy,
- false, llvm::GlobalValue::PrivateLinkage, 0,
+ false, llvm::GlobalValue::WeakAnyLinkage, 0,
"\01l_OBJC_PROTOCOL_$_" + PD->getName());
Entry->setSection("__DATA,__datacoal_nt,coalesced");
}
- assertPrivateName(Entry);
return Entry;
}
@@ -6359,11 +6358,12 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol(
if (Entry) {
// Already created, update the initializer.
+ assert(Entry->getLinkage() == llvm::GlobalValue::WeakAnyLinkage);
Entry->setInitializer(Init);
} else {
Entry =
new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ProtocolnfABITy,
- false, llvm::GlobalValue::PrivateLinkage, Init,
+ false, llvm::GlobalValue::WeakAnyLinkage, Init,
"\01l_OBJC_PROTOCOL_$_" + PD->getName());
Entry->setAlignment(
CGM.getDataLayout().getABITypeAlignment(ObjCTypes.ProtocolnfABITy));
@@ -6371,19 +6371,19 @@ llvm::Constant *CGObjCNonFragileABIMac::GetOrEmitProtocol(
Protocols[PD->getIdentifier()] = Entry;
}
- assertPrivateName(Entry);
+ Entry->setVisibility(llvm::GlobalValue::HiddenVisibility);
CGM.AddUsedGlobal(Entry);
// Use this protocol meta-data to build protocol list table in section
// __DATA, __objc_protolist
llvm::GlobalVariable *PTGV =
new llvm::GlobalVariable(CGM.getModule(), ObjCTypes.ProtocolnfABIPtrTy,
- false, llvm::GlobalValue::PrivateLinkage, Entry,
+ false, llvm::GlobalValue::WeakAnyLinkage, Entry,
"\01l_OBJC_LABEL_PROTOCOL_$_" + PD->getName());
- assertPrivateName(PTGV);
PTGV->setAlignment(
CGM.getDataLayout().getABITypeAlignment(ObjCTypes.ProtocolnfABIPtrTy));
PTGV->setSection("__DATA, __objc_protolist, coalesced, no_dead_strip");
+ PTGV->setVisibility(llvm::GlobalValue::HiddenVisibility);
CGM.AddUsedGlobal(PTGV);
return Entry;
}
@@ -6592,14 +6592,14 @@ CGObjCNonFragileABIMac::EmitVTableMessageSend(CodeGenFunction &CGF,
messageRef = new llvm::GlobalVariable(CGM.getModule(),
init->getType(),
/*constant*/ false,
- llvm::GlobalValue::PrivateLinkage,
+ llvm::GlobalValue::WeakAnyLinkage,
init,
messageRefName);
+ messageRef->setVisibility(llvm::GlobalValue::HiddenVisibility);
messageRef->setAlignment(16);
messageRef->setSection("__DATA, __objc_msgrefs, coalesced");
}
- assertPrivateName(messageRef);
-
+
bool requiresnullCheck = false;
if (CGM.getLangOpts().ObjCAutoRefCount && method)
for (ObjCMethodDecl::param_const_iterator i = method->param_begin(),
OpenPOWER on IntegriCloud