diff options
author | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-03-31 16:34:41 +0000 |
---|---|---|
committer | Saleem Abdulrasool <compnerd@compnerd.org> | 2014-03-31 16:34:41 +0000 |
commit | bd5fac585ed0789655a4133f41e12654c99766b9 (patch) | |
tree | 0af5aa1850c186ff7126d3a6cca94f7ac40beeec /lib/Support | |
parent | 93f807bd058a6dd287fc04142f33a28e4cff1b88 (diff) | |
download | llvm-bd5fac585ed0789655a4133f41e12654c99766b9.tar.gz llvm-bd5fac585ed0789655a4133f41e12654c99766b9.tar.bz2 llvm-bd5fac585ed0789655a4133f41e12654c99766b9.tar.xz |
Support: generalise object type handling for Windows
This generalises the object file type parsing to all Windows environments. This
is used by cygwin as well as MSVC environments for MCJIT. This also makes the
triple more similar to Chandler's suggestion of a separate field for the object
file format.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@205219 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Support')
-rw-r--r-- | lib/Support/Triple.cpp | 22 |
1 files changed, 15 insertions, 7 deletions
diff --git a/lib/Support/Triple.cpp b/lib/Support/Triple.cpp index 1dc279a0db..71abb9d165 100644 --- a/lib/Support/Triple.cpp +++ b/lib/Support/Triple.cpp @@ -547,24 +547,27 @@ std::string Triple::normalize(StringRef Str) { Components.resize(4); Components[2] = "windows"; if (Environment == UnknownEnvironment) { - if (ObjectFormat == UnknownObjectFormat) + if (ObjectFormat == UnknownObjectFormat || ObjectFormat == Triple::COFF) 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"; - Components[3] = (ObjectFormat == Triple::ELF) ? "gnuelf" : "gnu"; + Components[3] = "gnu"; } else if (OS == Triple::Cygwin) { Components.resize(4); Components[2] = "windows"; Components[3] = "cygnus"; } + if (OS == Triple::MinGW32 || OS == Triple::Cygwin || + (OS == Triple::Win32 && Environment != UnknownEnvironment)) { + if (ObjectFormat != UnknownObjectFormat && ObjectFormat != Triple::COFF) { + Components.resize(5); + Components[4] = getObjectFormatTypeName(ObjectFormat); + } + } // Stick the corrected components back together to form the normalized string. std::string Normalized; @@ -726,7 +729,12 @@ void Triple::setEnvironment(EnvironmentType Kind) { } void Triple::setObjectFormat(ObjectFormatType Kind) { - setEnvironmentName(getObjectFormatTypeName(Kind)); + if (Environment == UnknownEnvironment) + return setEnvironmentName(getObjectFormatTypeName(Kind)); + + Twine Env = getEnvironmentTypeName(Environment) + Twine("-") + + getObjectFormatTypeName(Kind); + setEnvironmentName(Env.str()); } void Triple::setArchName(StringRef Str) { |