|
@@ -1803,25 +1803,25 @@ void CodeGenFunction::EmitARCIntrinsicUse(ArrayRef<llvm::Value*> values) {
|
|
|
|
|
|
|
|
|
|
static llvm::Constant *createARCRuntimeFunction(CodeGenModule &CGM,
|
|
static llvm::Constant *createARCRuntimeFunction(CodeGenModule &CGM,
|
|
- llvm::FunctionType *type,
|
|
|
|
- StringRef fnName) {
|
|
|
|
- llvm::Constant *fn = CGM.CreateRuntimeFunction(type, fnName);
|
|
|
|
|
|
+ llvm::FunctionType *FTy,
|
|
|
|
+ StringRef Name) {
|
|
|
|
+ llvm::Constant *RTF = CGM.CreateRuntimeFunction(FTy, Name);
|
|
|
|
|
|
- if (llvm::Function *f = dyn_cast<llvm::Function>(fn)) {
|
|
|
|
|
|
+ if (auto *F = dyn_cast<llvm::Function>(RTF)) {
|
|
// If the target runtime doesn't naturally support ARC, emit weak
|
|
// If the target runtime doesn't naturally support ARC, emit weak
|
|
// references to the runtime support library. We don't really
|
|
// references to the runtime support library. We don't really
|
|
// permit this to fail, but we need a particular relocation style.
|
|
// permit this to fail, but we need a particular relocation style.
|
|
if (!CGM.getLangOpts().ObjCRuntime.hasNativeARC() &&
|
|
if (!CGM.getLangOpts().ObjCRuntime.hasNativeARC() &&
|
|
!CGM.getTriple().isOSBinFormatCOFF()) {
|
|
!CGM.getTriple().isOSBinFormatCOFF()) {
|
|
- f->setLinkage(llvm::Function::ExternalWeakLinkage);
|
|
|
|
- } else if (fnName == "objc_retain" || fnName == "objc_release") {
|
|
|
|
|
|
+ F->setLinkage(llvm::Function::ExternalWeakLinkage);
|
|
|
|
+ } else if (Name == "objc_retain" || Name == "objc_release") {
|
|
// If we have Native ARC, set nonlazybind attribute for these APIs for
|
|
// If we have Native ARC, set nonlazybind attribute for these APIs for
|
|
// performance.
|
|
// performance.
|
|
- f->addFnAttr(llvm::Attribute::NonLazyBind);
|
|
|
|
|
|
+ F->addFnAttr(llvm::Attribute::NonLazyBind);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- return fn;
|
|
|
|
|
|
+ return RTF;
|
|
}
|
|
}
|
|
|
|
|
|
/// Perform an operation having the signature
|
|
/// Perform an operation having the signature
|
|
@@ -1832,7 +1832,8 @@ static llvm::Value *emitARCValueOperation(CodeGenFunction &CGF,
|
|
llvm::Constant *&fn,
|
|
llvm::Constant *&fn,
|
|
StringRef fnName,
|
|
StringRef fnName,
|
|
bool isTailCall = false) {
|
|
bool isTailCall = false) {
|
|
- if (isa<llvm::ConstantPointerNull>(value)) return value;
|
|
|
|
|
|
+ if (isa<llvm::ConstantPointerNull>(value))
|
|
|
|
+ return value;
|
|
|
|
|
|
if (!fn) {
|
|
if (!fn) {
|
|
llvm::FunctionType *fnType =
|
|
llvm::FunctionType *fnType =
|