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 | cf50e6d6ce645381b794b8fab5d85dd9568ff201 (patch) | |
tree | 1469dc19075f6d45c4aa9fac9016fc690356e0e3 /clang/lib/CodeGen | |
parent | 93482a523c4480291679254dd09b05d6da98b20c (diff) | |
download | bcm5719-llvm-cf50e6d6ce645381b794b8fab5d85dd9568ff201.tar.gz bcm5719-llvm-cf50e6d6ce645381b794b8fab5d85dd9568ff201.zip |
On platforms which do not support ARC natively, do not mark objc_retain/objc_release as "nonlazybind".
rdar://13108298.
rdar://13129783.
llvm-svn: 174253
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGObjC.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGObjC.cpp b/clang/lib/CodeGen/CGObjC.cpp index e861222cf5f..d667e1aacb9 100644 --- a/clang/lib/CodeGen/CGObjC.cpp +++ b/clang/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; } |