[llvm] [Triple] Add "swift" as a vendor. (PR #85094)

Alastair Houghton via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 13 07:54:33 PDT 2024


https://github.com/al45tair created https://github.com/llvm/llvm-project/pull/85094

We want this so we can uniquely identify our fully-static Linux target using a triple (since we wish to make decisions about it in the compiler driver that wouldn't be appropriate for an "unknown" triple).

rdar://123436421

>From 226e8ce5348a72e780e1acf578a3553614cbdc04 Mon Sep 17 00:00:00 2001
From: Alastair Houghton <ahoughton at apple.com>
Date: Thu, 22 Feb 2024 11:45:12 +0000
Subject: [PATCH] [Triple] Add "swift" as a vendor.

We want this so we can uniquely identify our fully-static Linux
target using a triple (since we wish to make decisions about it in
the compiler driver that wouldn't be appropriate for an "unknown"
triple).

rdar://123436421
---
 llvm/include/llvm/TargetParser/Triple.h | 3 ++-
 llvm/lib/TargetParser/Triple.cpp        | 2 ++
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h
index f256e2b205a8899..8ae8f12e43e1634 100644
--- a/llvm/include/llvm/TargetParser/Triple.h
+++ b/llvm/include/llvm/TargetParser/Triple.h
@@ -182,7 +182,8 @@ class Triple {
     Mesa,
     SUSE,
     OpenEmbedded,
-    LastVendorType = OpenEmbedded
+    Swift,
+    LastVendorType = Swift
   };
   enum OSType {
     UnknownOS,
diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp
index 624679ff507a7f2..550f9242a654d9e 100644
--- a/llvm/lib/TargetParser/Triple.cpp
+++ b/llvm/lib/TargetParser/Triple.cpp
@@ -228,6 +228,7 @@ StringRef Triple::getVendorTypeName(VendorType Kind) {
   case PC: return "pc";
   case SCEI: return "scei";
   case SUSE: return "suse";
+  case Swift: return "swift";
   }
 
   llvm_unreachable("Invalid VendorType!");
@@ -604,6 +605,7 @@ static Triple::VendorType parseVendor(StringRef VendorName) {
     .Case("amd", Triple::AMD)
     .Case("mesa", Triple::Mesa)
     .Case("suse", Triple::SUSE)
+    .Case("swift", Triple::Swift)
     .Case("oe", Triple::OpenEmbedded)
     .Default(Triple::UnknownVendor);
 }



More information about the llvm-commits mailing list