forked from OSchip/llvm-project
Driver/Darwin: Add deployment target after doing argument translation, so that
-mmacosx-version-min works inside a -Xarch_ flag. llvm-svn: 108712
This commit is contained in:
parent
b2b8a91aa4
commit
354e96df95
|
@ -415,8 +415,7 @@ void DarwinClang::AddLinkRuntimeLibArgs(const ArgList &Args,
|
|||
}
|
||||
}
|
||||
|
||||
void Darwin::AddDeploymentTarget(const DerivedArgList &Args,
|
||||
DerivedArgList *DAL) const {
|
||||
void Darwin::AddDeploymentTarget(DerivedArgList &Args) const {
|
||||
const OptTable &Opts = getDriver().getOpts();
|
||||
|
||||
Arg *OSXVersion = Args.getLastArg(options::OPT_mmacosx_version_min_EQ);
|
||||
|
@ -454,17 +453,17 @@ void Darwin::AddDeploymentTarget(const DerivedArgList &Args,
|
|||
|
||||
if (OSXTarget) {
|
||||
const Option *O = Opts.getOption(options::OPT_mmacosx_version_min_EQ);
|
||||
OSXVersion = DAL->MakeJoinedArg(0, O, OSXTarget);
|
||||
DAL->append(OSXVersion);
|
||||
OSXVersion = Args.MakeJoinedArg(0, O, OSXTarget);
|
||||
Args.append(OSXVersion);
|
||||
} else if (iPhoneOSTarget) {
|
||||
const Option *O = Opts.getOption(options::OPT_miphoneos_version_min_EQ);
|
||||
iPhoneVersion = DAL->MakeJoinedArg(0, O, iPhoneOSTarget);
|
||||
DAL->append(iPhoneVersion);
|
||||
iPhoneVersion = Args.MakeJoinedArg(0, O, iPhoneOSTarget);
|
||||
Args.append(iPhoneVersion);
|
||||
} else {
|
||||
// Otherwise, assume we are targeting OS X.
|
||||
const Option *O = Opts.getOption(options::OPT_mmacosx_version_min_EQ);
|
||||
OSXVersion = DAL->MakeJoinedArg(0, O, MacosxVersionMin);
|
||||
DAL->append(OSXVersion);
|
||||
OSXVersion = Args.MakeJoinedArg(0, O, MacosxVersionMin);
|
||||
Args.append(OSXVersion);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -500,7 +499,6 @@ DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args,
|
|||
// purpose of easily achieving feature parity & testability. Once we
|
||||
// have something that works, we should reevaluate each translation
|
||||
// and try to push it down into tool specific logic.
|
||||
AddDeploymentTarget(Args, DAL);
|
||||
|
||||
for (ArgList::const_iterator it = Args.begin(),
|
||||
ie = Args.end(); it != ie; ++it) {
|
||||
|
@ -679,6 +677,11 @@ DerivedArgList *Darwin::TranslateArgs(const DerivedArgList &Args,
|
|||
llvm_unreachable("invalid Darwin arch");
|
||||
}
|
||||
|
||||
// Add an explicit version min argument for the deployment target. We do this
|
||||
// after argument translation because -Xarch_ arguments may add a version min
|
||||
// argument.
|
||||
AddDeploymentTarget(*DAL);
|
||||
|
||||
return DAL;
|
||||
}
|
||||
|
||||
|
|
|
@ -62,8 +62,7 @@ class LLVM_LIBRARY_VISIBILITY Darwin : public ToolChain {
|
|||
std::string MacosxVersionMin;
|
||||
|
||||
private:
|
||||
void AddDeploymentTarget(const DerivedArgList &Args,
|
||||
DerivedArgList *DAL) const;
|
||||
void AddDeploymentTarget(DerivedArgList &Args) const;
|
||||
|
||||
public:
|
||||
Darwin(const HostInfo &Host, const llvm::Triple& Triple,
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
// RUN: %clang -ccc-no-clang -ccc-host-triple i386-apple-darwin10 -m32 -### -MD -g -fast -Q -dA -mkernel -ansi -aFOO -S -o /tmp/OUTPUTNAME -g0 -gfull -O2 -Werror -pedantic -Wmost -w -std=c99 -trigraphs -v -pg -fFOO -undef -Qn --param a=b -fmudflap -coverage -save-temps -nostdinc -I ARG0 -F ARG1 -I ARG2 -P -MF ARG3 -MG -MP -remap -g3 -H -D ARG4 -U ARG5 -A ARG6 -D ARG7 -U ARG8 -A ARG9 -include ARG10 -pthread %s 2> %t.log
|
||||
// RUN: grep ' ".*cc1" "-E" "-nostdinc" "-v" "-I" "ARG0" "-FARG1" "-I" "ARG2" "-P" "-MD" "/tmp/OUTPUTNAME.d" "-MF" "ARG3" "-MG" "-MP" "-MQ" "/tmp/OUTPUTNAME" "-remap" "-dD" "-H" "-D__STATIC__" "-D_REENTRANT" "-D" "ARG4" "-U" "ARG5" "-A" "ARG6" "-D" "ARG7" "-U" "ARG8" "-A" "ARG9" "-include" "ARG10" ".*darwin-cc.c" "-D_MUDFLAP" "-include" "mf-runtime.h" "-mmacosx-version-min=10.6.0" "-m32" "-mkernel" "-mtune=core2" "-ansi" "-std=c99" "-trigraphs" "-Werror" "-pedantic" "-Wmost" "-w" "-fast" "-fno-eliminate-unused-debug-symbols" "-fFOO" "-fmudflap" "-O2" "-undef" "-fpch-preprocess" "-o" ".*darwin-cc.i"' %t.log
|
||||
// RUN: grep ' ".*cc1" "-fpreprocessed" ".*darwin-cc.i" "-O3" "-dumpbase" ".*darwin-cc.c" "-dA" "-mmacosx-version-min=10.6.0" "-m32" "-mkernel" "-mtune=core2" "-ansi" "-aFOO" "-auxbase-strip" "/tmp/OUTPUTNAME" "-g" "-g0" "-g" "-g3" "-O2" "-Werror" "-pedantic" "-Wmost" "-w" "-ansi" "-std=c99" "-trigraphs" "-version" "-p" "-fast" "-fno-eliminate-unused-debug-symbols" "-fFOO" "-fmudflap" "-undef" "-fno-ident" "-o" "/tmp/OUTPUTNAME" "--param" "a=b" "-fno-builtin" "-fno-merge-constants" "-fprofile-arcs" "-ftest-coverage"' %t.log
|
||||
// RUN: grep ' ".*cc1" "-E" "-nostdinc" "-v" "-I" "ARG0" "-FARG1" "-I" "ARG2" "-P" "-MD" "/tmp/OUTPUTNAME.d" "-MF" "ARG3" "-MG" "-MP" "-MQ" "/tmp/OUTPUTNAME" "-remap" "-dD" "-H" "-D__STATIC__" "-D_REENTRANT" "-D" "ARG4" "-U" "ARG5" "-A" "ARG6" "-D" "ARG7" "-U" "ARG8" "-A" "ARG9" "-include" "ARG10" ".*darwin-cc.c" "-D_MUDFLAP" "-include" "mf-runtime.h" "-m32" "-mkernel" "-mtune=core2" "-mmacosx-version-min=10.6.0" "-ansi" "-std=c99" "-trigraphs" "-Werror" "-pedantic" "-Wmost" "-w" "-fast" "-fno-eliminate-unused-debug-symbols" "-fFOO" "-fmudflap" "-O2" "-undef" "-fpch-preprocess" "-o" ".*darwin-cc.i"' %t.log
|
||||
// RUN: grep ' ".*cc1" "-fpreprocessed" ".*darwin-cc.i" "-O3" "-dumpbase" ".*darwin-cc.c" "-dA" "-m32" "-mkernel" "-mtune=core2" "-mmacosx-version-min=10.6.0" "-ansi" "-aFOO" "-auxbase-strip" "/tmp/OUTPUTNAME" "-g" "-g0" "-g" "-g3" "-O2" "-Werror" "-pedantic" "-Wmost" "-w" "-ansi" "-std=c99" "-trigraphs" "-version" "-p" "-fast" "-fno-eliminate-unused-debug-symbols" "-fFOO" "-fmudflap" "-undef" "-fno-ident" "-o" "/tmp/OUTPUTNAME" "--param" "a=b" "-fno-builtin" "-fno-merge-constants" "-fprofile-arcs" "-ftest-coverage"' %t.log
|
||||
|
||||
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
// <rdar://problem/7256886>
|
||||
|
||||
// CHECK: !1 = metadata !{
|
||||
// CHECK: -mmacosx-version-min=10.5.0
|
||||
// CHECK: -g -Os
|
||||
// CHECK: -mmacosx-version-min=10.5.0
|
||||
// CHECK: [ DW_TAG_compile_unit ]
|
||||
|
||||
int x;
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
// RUN: %clang -ccc-host-triple x86_64-apple-darwin10 -### \
|
||||
// RUN: -arch i386 -Xarch_i386 -mmacosx-version-min=10.4 \
|
||||
// RUN: -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5 \
|
||||
// RUN: -c %s 2> %t
|
||||
// RUN: FileCheck < %t %s
|
||||
//
|
||||
// CHECK: clang" "-cc1" "-triple" "i386-apple-darwin8.0.0"
|
||||
// CHECK: clang" "-cc1" "-triple" "x86_64-apple-darwin9.0.0"
|
Loading…
Reference in New Issue