From: Duncan Sands Date: Mon, 30 Aug 2010 09:42:39 +0000 (+0000) Subject: Straighten out target triples provided on the command line X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2dc14532b641bae011a374e2c6c393d2196c1411;p=clang Straighten out target triples provided on the command line before using them. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@112468 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Frontend/CompilerInvocation.cpp b/lib/Frontend/CompilerInvocation.cpp index 68e2d846c5..c4ecf61ce2 100644 --- a/lib/Frontend/CompilerInvocation.cpp +++ b/lib/Frontend/CompilerInvocation.cpp @@ -23,6 +23,7 @@ #include "llvm/ADT/SmallVector.h" #include "llvm/ADT/StringExtras.h" #include "llvm/ADT/StringSwitch.h" +#include "llvm/ADT/Triple.h" #include "llvm/Support/ErrorHandling.h" #include "llvm/System/Host.h" #include "llvm/System/Path.h" @@ -1472,7 +1473,7 @@ static void ParseTargetArgs(TargetOptions &Opts, ArgList &Args) { Opts.CPU = Args.getLastArgValue(OPT_target_cpu); Opts.Features = Args.getAllArgValues(OPT_target_feature); Opts.LinkerVersion = Args.getLastArgValue(OPT_target_linker_version); - Opts.Triple = Args.getLastArgValue(OPT_triple); + Opts.Triple = llvm::Triple::normalize(Args.getLastArgValue(OPT_triple)); // Use the host triple if unspecified. if (Opts.Triple.empty()) diff --git a/tools/driver/cc1as_main.cpp b/tools/driver/cc1as_main.cpp index b8f2b68788..5bce70cb2a 100644 --- a/tools/driver/cc1as_main.cpp +++ b/tools/driver/cc1as_main.cpp @@ -24,6 +24,7 @@ #include "clang/Frontend/TextDiagnosticPrinter.h" #include "llvm/ADT/OwningPtr.h" #include "llvm/ADT/StringSwitch.h" +#include "llvm/ADT/Triple.h" #include "llvm/MC/MCParser/MCAsmParser.h" #include "llvm/MC/MCAsmInfo.h" #include "llvm/MC/MCCodeEmitter.h" @@ -142,7 +143,7 @@ void AssemblerInvocation::CreateFromArgs(AssemblerInvocation &Opts, // Construct the invocation. // Target Options - Opts.Triple = Args->getLastArgValue(OPT_triple); + Opts.Triple = Triple::normalize(Args->getLastArgValue(OPT_triple)); if (Opts.Triple.empty()) // Use the host triple if unspecified. Opts.Triple = sys::getHostTriple();