[PATCH] D110900: Triple: Add RedHat vendor
Tom Stellard via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 30 20:13:32 PDT 2021
tstellar created this revision.
Herald added subscribers: dexonsmith, hiraditya.
tstellar requested review of this revision.
Herald added a project: LLVM.
On Red Hat operating systems (RHEL, Fedora Linux), the gcc triple is
$arch-redhat-linux. The gnu environment is the default environment, but
is not explcitly listed in the triple.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D110900
Files:
llvm/include/llvm/ADT/Triple.h
llvm/lib/Support/Triple.cpp
llvm/unittests/ADT/TripleTest.cpp
Index: llvm/unittests/ADT/TripleTest.cpp
===================================================================
--- llvm/unittests/ADT/TripleTest.cpp
+++ llvm/unittests/ADT/TripleTest.cpp
@@ -128,6 +128,12 @@
EXPECT_EQ(Triple::SCEI, T.getVendor());
EXPECT_EQ(Triple::PS4, T.getOS());
+ T = Triple("x86_64-redhat-linux");
+ EXPECT_EQ(Triple::x86_64, T.getArch());
+ EXPECT_EQ(Triple::RedHat, T.getVendor());
+ EXPECT_EQ(Triple::Linux, T.getOS());
+ EXPECT_EQ(true, T.isGNUEnvironment());
+
T = Triple("powerpc-ibm-aix");
EXPECT_EQ(Triple::ppc, T.getArch());
EXPECT_EQ(Triple::IBM, T.getVendor());
Index: llvm/lib/Support/Triple.cpp
===================================================================
--- llvm/lib/Support/Triple.cpp
+++ llvm/lib/Support/Triple.cpp
@@ -179,6 +179,7 @@
case PC: return "pc";
case SCEI: return "scei";
case SUSE: return "suse";
+ case RedHat: return "redhat";
}
llvm_unreachable("Invalid VendorType!");
@@ -497,6 +498,7 @@
.Case("mesa", Triple::Mesa)
.Case("suse", Triple::SUSE)
.Case("oe", Triple::OpenEmbedded)
+ .Case("redhat", Triple::RedHat)
.Default(Triple::UnknownVendor);
}
Index: llvm/include/llvm/ADT/Triple.h
===================================================================
--- llvm/include/llvm/ADT/Triple.h
+++ llvm/include/llvm/ADT/Triple.h
@@ -159,6 +159,7 @@
Mesa,
SUSE,
OpenEmbedded,
+ RedHat,
LastVendorType = OpenEmbedded
};
enum OSType {
@@ -531,7 +532,8 @@
EnvironmentType Env = getEnvironment();
return Env == Triple::GNU || Env == Triple::GNUABIN32 ||
Env == Triple::GNUABI64 || Env == Triple::GNUEABI ||
- Env == Triple::GNUEABIHF || Env == Triple::GNUX32;
+ Env == Triple::GNUEABIHF || Env == Triple::GNUX32 ||
+ (getVendor() == Triple::RedHat && Env == Triple::UnknownEnvironment);
}
bool isOSContiki() const {
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D110900.376415.patch
Type: text/x-patch
Size: 1921 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20211001/eeab9468/attachment.bin>
More information about the llvm-commits
mailing list