r239388 - [Driver] Preserve the object file format in ComputeEffectiveClangTriple
David Majnemer
david.majnemer at gmail.com
Mon Jun 8 23:30:01 PDT 2015
Author: majnemer
Date: Tue Jun 9 01:30:01 2015
New Revision: 239388
URL: http://llvm.org/viewvc/llvm-project?rev=239388&view=rev
Log:
[Driver] Preserve the object file format in ComputeEffectiveClangTriple
The object file format is sometimes overridden for MSVC targets to use
ELF instead of COFF. Make sure we preserve this choice when setting the
msvc version number in the triple.
Modified:
cfe/trunk/lib/Driver/MSVCToolChain.cpp
cfe/trunk/test/Driver/msvc-triple.c
Modified: cfe/trunk/lib/Driver/MSVCToolChain.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/MSVCToolChain.cpp?rev=239388&r1=239387&r2=239388&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/MSVCToolChain.cpp (original)
+++ cfe/trunk/lib/Driver/MSVCToolChain.cpp Tue Jun 9 01:30:01 2015
@@ -512,7 +512,13 @@ MSVCToolChain::ComputeEffectiveClangTrip
MSVT = VersionTuple(MSVT.getMajor(), MSVT.getMinor().getValueOr(0),
MSVT.getSubminor().getValueOr(0));
- if (Triple.getEnvironment() == llvm::Triple::MSVC)
- Triple.setEnvironmentName((Twine("msvc") + MSVT.getAsString()).str());
+ if (Triple.getEnvironment() == llvm::Triple::MSVC) {
+ StringRef ObjFmt = Triple.getEnvironmentName().split('-').second;
+ if (ObjFmt.empty())
+ Triple.setEnvironmentName((Twine("msvc") + MSVT.getAsString()).str());
+ else
+ Triple.setEnvironmentName(
+ (Twine("msvc") + MSVT.getAsString() + Twine('-') + ObjFmt).str());
+ }
return Triple.getTriple();
}
Modified: cfe/trunk/test/Driver/msvc-triple.c
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Driver/msvc-triple.c?rev=239388&r1=239387&r2=239388&view=diff
==============================================================================
--- cfe/trunk/test/Driver/msvc-triple.c (original)
+++ cfe/trunk/test/Driver/msvc-triple.c Tue Jun 9 01:30:01 2015
@@ -1,7 +1,9 @@
// RUN: %clang -target i686-pc-windows-msvc -S -emit-llvm %s -o - | FileCheck %s --check-prefix=DEFAULT
// RUN: %clang -target i686-pc-windows-msvc19 -S -emit-llvm %s -o - | FileCheck %s --check-prefix=TARGET-19
// RUN: %clang -target i686-pc-windows-msvc -S -emit-llvm %s -o - -fms-compatibility-version=19 | FileCheck %s --check-prefix=OVERRIDE-19
+// RUN: %clang -target i686-pc-windows-msvc-elf -S -emit-llvm %s -o - | FileCheck %s --check-prefix=ELF-DEFAULT
// DEFAULT: target triple = "i686-pc-windows-msvc18.0.0"
// TARGET-19: target triple = "i686-pc-windows-msvc19.0.0"
// OVERRIDE-19: target triple = "i686-pc-windows-msvc19.0.0"
+// ELF-DEFAULT: target triple = "i686-pc-windows-msvc18.0.0-elf"
More information about the cfe-commits
mailing list