[llvm] a0cd413 - [TextAPI] Teach TextAPI about arm64e

Cyndy Ishida via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 5 13:29:12 PST 2020


Author: Cyndy Ishida
Date: 2020-03-05T13:22:25-08:00
New Revision: a0cd413426479abb207381bdbab862f3dfb3ce7d

URL: https://github.com/llvm/llvm-project/commit/a0cd413426479abb207381bdbab862f3dfb3ce7d
DIFF: https://github.com/llvm/llvm-project/commit/a0cd413426479abb207381bdbab862f3dfb3ce7d.diff

LOG: [TextAPI] Teach TextAPI about arm64e

Reviewers: ributzka, cishida

Subscribers: kristof.beyls, dexonsmith, dcoughlin, llvm-commits

Tags: #llvm

Differential Revision: https://reviews.llvm.org/D75688

Added: 
    

Modified: 
    llvm/include/llvm/TextAPI/MachO/Architecture.def
    llvm/unittests/TextAPI/TextStubV3Tests.cpp
    llvm/unittests/TextAPI/TextStubV4Tests.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/TextAPI/MachO/Architecture.def b/llvm/include/llvm/TextAPI/MachO/Architecture.def
index 4c695fe18eec..be31382147bc 100644
--- a/llvm/include/llvm/TextAPI/MachO/Architecture.def
+++ b/llvm/include/llvm/TextAPI/MachO/Architecture.def
@@ -36,3 +36,4 @@ ARCHINFO(armv7em, MachO::CPU_TYPE_ARM, MachO::CPU_SUBTYPE_ARM_V7EM)
 /// ARM64 architectures sorted by cpu sub type id.
 ///
 ARCHINFO(arm64, MachO::CPU_TYPE_ARM64, MachO::CPU_SUBTYPE_ARM64_ALL)
+ARCHINFO(arm64e, MachO::CPU_TYPE_ARM64, MachO::CPU_SUBTYPE_ARM64E)

diff  --git a/llvm/unittests/TextAPI/TextStubV3Tests.cpp b/llvm/unittests/TextAPI/TextStubV3Tests.cpp
index e67fd38eceb6..6e7c087296e6 100644
--- a/llvm/unittests/TextAPI/TextStubV3Tests.cpp
+++ b/llvm/unittests/TextAPI/TextStubV3Tests.cpp
@@ -408,6 +408,31 @@ TEST(TBDv3, Platform_tvOSSim) {
             stripWhitespace(Buffer.c_str()));
 }
 
+TEST(TBDv3, Arch_arm64e) {
+  static const char TBDv3ArchArm64e[] = "--- !tapi-tbd-v3\n"
+                                        "archs: [ arm64, arm64e ]\n"
+                                        "platform: ios\n"
+                                        "install-name: Test.dylib\n"
+                                        "...\n";
+
+  auto Result =
+      TextAPIReader::get(MemoryBufferRef(TBDv3ArchArm64e, "Test.tbd"));
+  EXPECT_TRUE(!!Result);
+  auto File = std::move(Result.get());
+  auto Platform = PlatformKind::iOS;
+  auto Archs = AK_arm64 | AK_arm64e;
+  EXPECT_EQ(FileType::TBD_V3, File->getFileType());
+  EXPECT_EQ(File->getPlatforms().size(), 1U);
+  EXPECT_EQ(Platform, *File->getPlatforms().begin());
+  EXPECT_EQ(Archs, File->getArchitectures());
+
+  SmallString<4096> Buffer;
+  raw_svector_ostream OS(Buffer);
+  auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
+  EXPECT_TRUE(!WriteResult);
+  EXPECT_EQ(stripWhitespace(TBDv3ArchArm64e), stripWhitespace(Buffer.c_str()));
+}
+
 TEST(TBDv3, Swift_1_0) {
   static const char TBDv3Swift1[] = "--- !tapi-tbd-v3\n"
                                     "archs: [ arm64 ]\n"

diff  --git a/llvm/unittests/TextAPI/TextStubV4Tests.cpp b/llvm/unittests/TextAPI/TextStubV4Tests.cpp
index 07af8f20dea3..cecc6d19f50e 100644
--- a/llvm/unittests/TextAPI/TextStubV4Tests.cpp
+++ b/llvm/unittests/TextAPI/TextStubV4Tests.cpp
@@ -375,6 +375,28 @@ TEST(TBDv4, Target_arm_bridgeOS) {
             stripWhitespace(Buffer.c_str()));
 }
 
+TEST(TBDv4, Target_arm_iOS) {
+  static const char tbdv4_arm64e[] = "--- !tapi-tbd\n"
+                                     "tbd-version: 4\n"
+                                     "targets: [  arm64e-ios ]\n"
+                                     "install-name: Test.dylib\n"
+                                     "...\n";
+
+  auto Result = TextAPIReader::get(MemoryBufferRef(tbdv4_arm64e, "Test.tbd"));
+  EXPECT_TRUE(!!Result);
+  auto File = std::move(Result.get());
+  EXPECT_EQ(FileType::TBD_V4, File->getFileType());
+  EXPECT_EQ(File->getPlatforms().size(), 1U);
+  EXPECT_EQ(PlatformKind::iOS, *File->getPlatforms().begin());
+  EXPECT_EQ(ArchitectureSet(AK_arm64e), File->getArchitectures());
+
+  SmallString<4096> Buffer;
+  raw_svector_ostream OS(Buffer);
+  auto WriteResult = TextAPIWriter::writeToStream(OS, *File);
+  EXPECT_TRUE(!WriteResult);
+  EXPECT_EQ(stripWhitespace(tbdv4_arm64e), stripWhitespace(Buffer.c_str()));
+}
+
 TEST(TBDv4, Target_x86_macos) {
   static const char tbd_x86_macos[] = "--- !tapi-tbd\n"
                                       "tbd-version: 4\n"


        


More information about the llvm-commits mailing list