aboutsummaryrefslogtreecommitdiff
path: root/lib/CodeGen/CGObjC.cpp
diff options
context:
space:
mode:
authorJohn McCall <rjmccall@apple.com>2011-07-06 00:26:06 +0000
committerJohn McCall <rjmccall@apple.com>2011-07-06 00:26:06 +0000
commit9f084a3166b684573ba49df28fc5792bc37d92e1 (patch)
treed2976a87e54f0ef1014c769e44f86ab27212176f /lib/CodeGen/CGObjC.cpp
parent9670e179a67d868e171feac44fb8f9e2f108c5e8 (diff)
Change the driver's logic about Objective-C runtimes: abstract out a
structure to hold inferred information, then propagate each invididual bit down to -cc1. Separate the bits of "supports weak" and "has a native ARC runtime"; make the latter a CodeGenOption. The tool chain is still driving this decision, because it's the place that has the required deployment target information on Darwin, but at least it's better-factored now. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134453 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGObjC.cpp')
-rw-r--r--lib/CodeGen/CGObjC.cpp10
1 files changed, 2 insertions, 8 deletions
diff --git a/lib/CodeGen/CGObjC.cpp b/lib/CodeGen/CGObjC.cpp
index db9873b817..d8ce1f4a75 100644
--- a/lib/CodeGen/CGObjC.cpp
+++ b/lib/CodeGen/CGObjC.cpp
@@ -1311,7 +1311,7 @@ static llvm::Constant *createARCRuntimeFunction(CodeGenModule &CGM,
// In -fobjc-no-arc-runtime, emit weak references to the runtime
// support library.
- if (CGM.getLangOptions().ObjCNoAutoRefCountRuntime)
+ if (!CGM.getCodeGenOpts().ObjCRuntimeHasARC)
if (llvm::Function *f = dyn_cast<llvm::Function>(fn))
f->setLinkage(llvm::Function::ExternalWeakLinkage);
@@ -2457,13 +2457,7 @@ void CodeGenFunction::EmitObjCAutoreleasePoolStmt(
// Keep track of the current cleanup stack depth.
RunCleanupsScope Scope(*this);
- const llvm::Triple Triple = getContext().Target.getTriple();
- if (CGM.getLangOptions().ObjCAutoRefCount ||
- (CGM.isTargetDarwin() &&
- ((Triple.getArch() == llvm::Triple::x86_64 &&
- !Triple.isMacOSXVersionLT(10,7,0))
- || (Triple.getEnvironmentName() == "iphoneos" &&
- !Triple.isOSVersionLT(5,0))))) {
+ if (CGM.getCodeGenOpts().ObjCRuntimeHasARC) {
llvm::Value *token = EmitObjCAutoreleasePoolPush();
EHStack.pushCleanup<CallObjCAutoreleasePoolObject>(NormalCleanup, token);
} else {