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 @@ -39,9 +39,7 @@ DebianBullseye, DebianBookworm, Exherbo, - RHEL5, - RHEL6, - RHEL7, + RHEL, Fedora, Gentoo, OpenSUSE, @@ -114,7 +112,7 @@ /// @{ bool IsRedhat() const { - return DistroVal == Fedora || (DistroVal >= RHEL5 && DistroVal <= RHEL7); + 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 @@ -118,12 +118,7 @@ return Distro::Fedora; if (Data.startswith("Red Hat Enterprise Linux") || Data.startswith("CentOS") || Data.startswith("Scientific Linux")) { - if (Data.find("release 7") != StringRef::npos) - return Distro::RHEL7; - else if (Data.find("release 6") != StringRef::npos) - return Distro::RHEL6; - else if (Data.find("release 5") != StringRef::npos) - 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());