[llvm] 2d292ab - [llvm] Followup fix for "Use XMACROS for MachO platforms" (#70140)
via llvm-commits
llvm-commits at lists.llvm.org
Wed Oct 25 08:49:45 PDT 2023
Author: Juergen Ributzka
Date: 2023-10-25T08:49:41-07:00
New Revision: 2d292ab886c56390605f99db130def53b0ce185a
URL: https://github.com/llvm/llvm-project/commit/2d292ab886c56390605f99db130def53b0ce185a
DIFF: https://github.com/llvm/llvm-project/commit/2d292ab886c56390605f99db130def53b0ce185a.diff
LOG: [llvm] Followup fix for "Use XMACROS for MachO platforms" (#70140)
Fix the use of tapi_target in getPlatformFromName.
Added:
Modified:
llvm/lib/TextAPI/Platform.cpp
llvm/unittests/TextAPI/TextStubV4Tests.cpp
Removed:
################################################################################
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