diff options
Diffstat (limited to 'llvm')
| -rw-r--r-- | llvm/include/llvm/ADT/Triple.h | 3 | ||||
| -rw-r--r-- | llvm/lib/Support/Triple.cpp | 2 | ||||
| -rw-r--r-- | llvm/unittests/ADT/TripleTest.cpp | 6 |
3 files changed, 10 insertions, 1 deletions
diff --git a/llvm/include/llvm/ADT/Triple.h b/llvm/include/llvm/ADT/Triple.h index b98f8407d07..6173cd2bd91 100644 --- a/llvm/include/llvm/ADT/Triple.h +++ b/llvm/include/llvm/ADT/Triple.h @@ -191,7 +191,8 @@ public: Cygnus, AMDOpenCL, CoreCLR, - LastEnvironmentType = CoreCLR + OpenCL, + LastEnvironmentType = OpenCL }; enum ObjectFormatType { UnknownObjectFormat, diff --git a/llvm/lib/Support/Triple.cpp b/llvm/lib/Support/Triple.cpp index 2bac2a31067..179e9d2790f 100644 --- a/llvm/lib/Support/Triple.cpp +++ b/llvm/lib/Support/Triple.cpp @@ -217,6 +217,7 @@ const char *Triple::getEnvironmentTypeName(EnvironmentType Kind) { case Cygnus: return "cygnus"; case AMDOpenCL: return "amdopencl"; case CoreCLR: return "coreclr"; + case OpenCL: return "opencl"; } llvm_unreachable("Invalid EnvironmentType!"); @@ -484,6 +485,7 @@ static Triple::EnvironmentType parseEnvironment(StringRef EnvironmentName) { .StartsWith("cygnus", Triple::Cygnus) .StartsWith("amdopencl", Triple::AMDOpenCL) .StartsWith("coreclr", Triple::CoreCLR) + .StartsWith("opencl", Triple::OpenCL) .Default(Triple::UnknownEnvironment); } diff --git a/llvm/unittests/ADT/TripleTest.cpp b/llvm/unittests/ADT/TripleTest.cpp index d6f3dfec406..8d0539a118c 100644 --- a/llvm/unittests/ADT/TripleTest.cpp +++ b/llvm/unittests/ADT/TripleTest.cpp @@ -248,6 +248,12 @@ TEST(TripleTest, ParsedIDs) { EXPECT_EQ(Triple::AMDHSA, T.getOS()); EXPECT_EQ(Triple::UnknownEnvironment, T.getEnvironment()); + T = Triple("amdgcn-amd-amdhsa-opencl"); + EXPECT_EQ(Triple::amdgcn, T.getArch()); + EXPECT_EQ(Triple::AMD, T.getVendor()); + EXPECT_EQ(Triple::AMDHSA, T.getOS()); + EXPECT_EQ(Triple::OpenCL, T.getEnvironment()); + T = Triple("huh"); EXPECT_EQ(Triple::UnknownArch, T.getArch()); } |

