Set ABI and DescriptionString first to reduce OS specific logic.
authorJoerg Sonnenberger <joerg@bec.de>
Wed, 15 Oct 2014 19:47:15 +0000 (19:47 +0000)
committerJoerg Sonnenberger <joerg@bec.de>
Wed, 15 Oct 2014 19:47:15 +0000 (19:47 +0000)
Use switch for FreeBSD check to allow easier extension.

llvm-svn: 219838

clang/lib/Basic/Targets.cpp

index 0ca45c9..d6c6d5b 100644 (file)
@@ -1288,18 +1288,21 @@ public:
     IntMaxType = SignedLong;
     Int64Type = SignedLong;
 
-    if (getTriple().getOS() == llvm::Triple::FreeBSD) {
+    if ((Triple.getArch() == llvm::Triple::ppc64le)) {
+      DescriptionString = "e-m:e-i64:64-n32:64";
+      ABI = "elfv2";
+    } else {
+      DescriptionString = "E-m:e-i64:64-n32:64";
+      ABI = "elfv1";
+    }
+
+    switch (getTriple().getOS()) {
+    case llvm::Triple::FreeBSD:
       LongDoubleWidth = LongDoubleAlign = 64;
       LongDoubleFormat = &llvm::APFloat::IEEEdouble;
-      DescriptionString = "E-m:e-i64:64-n32:64";
-    } else {
-      if ((Triple.getArch() == llvm::Triple::ppc64le)) {
-        DescriptionString = "e-m:e-i64:64-n32:64";
-        ABI = "elfv2";
-      } else {
-        DescriptionString = "E-m:e-i64:64-n32:64";
-        ABI = "elfv1";
-      }
+      break;
+    default:
+      break;
     }
 
     // PPC64 supports atomics up to 8 bytes.