forked from OSchip/llvm-project
modern objc translator. Add more
rewriter specific option to cc1 with -rewrite-objc. // rdar://11143173 llvm-svn: 154037
This commit is contained in:
parent
591ecdd7c1
commit
7ebeedea6c
|
@ -1279,6 +1279,8 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
// 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 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
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 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
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 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
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 @@ void Clang::ConstructJob(Compilation &C, const JobAction &JA,
|
|||
|
||||
// -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
|
||||
|
|
|
@ -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 | \
|
||||
|
|
Loading…
Reference in New Issue