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

Shoaib Meenai via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 3 11:52:46 PDT 2019


smeenai added inline comments.


================
Comment at: llvm/tools/llvm-lipo/llvm-lipo.cpp:329
 
+static void checkArchDuplicates(const ArrayRef<Slice> &Slices) {
+  DenseMap<uint64_t, const MachOObjectFile *> CPUIds;
----------------
compnerd wrote:
> I think that having a helper will help:
> 
> ```
> auto CPUIDForSlice = [](const Slice &S) -> uint64_t {
>   return S.ObjectFile->getHeader().cputype << 32 | S.ObjectFile->getHeader().cpusubtype;
> };
> ```
I think you'd still need to cast `S.ObjectFile->getHeader().cputype` to a uint64_t beforehand, otherwise you'll be shifting an int by 32 bits and get UB.


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