[cfe-commits] r68119 - in /cfe/trunk: lib/Driver/Tools.cpp test/Driver/clang-translation.c tools/clang-cc/clang.cpp tools/driver/driver.cpp
Daniel Dunbar
daniel at zuster.org
Tue Mar 31 10:35:15 PDT 2009
Author: ddunbar
Date: Tue Mar 31 12:35:15 2009
New Revision: 68119
URL: http://llvm.org/viewvc/llvm-project?rev=68119&view=rev
Log:
(LLVM up) Update to use llvm::sys::getHostTriple().
- Always pass -triple to clang-cc (-arch will be removed).
- clang-cc doesn't play guess work with the target triple anymore.
Modified:
cfe/trunk/lib/Driver/Tools.cpp
cfe/trunk/test/Driver/clang-translation.c
cfe/trunk/tools/clang-cc/clang.cpp
cfe/trunk/tools/driver/driver.cpp
Modified: cfe/trunk/lib/Driver/Tools.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Tools.cpp?rev=68119&r1=68118&r2=68119&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Tools.cpp (original)
+++ cfe/trunk/lib/Driver/Tools.cpp Tue Mar 31 12:35:15 2009
@@ -39,6 +39,11 @@
const char *LinkingOutput) const {
ArgStringList CmdArgs;
+ CmdArgs.push_back("-triple");
+ const char *TripleStr =
+ Args.MakeArgString(getToolChain().getTripleString().c_str());
+ CmdArgs.push_back(TripleStr);
+
if (isa<AnalyzeJobAction>(JA)) {
assert(JA.getType() == types::TY_Plist && "Invalid output type.");
CmdArgs.push_back("-analyze");
@@ -371,11 +376,6 @@
Args.AddAllArgValues(CmdArgs, options::OPT_Xclang);
- // FIXME: Always pass the full triple once we aren't concerned with
- // ccc compat.
- CmdArgs.push_back("-arch");
- CmdArgs.push_back(getToolChain().getArchName().c_str());
-
if (Output.getType() == types::TY_Dependencies) {
// Handled with other dependency code.
} else if (Output.isPipe()) {
Modified: cfe/trunk/test/Driver/clang-translation.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/clang-translation.c?rev=68119&r1=68118&r2=68119&view=diff
==============================================================================
--- cfe/trunk/test/Driver/clang-translation.c (original)
+++ cfe/trunk/test/Driver/clang-translation.c Tue Mar 31 12:35:15 2009
@@ -1,4 +1,5 @@
// RUN: clang -ccc-host-triple i386-unknown-unknown -### -S -O0 -Os %s -o %t.s -fverbose-asm 2> %t.log
+// RUN: grep '"-triple" "i386-unknown-unknown"' %t.log &&
// RUN: grep '"-S"' %t.log &&
// RUN: grep '"-disable-free"' %t.log &&
// RUN: grep '"--relocation-model" "static"' %t.log &&
@@ -6,7 +7,6 @@
// RUN: grep '"--unwind-tables=0"' %t.log &&
// RUN: grep '"--fmath-errno=1"' %t.log &&
// RUN: grep '"-Os"' %t.log &&
-// RUN: grep '"-arch" "i386"' %t.log &&
// RUN: grep '"-o" .*clang-translation\.c\.out\.tmp\.s' %t.log &&
// RUN: grep '"--asm-verbose"' %t.log &&
// RUN: true
Modified: cfe/trunk/tools/clang-cc/clang.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-cc/clang.cpp?rev=68119&r1=68118&r2=68119&view=diff
==============================================================================
--- cfe/trunk/tools/clang-cc/clang.cpp (original)
+++ cfe/trunk/tools/clang-cc/clang.cpp Tue Mar 31 12:35:15 2009
@@ -764,7 +764,7 @@
if (MacOSVersionMinIsInvalid) {
fprintf(stderr,
- "-mmacosx-version-min=%s is invalid, expected something like '10.4'.\n",
+ "-mmacosx-version-min=%s is invalid, expected something like '10.4'.\n",
MacOSVersionMin.c_str());
exit(1);
}
@@ -776,25 +776,8 @@
// Initialize base triple. If a -triple option has been specified, use
// that triple. Otherwise, default to the host triple.
std::string Triple = TargetTriple;
- if (Triple.empty()) {
- Triple = LLVM_HOSTTRIPLE;
-
- // Force i<N>86 to i386 when using LLVM_HOSTTRIPLE.
- if (Triple[0] == 'i' && isdigit(Triple[1]) &&
- Triple[2] == '8' && Triple[3] == '6')
- Triple[1] = '3';
-
- // On darwin, we want to update the version to match that of the
- // host.
- std::string::size_type DarwinDashIdx = Triple.find("-darwin");
- if (DarwinDashIdx != std::string::npos) {
- Triple.resize(DarwinDashIdx + strlen("-darwin"));
-
- // Only add the major part of the os version.
- std::string Version = llvm::sys::getOSVersion();
- Triple += Version.substr(0, Version.find('.'));
- }
- }
+ if (Triple.empty())
+ Triple = llvm::sys::getHostTriple();
// If -arch foo was specified, remove the architecture from the triple we have
// so far and replace it with the specified one.
Modified: cfe/trunk/tools/driver/driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/driver/driver.cpp?rev=68119&r1=68118&r2=68119&view=diff
==============================================================================
--- cfe/trunk/tools/driver/driver.cpp (original)
+++ cfe/trunk/tools/driver/driver.cpp Tue Mar 31 12:35:15 2009
@@ -23,6 +23,7 @@
#include "llvm/Support/ManagedStatic.h"
#include "llvm/Support/PrettyStackTrace.h"
#include "llvm/Support/raw_ostream.h"
+#include "llvm/System/Host.h"
#include "llvm/System/Path.h"
#include "llvm/System/Signals.h"
using namespace clang;
@@ -77,13 +78,10 @@
Diagnostic Diags(DiagClient.get());
- // FIXME: Use the triple of the host, not the triple that we were
- // compiled on.
- llvm::OwningPtr<Driver> TheDriver(new Driver(Path.getBasename().c_str(),
- Path.getDirname().c_str(),
- LLVM_HOSTTRIPLE,
- "a.out",
- Diags));
+ llvm::OwningPtr<Driver>
+ TheDriver(new Driver(Path.getBasename().c_str(), Path.getDirname().c_str(),
+ llvm::sys::getHostTriple().c_str(),
+ "a.out", Diags));
llvm::OwningPtr<Compilation> C(TheDriver->BuildCompilation(argc, argv));
More information about the cfe-commits
mailing list