tstellar updated this revision to Diff 509912. tstellar added a comment. Herald added a subscriber: MaskRay. Herald added a project: All.
Rebase and fix formatting. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D109693/new/ https://reviews.llvm.org/D109693 Files: clang/include/clang/Driver/Distro.h clang/lib/Driver/Distro.cpp clang/unittests/Driver/DistroTest.cpp Index: clang/unittests/Driver/DistroTest.cpp =================================================================== --- clang/unittests/Driver/DistroTest.cpp +++ 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()); Index: clang/lib/Driver/Distro.cpp =================================================================== --- clang/lib/Driver/Distro.cpp +++ 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; } Index: clang/include/clang/Driver/Distro.h =================================================================== --- clang/include/clang/Driver/Distro.h +++ 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; }
Index: clang/unittests/Driver/DistroTest.cpp =================================================================== --- clang/unittests/Driver/DistroTest.cpp +++ 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()); Index: clang/lib/Driver/Distro.cpp =================================================================== --- clang/lib/Driver/Distro.cpp +++ 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; } Index: clang/include/clang/Driver/Distro.h =================================================================== --- clang/include/clang/Driver/Distro.h +++ 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; }
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits