From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001 From: Daniel Bertalan Date: Thu, 14 Apr 2022 09:51:24 +0200 Subject: [PATCH] [Triple] Add triple for SerenityOS --- llvm/include/llvm/TargetParser/Triple.h | 8 +++++++- llvm/lib/TargetParser/Triple.cpp | 2 ++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/llvm/include/llvm/TargetParser/Triple.h b/llvm/include/llvm/TargetParser/Triple.h index 59513fa2f..951d69010 100644 --- a/llvm/include/llvm/TargetParser/Triple.h +++ b/llvm/include/llvm/TargetParser/Triple.h @@ -223,7 +223,8 @@ public: WASI, // Experimental WebAssembly OS Emscripten, ShaderModel, // DirectX ShaderModel - LastOSType = ShaderModel + Serenity, + LastOSType = Serenity }; enum EnvironmentType { UnknownEnvironment, @@ -670,6 +671,11 @@ public: return getOS() == Triple::AIX; } + /// Tests whether the OS is SerenityOS + bool isOSSerenity() const { + return getOS() == Triple::Serenity; + } + /// Tests whether the OS uses the ELF binary format. bool isOSBinFormatELF() const { return getObjectFormat() == Triple::ELF; diff --git a/llvm/lib/TargetParser/Triple.cpp b/llvm/lib/TargetParser/Triple.cpp index a68035989..1ee9ea3b1 100644 --- a/llvm/lib/TargetParser/Triple.cpp +++ b/llvm/lib/TargetParser/Triple.cpp @@ -237,6 +237,7 @@ StringRef Triple::getOSTypeName(OSType Kind) { case PS5: return "ps5"; case RTEMS: return "rtems"; case Solaris: return "solaris"; + case Serenity: return "serenity"; case TvOS: return "tvos"; case WASI: return "wasi"; case WatchOS: return "watchos"; @@ -596,6 +597,7 @@ static Triple::OSType parseOS(StringRef OSName) { .StartsWith("wasi", Triple::WASI) .StartsWith("emscripten", Triple::Emscripten) .StartsWith("shadermodel", Triple::ShaderModel) + .StartsWith("serenity", Triple::Serenity) .Default(Triple::UnknownOS); }