[PATCH] D128093: [lld-macho] Initial support for Linker Optimization Hints
    Jez Ng via Phabricator via llvm-commits 
    llvm-commits at lists.llvm.org
       
    Wed Jun 29 11:03:27 PDT 2022
    
    
  
int3 added a comment.
just one question about the bounds check, otherwise this lgtm
================
Comment at: lld/MachO/Arch/ARM64.cpp:171
+
+struct OptimizationHintContext {
+  uint8_t *buf;
----------------
imo `struct` should be reserved for POD types. Things with nontrivial methods should be `class` (with the public functions above the private data members)
(alternatively you could keep this a `struct` and have the methods be free functions)
================
Comment at: lld/MachO/InputFiles.cpp:526
+      int64_t d = address - offset0;
+      if (LLVM_UNLIKELY(d > std::numeric_limits<int64_t>::max() ||
+                        d < std::numeric_limits<int16_t>::min())) {
----------------
is this supposed to be `int16_t`? The check as-is will never be false
CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128093/new/
https://reviews.llvm.org/D128093
    
    
More information about the llvm-commits
mailing list