summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorReid Kleckner <reid@kleckner.net>2015-02-13 22:05:50 +0000
committerReid Kleckner <reid@kleckner.net>2015-02-13 22:05:50 +0000
commit5fe405df36c30aedf2acd0a713bc851c0189d97a (patch)
tree8bebadef5893e7029f9e9070980bf18095e3cfc5 /llvm/lib
parent98c22539f2f4b96857be65a5a2797e4707451f2e (diff)
downloadbcm5719-llvm-5fe405df36c30aedf2acd0a713bc851c0189d97a.tar.gz
bcm5719-llvm-5fe405df36c30aedf2acd0a713bc851c0189d97a.zip
Triple: Make setEnvironment not override the object format
Discovered by Halide users who had C++ code like this: Triple.setArch(Triple::x86); Triple.setOS(Triple::Windows); Triple.setObjectFormat(Triple::ELF); Triple.setEnvironment(Triple::MSVC); This would produce the stringified triple of x86-windows-msvc, instead of the x86-windows-msvc-elf string needed to run MCJIT. With this change, they retain the -elf suffix. llvm-svn: 229160
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Support/Triple.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp
index 9627f8f2f9a..e74b23ca0ca 100644
--- a/llvm/lib/Support/Triple.cpp
+++ b/llvm/lib/Support/Triple.cpp
@@ -816,7 +816,11 @@ void Triple::setOS(OSType Kind) {
}
void Triple::setEnvironment(EnvironmentType Kind) {
- setEnvironmentName(getEnvironmentTypeName(Kind));
+ if (ObjectFormat == getDefaultFormat(*this))
+ return setEnvironmentName(getEnvironmentTypeName(Kind));
+
+ setEnvironmentName((getEnvironmentTypeName(Kind) + Twine("-") +
+ getObjectFormatTypeName(ObjectFormat)).str());
}
void Triple::setObjectFormat(ObjectFormatType Kind) {
OpenPOWER on IntegriCloud