diff options
author | Michael Gottesman <mgottesman@apple.com> | 2013-02-02 00:57:44 +0000 |
---|---|---|
committer | Michael Gottesman <mgottesman@apple.com> | 2013-02-02 00:57:44 +0000 |
commit | 554b07d30484185a313dbe2c5e2fd5798ac3f998 (patch) | |
tree | 67fedb4ce85a562bd1292c704d2058ecfd95c979 /lib/CodeGen/CGObjC.cpp | |
parent | a7f8da123f765bb7a0a53f9f23fa832f9a8a2889 (diff) |
On platforms which do not support ARC natively, do not mark objc_retain/objc_release as "nonlazybind".
rdar://13108298.
rdar://13129783.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@174253 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjC.cpp')
-rw-r--r-- | lib/CodeGen/CGObjC.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp index e861222cf5..d667e1aacb 100644 --- a/lib/CodeGen/CGObjC.cpp +++ b/lib/CodeGen/CGObjC.cpp @@ -1705,16 +1705,18 @@ static llvm::Constant *createARCRuntimeFunction(CodeGenModule &CGM, StringRef fnName) { llvm::Constant *fn = CGM.CreateRuntimeFunction(type, fnName); + if (llvm::Function *f = dyn_cast<llvm::Function>(fn)) { // If the target runtime doesn't naturally support ARC, emit weak // references to the runtime support library. We don't really // permit this to fail, but we need a particular relocation style. - if (llvm::Function *f = dyn_cast<llvm::Function>(fn)) { - if (!CGM.getLangOpts().ObjCRuntime.hasNativeARC()) + if (!CGM.getLangOpts().ObjCRuntime.hasNativeARC()) { f->setLinkage(llvm::Function::ExternalWeakLinkage); - // set nonlazybind attribute for these APIs for performance. - if (fnName == "objc_retain" || fnName == "objc_release") + } else if (fnName == "objc_retain" || fnName == "objc_release") { + // If we have Native ARC, set nonlazybind attribute for these APIs for + // performance. f->addFnAttr(llvm::Attribute::NonLazyBind); } + } return fn; } |