summaryrefslogtreecommitdiffstats
path: root/clang/lib/Driver
diff options
context:
space:
mode:
authorChandler Carruth <chandlerc@gmail.com>2012-01-24 10:21:46 +0000
committerChandler Carruth <chandlerc@gmail.com>2012-01-24 10:21:46 +0000
commit4d73703ffda9ababae72263606c5db97e1a7d9e3 (patch)
tree9f3e6f47edaf53520fd356cb2e7ba66638da3893 /clang/lib/Driver
parentdf1666e4e6bf1034231317327da6743aacd15999 (diff)
downloadbcm5719-llvm-4d73703ffda9ababae72263606c5db97e1a7d9e3.tar.gz
bcm5719-llvm-4d73703ffda9ababae72263606c5db97e1a7d9e3.zip
Hoist the targeted triple object into an actual object in the Driver.
The Driver has a fixed target, whether we like it or not, the DefaultTargetTriple is not a default. This at least makes things more honest. I'll eventually get rid of most (if not all) of DefaultTargetTriple with this proper triple object. Bit of a WIP. llvm-svn: 148796
Diffstat (limited to 'clang/lib/Driver')
-rw-r--r--clang/lib/Driver/Driver.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Driver/Driver.cpp b/clang/lib/Driver/Driver.cpp
index 8699a92228b..1edea613609 100644
--- a/clang/lib/Driver/Driver.cpp
+++ b/clang/lib/Driver/Driver.cpp
@@ -57,6 +57,7 @@ Driver::Driver(StringRef ClangExecutable,
DefaultImageName(DefaultImageName),
DriverTitle("clang \"gcc-compatible\" driver"),
Host(0),
+ TargetTriple(llvm::Triple::normalize(DefaultTargetTriple)),
CCPrintOptionsFilename(0), CCPrintHeadersFilename(0),
CCLogDiagnosticsFilename(0), CCCIsCXX(false),
CCCIsCPP(false),CCCEcho(false), CCCPrintBindings(false),
@@ -321,7 +322,11 @@ Compilation *Driver::BuildCompilation(ArrayRef<const char *> ArgList) {
if (Args->hasArg(options::OPT_nostdlib))
UseStdLib = false;
- Host = GetHostInfo(DefaultTargetTriple.c_str());
+ // Reset the target triple here as we may have adjusted the
+ // DefaultTargetTriple string for flags above.
+ // FIXME: Same fix is needed here when the above flag management is fixed.
+ TargetTriple = llvm::Triple(llvm::Triple::normalize(DefaultTargetTriple));
+ Host = GetHostInfo(TargetTriple);
// Perform the default argument translations.
DerivedArgList *TranslatedArgs = TranslateInputArgs(*Args);
@@ -1571,9 +1576,8 @@ std::string Driver::GetTemporaryPath(StringRef Prefix, const char *Suffix)
return P.str();
}
-const HostInfo *Driver::GetHostInfo(const char *TripleStr) const {
+const HostInfo *Driver::GetHostInfo(const llvm::Triple &Triple) const {
llvm::PrettyStackTraceString CrashInfo("Constructing host");
- llvm::Triple Triple(llvm::Triple::normalize(TripleStr).c_str());
// TCE is an osless target
if (Triple.getArchName() == "tce")
OpenPOWER on IntegriCloud