[PATCH] D109693: Driver: Remove major release version detection for RHEL
Tom Stellard via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 30 23:13:53 PDT 2023
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; }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D109693.509912.patch
Type: text/x-patch
Size: 1897 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230331/3c7d1a87/attachment.bin>
More information about the cfe-commits
mailing list