[cfe-commits] r67106 - in /cfe/trunk: lib/Driver/Driver.cpp test/Driver/phases.c

Daniel Dunbar daniel at zuster.org
Tue Mar 17 14:29:52 PDT 2009


Author: ddunbar
Date: Tue Mar 17 16:29:52 2009
New Revision: 67106

URL: http://llvm.org/viewvc/llvm-project?rev=67106&view=rev
Log:
Driver: Make sure to get the default arch name from the tool chain, not the 
host; the toolchain may differ based on command line arguments.

Modified:
    cfe/trunk/lib/Driver/Driver.cpp
    cfe/trunk/test/Driver/phases.c

Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=67106&r1=67105&r2=67106&view=diff

==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Mar 17 16:29:52 2009
@@ -155,6 +155,8 @@
   ArgList *Args = ParseArgStrings(Start, End);
 
   Host = GetHostInfo(HostTriple);
+  // FIXME: This shouldn't live inside Driver, the default tool chain
+  // is part of the compilation (it is arg dependent).
   DefaultToolChain = Host->getToolChain(*Args);
 
   // FIXME: This behavior shouldn't be here.
@@ -306,7 +308,7 @@
   // When there is no explicit arch for this platform, get one from
   // the host so that -Xarch_ is handled correctly.
   if (!Archs.size()) {
-    const char *Arch = Host->getArchName().c_str();
+    const char *Arch = DefaultToolChain->getArchName().c_str();
     Archs.push_back(Arch);
   }
 

Modified: cfe/trunk/test/Driver/phases.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/phases.c?rev=67106&r1=67105&r2=67106&view=diff

==============================================================================
--- cfe/trunk/test/Driver/phases.c (original)
+++ cfe/trunk/test/Driver/phases.c Tue Mar 17 16:29:52 2009
@@ -44,4 +44,14 @@
 // RUN: grep -F '5: bind-arch, "i386", {3}, object' %t &&
 // RUN: grep -F '6: lipo, {4, 5}, object' %t &&
 
+// Arch defaulting
+// RUN: clang-driver -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x assembler %s &> %t &&
+// RUN: grep -F '2: bind-arch, "i386", {1}, object' %t &&
+// RUN: clang-driver -ccc-host-triple i386-apple-darwin9 -ccc-print-phases -c -x assembler %s -m32 -m64 &> %t &&
+// RUN: grep -F '2: bind-arch, "x86_64", {1}, object' %t &&
+// RUN: clang-driver -ccc-host-triple x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s &> %t &&
+// RUN: grep -F '2: bind-arch, "x86_64", {1}, object' %t &&
+// RUN: clang-driver -ccc-host-triple x86_64-apple-darwin9 -ccc-print-phases -c -x assembler %s -m64 -m32 &> %t &&
+// RUN: grep -F '2: bind-arch, "i386", {1}, object' %t &&
+
 // RUN: true





More information about the cfe-commits mailing list