diff --git a/clang/include/clang/Driver/Distro.h b/clang/include/clang/Driver/Distro.h --- a/clang/include/clang/Driver/Distro.h +++ b/clang/include/clang/Driver/Distro.h @@ -40,9 +40,7 @@ DebianBookworm, DebianTrixie, Exherbo, - RHEL5, - RHEL6, - RHEL7, + RHEL, Fedora, Gentoo, OpenSUSE, @@ -117,9 +115,7 @@ /// @name Convenience Predicates /// @{ - bool IsRedhat() const { - return DistroVal == Fedora || (DistroVal >= RHEL5 && DistroVal <= RHEL7); - } + bool IsRedhat() const { return DistroVal == Fedora || DistroVal == RHEL; } bool IsOpenSUSE() const { return DistroVal == OpenSUSE; } diff --git a/clang/lib/Driver/Distro.cpp b/clang/lib/Driver/Distro.cpp --- a/clang/lib/Driver/Distro.cpp +++ b/clang/lib/Driver/Distro.cpp @@ -121,12 +121,7 @@ return Distro::Fedora; if (Data.startswith("Red Hat Enterprise Linux") || Data.startswith("CentOS") || Data.startswith("Scientific Linux")) { - if (Data.contains("release 7")) - return Distro::RHEL7; - else if (Data.contains("release 6")) - return Distro::RHEL6; - else if (Data.contains("release 5")) - return Distro::RHEL5; + return Distro::RHEL; } return Distro::UnknownDistro; } diff --git a/clang/unittests/Driver/DistroTest.cpp b/clang/unittests/Driver/DistroTest.cpp --- a/clang/unittests/Driver/DistroTest.cpp +++ b/clang/unittests/Driver/DistroTest.cpp @@ -152,7 +152,7 @@ "REDHAT_SUPPORT_PRODUCT_VERSION=\"7\"\n")); Distro CentOS7{CentOS7FileSystem, llvm::Triple("unknown-pc-linux")}; - ASSERT_EQ(Distro(Distro::RHEL7), CentOS7); + ASSERT_EQ(Distro(Distro::RHEL), CentOS7); ASSERT_FALSE(CentOS7.IsUbuntu()); ASSERT_TRUE(CentOS7.IsRedhat()); ASSERT_FALSE(CentOS7.IsOpenSUSE());