]> granicus.if.org Git - llvm/commitdiff
[Support] Simplify triple check in Host CPU test. NFC.
authorAhmed Bougacha <ahmed.bougacha@gmail.com>
Sat, 4 Feb 2017 00:46:59 +0000 (00:46 +0000)
committerAhmed Bougacha <ahmed.bougacha@gmail.com>
Sat, 4 Feb 2017 00:46:59 +0000 (00:46 +0000)
Cleanup the check added in r293990 using the Triple helpers.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@294073 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/Support/Host.cpp

index fdeed87812870a951ea8a171c9192447f32143c7..10f883e6d2cecd5ac99f746f2e10585b165cf99a 100644 (file)
@@ -17,26 +17,17 @@ using namespace llvm;
 
 class HostTest : public testing::Test {
   Triple Host;
-  SmallVector<std::pair<Triple::ArchType, Triple::OSType>, 4> SupportedArchAndOSs;
 
 protected:
   bool isSupportedArchAndOS() {
-    if (is_contained(SupportedArchAndOSs, std::make_pair(Host.getArch(), Host.getOS())))
-      return true;
-
-    return false;
-  }
-
-  HostTest() {
-    Host.setTriple(Triple::normalize(sys::getProcessTriple()));
-
     // Initially this is only testing detection of the number of
     // physical cores, which is currently only supported/tested for
     // x86_64 Linux and Darwin.
-    SupportedArchAndOSs.push_back(std::make_pair(Triple::x86_64, Triple::Linux));
-    SupportedArchAndOSs.push_back(std::make_pair(Triple::x86_64, Triple::Darwin));
-    SupportedArchAndOSs.push_back(std::make_pair(Triple::x86_64, Triple::MacOSX));
+    return (Host.getArch() == Triple::x86_64 &&
+            (Host.isOSDarwin() || Host.getOS() == Triple::Linux));
   }
+
+  HostTest() : Host(Triple::normalize(sys::getProcessTriple())) {}
 };
 
 TEST_F(HostTest, NumPhysicalCores) {