[cfe-commits] r108712 - in /cfe/trunk: lib/Driver/ToolChains.cpp lib/Driver/ToolChains.h test/Driver/darwin-cc.c test/Driver/darwin-debug-flags.c test/Driver/darwin-xarch.c
Daniel Dunbar
daniel at zuster.org
Mon Jul 19 10:11:36 PDT 2010
Author: ddunbar
Date: Mon Jul 19 12:11:36 2010
New Revision: 108712
URL: http://llvm.org/viewvc/llvm-project?rev=108712&view=rev
Log:
Driver/Darwin: Add deployment target after doing argument translation, so that
-mmacosx-version-min works inside a -Xarch_ flag.
Added:
cfe/trunk/test/Driver/darwin-xarch.c
Modified:
cfe/trunk/lib/Driver/ToolChains.cpp
cfe/trunk/lib/Driver/ToolChains.h
cfe/trunk/test/Driver/darwin-cc.c
cfe/trunk/test/Driver/darwin-debug-flags.c
Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=108712&r1=108711&r2=108712&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Mon Jul 19 12:11:36 2010
@@ -415,8 +415,7 @@
}
}
-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 @@
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 @@
// 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 @@
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;
}
Modified: cfe/trunk/lib/Driver/ToolChains.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.h?rev=108712&r1=108711&r2=108712&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.h (original)
+++ cfe/trunk/lib/Driver/ToolChains.h Mon Jul 19 12:11:36 2010
@@ -62,8 +62,7 @@
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,
Modified: cfe/trunk/test/Driver/darwin-cc.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-cc.c?rev=108712&r1=108711&r2=108712&view=diff
==============================================================================
--- cfe/trunk/test/Driver/darwin-cc.c (original)
+++ cfe/trunk/test/Driver/darwin-cc.c Mon Jul 19 12:11:36 2010
@@ -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
Modified: cfe/trunk/test/Driver/darwin-debug-flags.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-debug-flags.c?rev=108712&r1=108711&r2=108712&view=diff
==============================================================================
--- cfe/trunk/test/Driver/darwin-debug-flags.c (original)
+++ cfe/trunk/test/Driver/darwin-debug-flags.c Mon Jul 19 12:11:36 2010
@@ -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;
Added: cfe/trunk/test/Driver/darwin-xarch.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/darwin-xarch.c?rev=108712&view=auto
==============================================================================
--- cfe/trunk/test/Driver/darwin-xarch.c (added)
+++ cfe/trunk/test/Driver/darwin-xarch.c Mon Jul 19 12:11:36 2010
@@ -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"
More information about the cfe-commits
mailing list