diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-03-30 07:19:31 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-03-30 07:19:31 +0000 |
commit | f80b49b5d2ca5a7338c19a02a357dd1824d89740 (patch) | |
tree | cff3a0a9ccf9f31d1e872fdd20b84f11a5ba46a8 /llvm/lib/Support/Triple.cpp | |
parent | ee4f4025c3e770d6b5f0cbca5b92f43d88056323 (diff) | |
download | llvm-f80b49b5d2ca5a7338c19a02a357dd1824d89740.zip llvm-f80b49b5d2ca5a7338c19a02a357dd1824d89740.tar.gz llvm-f80b49b5d2ca5a7338c19a02a357dd1824d89740.tar.bz2 |
Support: correct Windows normalisation
If the environment is unknown and no object file is provided, then assume an
"MSVC" environment, otherwise, set the environment to the object file format.
In the case that we have a known environment but a non-native file format for
Windows (COFF) which is used for MCJIT, then append the custom file format to
the triple as an additional component.
This fixes the MCJIT tests on Windows.
llvm-svn: 205130
Diffstat (limited to 'llvm/lib/Support/Triple.cpp')
-rw-r--r-- | llvm/lib/Support/Triple.cpp | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp index d6408c5..9e91642 100644 --- a/llvm/lib/Support/Triple.cpp +++ b/llvm/lib/Support/Triple.cpp @@ -434,6 +434,8 @@ std::string Triple::normalize(StringRef Str) { if (Components.size() > 3) Environment = parseEnvironment(Components[3]); ObjectFormatType ObjectFormat = UnknownObjectFormat; + if (Components.size() > 4) + ObjectFormat = parseFormat(Components[4]); // Note which components are already in their final position. These will not // be moved. @@ -544,8 +546,16 @@ std::string Triple::normalize(StringRef Str) { if (OS == Triple::Win32) { Components.resize(4); Components[2] = "windows"; - if (Environment == UnknownEnvironment && ObjectFormat == UnknownObjectFormat) - Components[3] = "msvc"; + if (Environment == UnknownEnvironment) { + if (ObjectFormat == UnknownObjectFormat) + Components[3] = "msvc"; + else + Components[3] = getObjectFormatTypeName(ObjectFormat); + } else if (ObjectFormat != UnknownObjectFormat && + ObjectFormat != Triple::COFF) { + Components.resize(5); + Components[4] = getObjectFormatTypeName(ObjectFormat); + } } else if (OS == Triple::MinGW32) { Components.resize(4); Components[2] = "windows"; |