[llvm] [llvm] Followup fix for "Use XMACROS for MachO platforms" (PR #70140)
Juergen Ributzka via llvm-commits
llvm-commits at lists.llvm.org
Tue Oct 24 16:01:23 PDT 2023
https://github.com/ributzka created https://github.com/llvm/llvm-project/pull/70140
Fix the use of tapi_target in getPlatformFromName.
>From 81fe2c557f33b96621d4581ef731ae83f1593a14 Mon Sep 17 00:00:00 2001
From: Juergen Ributzka <juergen at ributzka.de>
Date: Tue, 24 Oct 2023 15:43:44 -0700
Subject: [PATCH] [llvm] Followup fix for "Use XMACROS for MachO platforms"
Fix the use of tapi_target in getPlatformFromName.
---
llvm/lib/TextAPI/Platform.cpp | 2 +-
llvm/unittests/TextAPI/TextStubV4Tests.cpp | 16 ++++++++++++++++
2 files changed, 17 insertions(+), 1 deletion(-)
diff --git a/llvm/lib/TextAPI/Platform.cpp b/llvm/lib/TextAPI/Platform.cpp
index 9d08469a41a89b7..ed041af40aa5b7a 100644
--- a/llvm/lib/TextAPI/Platform.cpp
+++ b/llvm/lib/TextAPI/Platform.cpp
@@ -76,7 +76,7 @@ PlatformType getPlatformFromName(StringRef Name) {
.Case("osx", PLATFORM_MACOS)
#define PLATFORM(platform, id, name, build_name, target, tapi_target, \
marketing) \
- .Case(#tapi_target, PLATFORM_##platform)
+ .Case(#target, PLATFORM_##platform)
#include "llvm/BinaryFormat/MachO.def"
.Default(PLATFORM_UNKNOWN);
}
diff --git a/llvm/unittests/TextAPI/TextStubV4Tests.cpp b/llvm/unittests/TextAPI/TextStubV4Tests.cpp
index 6ad9925f7fc5d54..43b3c4adadbddd8 100644
--- a/llvm/unittests/TextAPI/TextStubV4Tests.cpp
+++ b/llvm/unittests/TextAPI/TextStubV4Tests.cpp
@@ -542,6 +542,22 @@ TEST(TBDv4, Target_maccatalyst) {
stripWhitespace(Buffer.c_str()));
}
+TEST(TBDv4, Target_maccatalyst2) {
+ static const char TBDv4TargetMacCatalyst[] =
+ "--- !tapi-tbd\n"
+ "tbd-version: 4\n"
+ "targets: [ x86_64-maccatalyst ]\n"
+ "install-name: Test.dylib\n"
+ "...\n";
+
+ Expected<TBDFile> Result =
+ TextAPIReader::get(MemoryBufferRef(TBDv4TargetMacCatalyst, "Test.tbd"));
+ EXPECT_TRUE(!!Result);
+ TBDFile File = std::move(Result.get());
+ EXPECT_EQ(File->getPlatforms().size(), 1U);
+ EXPECT_EQ(getPlatformFromName("ios-macabi"), *File->getPlatforms().begin());
+}
+
TEST(TBDv4, Target_x86_ios) {
static const char TBDv4Targetx86iOS[] = "--- !tapi-tbd\n"
"tbd-version: 4\n"
More information about the llvm-commits
mailing list