[PATCH] D64102: [llvm-lipo] Implement -create part 1

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 15:57:23 PDT 2019


smeenai added inline comments.


================
Comment at: llvm/tools/llvm-lipo/llvm-lipo.cpp:328
+  DenseMap<uint64_t, const MachOObjectFile *> CPUIds;
+  auto CPUIDForSlice = [](const Slice &S) -> uint64_t {
+    return static_cast<uint64_t>(S.ObjectFile->getHeader().cputype) << 32 |
----------------
Nit: you shouldn't need the `-> uint64_t`; the return type should be inferred correctly.


================
Comment at: llvm/tools/llvm-lipo/llvm-lipo.cpp:333
+  for (const auto &S : Slices) {
+    auto Entry = CPUIds.insert(std::make_pair(CPUIDForSlice(S), S.ObjectFile));
+    if (!Entry.second)
----------------
Nit: you could use `try_emplace` instead of `insert` to avoid the need for `std::make_pair`.


================
Comment at: llvm/tools/llvm-lipo/llvm-lipo.cpp:416
+                  "exceeds that.");
+    MachO::fat_arch FatArch;
+    FatArch.cputype = ObjectFile->getHeader().cputype;
----------------
Nit: I'd add a newline above this, to separate the error handling from the normal codepath.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64102/new/

https://reviews.llvm.org/D64102





More information about the llvm-commits mailing list