[PATCH] Exhaustively test all permutations of triple parts in TripleTest.

Douglas Katzman dougk at google.com
Thu Apr 30 11:39:39 PDT 2015


use the 'Last<mumble>' idiom instead of a separate Max constant.


http://reviews.llvm.org/D9057

Files:
  include/llvm/ADT/Triple.h
  unittests/ADT/TripleTest.cpp

Index: include/llvm/ADT/Triple.h
===================================================================
--- include/llvm/ADT/Triple.h
+++ include/llvm/ADT/Triple.h
@@ -81,7 +81,8 @@
     hsail64,    // AMD HSAIL with 64-bit pointers
     spir,       // SPIR: standard portable IR for OpenCL 32-bit version
     spir64,     // SPIR: standard portable IR for OpenCL 64-bit version
-    kalimba     // Kalimba: generic kalimba
+    kalimba,    // Kalimba: generic kalimba
+    LastArchType = kalimba
   };
   enum SubArchType {
     NoSubArch,
@@ -117,7 +118,8 @@
     ImaginationTechnologies,
     MipsTechnologies,
     NVIDIA,
-    CSR
+    CSR,
+    LastVendorType = CSR
   };
   enum OSType {
     UnknownOS,
@@ -145,7 +147,8 @@
     CUDA,       // NVIDIA CUDA
     NVCL,       // NVIDIA OpenCL
     AMDHSA,     // AMD HSA Runtime
-    PS4
+    PS4,
+    LastOSType = PS4
   };
   enum EnvironmentType {
     UnknownEnvironment,
@@ -162,6 +165,7 @@
     MSVC,
     Itanium,
     Cygnus,
+    LastEnvironmentType = Cygnus
   };
   enum ObjectFormatType {
     UnknownObjectFormat,
Index: unittests/ADT/TripleTest.cpp
===================================================================
--- unittests/ADT/TripleTest.cpp
+++ unittests/ADT/TripleTest.cpp
@@ -220,12 +220,12 @@
   // Check that normalizing a permutated set of valid components returns a
   // triple with the unpermuted components.
   StringRef C[4];
-  for (int Arch = 1+Triple::UnknownArch; Arch <= Triple::amdil; ++Arch) {
+  for (int Arch = 1+Triple::UnknownArch; Arch <= Triple::LastArchType; ++Arch) {
     C[0] = Triple::getArchTypeName(Triple::ArchType(Arch));
-    for (int Vendor = 1+Triple::UnknownVendor; Vendor <= Triple::PC;
+    for (int Vendor = 1+Triple::UnknownVendor; Vendor <= Triple::LastVendorType;
          ++Vendor) {
       C[1] = Triple::getVendorTypeName(Triple::VendorType(Vendor));
-      for (int OS = 1+Triple::UnknownOS; OS <= Triple::Minix; ++OS) {
+      for (int OS = 1+Triple::UnknownOS; OS <= Triple::LastOSType; ++OS) {
         if (OS == Triple::Win32)
           continue;
 
@@ -240,7 +240,7 @@
         EXPECT_EQ(E, Triple::normalize(Join(C[2], C[0], C[1])));
         EXPECT_EQ(E, Triple::normalize(Join(C[2], C[1], C[0])));
 
-        for (int Env = 1 + Triple::UnknownEnvironment; Env <= Triple::Android;
+        for (int Env = 1 + Triple::UnknownEnvironment; Env <= Triple::LastEnvironmentType;
              ++Env) {
           C[3] = Triple::getEnvironmentTypeName(Triple::EnvironmentType(Env));

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D9057.24756.patch
Type: text/x-patch
Size: 2507 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20150430/cb665038/attachment.bin>


More information about the llvm-commits mailing list