[PATCH] D67255: [llvm-ifs] Fixing hardcoding of PlatformKind for TBD generation

Puyan Lotfi via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Sep 5 23:15:46 PDT 2019


plotfi created this revision.
plotfi added reviewers: cishida, compnerd.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

@cishida noticed I had hardcoded PlatformKind in my TBD generation in my first commit of llvm-ifs. This is a differential to get that rectified.

Any pointers on what the proper triple for BridgeOS should be would be helpful.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D67255

Files:
  llvm/tools/llvm-ifs/llvm-ifs.cpp


Index: llvm/tools/llvm-ifs/llvm-ifs.cpp
===================================================================
--- llvm/tools/llvm-ifs/llvm-ifs.cpp
+++ llvm/tools/llvm-ifs/llvm-ifs.cpp
@@ -236,15 +236,32 @@
     }
   }(T);
 
+  auto PlatformKindOrError =
+      [](const llvm::Triple &T) -> llvm::Expected<llvm::MachO::PlatformKind> {
+    if (T.isiOS())
+      return llvm::MachO::PlatformKind::iOS;
+    if (T.isMacOSX())
+      return llvm::MachO::PlatformKind::macOS;
+    if (T.isTvOS())
+      return llvm::MachO::PlatformKind::tvOS;
+    if (T.isWatchOS())
+      return llvm::MachO::PlatformKind::watchOS;
+    return createStringError(errc::not_supported, "Invalid Platform.");
+  }(T);
+
   if (!ArchOrError)
     return -1;
 
+  if (!PlatformKindOrError)
+    return -1;
+
   Architecture Arch = ArchOrError.get();
+  PlatformKind Plat = PlatformKindOrError.get();
 
   InterfaceFile File;
   File.setFileType(FileType::TBD_V3);
   File.setArchitectures(Arch);
-  File.setPlatform(PlatformKind::macOS);
+  File.setPlatform(Plat);
 
   for (const auto &Symbol : Symbols) {
     auto Name = Symbol.Name;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D67255.219029.patch
Type: text/x-patch
Size: 1110 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190906/feb62c4a/attachment.bin>


More information about the llvm-commits mailing list