[cfe-commits] r148796 - in /cfe/trunk: include/clang/Driver/Driver.h lib/Driver/Driver.cpp
Chandler Carruth
chandlerc at gmail.com
Tue Jan 24 02:21:47 PST 2012
Author: chandlerc
Date: Tue Jan 24 04:21:46 2012
New Revision: 148796
URL: http://llvm.org/viewvc/llvm-project?rev=148796&view=rev
Log:
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.
Modified:
cfe/trunk/include/clang/Driver/Driver.h
cfe/trunk/lib/Driver/Driver.cpp
Modified: cfe/trunk/include/clang/Driver/Driver.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Driver/Driver.h?rev=148796&r1=148795&r2=148796&view=diff
==============================================================================
--- cfe/trunk/include/clang/Driver/Driver.h (original)
+++ cfe/trunk/include/clang/Driver/Driver.h Tue Jan 24 04:21:46 2012
@@ -102,6 +102,11 @@
/// Information about the host which can be overridden by the user.
std::string HostBits, HostMachine, HostSystem, HostRelease;
+ /// \brief Target triple.
+ /// Represents which platforms this driver will target at each stage of the
+ /// compilation.
+ llvm::Triple TargetTriple;
+
/// The file to log CC_PRINT_OPTIONS output to, if enabled.
const char *CCPrintOptionsFilename;
@@ -381,7 +386,7 @@
/// GetHostInfo - Construct a new host info object for the given
/// host triple.
- const HostInfo *GetHostInfo(const char *HostTriple) const;
+ const HostInfo *GetHostInfo(const llvm::Triple &Triple) const;
/// ShouldUseClangCompilar - Should the clang compiler be used to
/// handle this action.
Modified: cfe/trunk/lib/Driver/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/Driver.cpp?rev=148796&r1=148795&r2=148796&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/Driver.cpp (original)
+++ cfe/trunk/lib/Driver/Driver.cpp Tue Jan 24 04:21:46 2012
@@ -57,6 +57,7 @@
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 @@
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 @@
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")
More information about the cfe-commits
mailing list