[PATCH] D122156: [lld][Macho][NFC] Encapsulate priorities map in a priority class
Jez Ng via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 21 18:57:12 PDT 2022
int3 added inline comments.
================
Comment at: lld/MachO/SectionPriorities.cpp:305
MemoryBufferRef mbref = *buffer;
- size_t priority = std::numeric_limits<size_t>::max();
+ size_t priority = lowestPriority;
for (StringRef line : args::getLines(mbref)) {
----------------
I think you're confused about the intention of the code. `numeric_limits::max()` is the *highest* priority, not the lowest. But it's used to initialize the default value of the `lowestPriority` variable because if there are no entries in the order file, then the lowest priority is also the highest priority.
Now that we have the `PriorityBuilder` class, I think `lowestPriority` can be a member there. And maybe add a comment so future readers won't get confused :)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D122156/new/
https://reviews.llvm.org/D122156
More information about the llvm-commits
mailing list