[PATCH] Canonicalise Windows target triple spellings

Reid Kleckner rnk at google.com
Wed Mar 26 11:27:05 PDT 2014


  lgtm

  re: cygnus, I guess we could spell it i686--windows-cygwin, but that'd make parsing a little ambiguous.  We will always accept i686--cygwin, which is what users will probably keep writing anyway.

  Internally, we can't name the environment enum Cygwin until we remove the Cygwin from the OS enum.


================
Comment at: lib/Target/X86/X86Subtarget.h:346-360
@@ -345,5 +345,17 @@
   bool isTargetNaCl64() const { return isTargetNaCl() && is64Bit(); }
-  bool isTargetWindows() const { return TargetTriple.getOS() == Triple::Win32; }
-  bool isTargetMingw() const { return TargetTriple.getOS() == Triple::MinGW32; }
-  bool isTargetCygwin() const { return TargetTriple.getOS() == Triple::Cygwin; }
+  bool isTargetWindows() const {
+    return TargetTriple.getOS() == Triple::Win32 &&
+           TargetTriple.getEnvironment() != Triple::GNU;
+  }
+  bool isTargetMingw() const {
+    return TargetTriple.getOS() == Triple::MinGW32 ||
+           (TargetTriple.getOS() == Triple::Win32 &&
+            (TargetTriple.getEnvironment() == Triple::Cygnus ||
+             TargetTriple.getEnvironment() == Triple::GNU));
+  }
+  bool isTargetCygwin() const {
+    return TargetTriple.getOS() == Triple::Cygwin ||
+           (TargetTriple.getOS() == Triple::Win32 &&
+            TargetTriple.getEnvironment() == Triple::Cygnus);
+  }
   bool isTargetCygMing() const { return TargetTriple.isOSCygMing(); }
----------------
I'd make these Triple methods, but try to make the naming consistent with the other Triple methods, and then use that in various places.


http://llvm-reviews.chandlerc.com/D2947



More information about the llvm-commits mailing list