[cfe-commits] r154037 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/rewrite-objc.m
Fariborz Jahanian
fjahanian at apple.com
Wed Apr 4 11:50:28 PDT 2012
Author: fjahanian
Date: Wed Apr 4 13:50:28 2012
New Revision: 154037
URL: http://llvm.org/viewvc/llvm-project?rev=154037&view=rev
Log:
modern objc translator. Add more
rewriter specific option to cc1 with -rewrite-objc.
// rdar://11143173
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/rewrite-objc.m
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=154037&r1=154036&r2=154037&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Wed Apr 4 13:50:28 2012
@@ -1279,6 +1279,8 @@
// Select the appropriate action.
bool IsRewriter = false;
+ bool IsModernRewriter = false;
+
if (isa<AnalyzeJobAction>(JA)) {
assert(JA.getType() == types::TY_Plist && "Invalid output type.");
CmdArgs.push_back("-analyze");
@@ -1349,6 +1351,7 @@
CmdArgs.push_back("-emit-pch");
} else if (JA.getType() == types::TY_RewrittenObjC) {
CmdArgs.push_back("-rewrite-objc");
+ IsModernRewriter = true;
} else if (JA.getType() == types::TY_RewrittenLegacyObjC) {
CmdArgs.push_back("-rewrite-objc");
IsRewriter = true;
@@ -2226,7 +2229,8 @@
ObjCRuntime objCRuntime;
unsigned objcABIVersion = 0;
bool NeXTRuntimeIsDefault
- = (IsRewriter || getToolChain().getTriple().isOSDarwin());
+ = (IsRewriter || IsModernRewriter ||
+ getToolChain().getTriple().isOSDarwin());
if (Args.hasFlag(options::OPT_fnext_runtime, options::OPT_fgnu_runtime,
NeXTRuntimeIsDefault)) {
objCRuntime.setKind(ObjCRuntime::NeXT);
@@ -2260,8 +2264,9 @@
D.Diag(diag::err_drv_clang_unsupported) << A->getAsString(Args);
} else {
// Otherwise, determine if we are using the non-fragile ABI.
- bool NonFragileABIIsDefault
- = (!IsRewriter && getToolChain().IsObjCNonFragileABIDefault());
+ bool NonFragileABIIsDefault =
+ (IsModernRewriter ||
+ (!IsRewriter && getToolChain().IsObjCNonFragileABIDefault()));
if (Args.hasFlag(options::OPT_fobjc_nonfragile_abi,
options::OPT_fno_objc_nonfragile_abi,
NonFragileABIIsDefault)) {
@@ -2341,7 +2346,7 @@
// -fobjc-infer-related-result-type is the default, except in the Objective-C
// rewriter.
- if (IsRewriter)
+ if (IsRewriter || IsModernRewriter)
CmdArgs.push_back("-fno-objc-infer-related-result-type");
// Handle -fobjc-gc and -fobjc-gc-only. They are exclusive, and -fobjc-gc-only
Modified: cfe/trunk/test/Driver/rewrite-objc.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/rewrite-objc.m?rev=154037&r1=154036&r2=154037&view=diff
==============================================================================
--- cfe/trunk/test/Driver/rewrite-objc.m (original)
+++ cfe/trunk/test/Driver/rewrite-objc.m Wed Apr 4 13:50:28 2012
@@ -3,7 +3,7 @@
// TEST0: clang{{.*}}" "-cc1"
// TEST0: "-rewrite-objc"
// FIXME: CHECK-NOT is broken somehow, it doesn't work here. Check adjacency instead.
-// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime-has-arc" "-fobjc-runtime-has-weak" "-fobjc-dispatch-method=mixed" "-fobjc-default-synthesize-properties" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option"
+// TEST0: "-fmessage-length" "0" "-stack-protector" "1" "-mstackrealign" "-fblocks" "-fobjc-runtime-has-arc" "-fobjc-runtime-has-weak" "-fobjc-dispatch-method=mixed" "-fobjc-default-synthesize-properties" "-fno-objc-infer-related-result-type" "-fobjc-exceptions" "-fexceptions" "-fdiagnostics-show-option"
// TEST0: rewrite-objc.m"
// RUN: not %clang -ccc-no-clang -target unknown -rewrite-objc %s -o - -### 2>&1 | \
More information about the cfe-commits
mailing list