r193423 - Just detect a distro as being fedora or not.

Rafael Espindola rafael.espindola at gmail.com
Fri Oct 25 11:09:41 PDT 2013


Author: rafael
Date: Fri Oct 25 13:09:41 2013
New Revision: 193423

URL: http://llvm.org/viewvc/llvm-project?rev=193423&view=rev
Log:
Just detect a distro as being fedora or not.

We don't have any checks that depend on the version of fedora, so we can
simplify.

Modified:
    cfe/trunk/lib/Driver/ToolChains.cpp

Modified: cfe/trunk/lib/Driver/ToolChains.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Driver/ToolChains.cpp?rev=193423&r1=193422&r2=193423&view=diff
==============================================================================
--- cfe/trunk/lib/Driver/ToolChains.cpp (original)
+++ cfe/trunk/lib/Driver/ToolChains.cpp Fri Oct 25 13:09:41 2013
@@ -2094,11 +2094,7 @@ enum Distro {
   RHEL4,
   RHEL5,
   RHEL6,
-  Fedora13,
-  Fedora14,
-  Fedora15,
-  Fedora16,
-  FedoraRawhide,
+  Fedora,
   OpenSUSE,
   UbuntuHardy,
   UbuntuIntrepid,
@@ -2116,8 +2112,7 @@ enum Distro {
 };
 
 static bool IsRedhat(enum Distro Distro) {
-  return (Distro >= Fedora13 && Distro <= FedoraRawhide) ||
-         (Distro >= RHEL4    && Distro <= RHEL6);
+  return Distro == Fedora || (Distro >= RHEL4 && Distro <= RHEL6);
 }
 
 static bool IsOpenSUSE(enum Distro Distro) {
@@ -2160,17 +2155,8 @@ static Distro DetectDistro(llvm::Triple:
 
   if (!llvm::MemoryBuffer::getFile("/etc/redhat-release", File)) {
     StringRef Data = File.get()->getBuffer();
-    if (Data.startswith("Fedora release 16"))
-      return Fedora16;
-    else if (Data.startswith("Fedora release 15"))
-      return Fedora15;
-    else if (Data.startswith("Fedora release 14"))
-      return Fedora14;
-    else if (Data.startswith("Fedora release 13"))
-      return Fedora13;
-    else if (Data.startswith("Fedora release") &&
-             Data.find("Rawhide") != StringRef::npos)
-      return FedoraRawhide;
+    if (Data.startswith("Fedora release"))
+      return Fedora;
     else if (Data.startswith("Red Hat Enterprise Linux") &&
              Data.find("release 6") != StringRef::npos)
       return RHEL6;





More information about the cfe-commits mailing list