Skip to content

Commit 2d292ab

Browse files
authored
[llvm] Followup fix for "Use XMACROS for MachO platforms" (#70140)
Fix the use of tapi_target in getPlatformFromName.
1 parent 8a181f4 commit 2d292ab

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

llvm/lib/TextAPI/Platform.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ PlatformType getPlatformFromName(StringRef Name) {
7676
.Case("osx", PLATFORM_MACOS)
7777
#define PLATFORM(platform, id, name, build_name, target, tapi_target, \
7878
marketing) \
79-
.Case(#tapi_target, PLATFORM_##platform)
79+
.Case(#target, PLATFORM_##platform)
8080
#include "llvm/BinaryFormat/MachO.def"
8181
.Default(PLATFORM_UNKNOWN);
8282
}

llvm/unittests/TextAPI/TextStubV4Tests.cpp

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,6 +542,22 @@ TEST(TBDv4, Target_maccatalyst) {
542542
stripWhitespace(Buffer.c_str()));
543543
}
544544

545+
TEST(TBDv4, Target_maccatalyst2) {
546+
static const char TBDv4TargetMacCatalyst[] =
547+
"--- !tapi-tbd\n"
548+
"tbd-version: 4\n"
549+
"targets: [ x86_64-maccatalyst ]\n"
550+
"install-name: Test.dylib\n"
551+
"...\n";
552+
553+
Expected<TBDFile> Result =
554+
TextAPIReader::get(MemoryBufferRef(TBDv4TargetMacCatalyst, "Test.tbd"));
555+
EXPECT_TRUE(!!Result);
556+
TBDFile File = std::move(Result.get());
557+
EXPECT_EQ(File->getPlatforms().size(), 1U);
558+
EXPECT_EQ(getPlatformFromName("ios-macabi"), *File->getPlatforms().begin());
559+
}
560+
545561
TEST(TBDv4, Target_x86_ios) {
546562
static const char TBDv4Targetx86iOS[] = "--- !tapi-tbd\n"
547563
"tbd-version: 4\n"

0 commit comments

Comments
 (0)