[PATCH] D100451: [NFC] Fix unused variable warning.
David Blaikie via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Apr 21 17:38:21 PDT 2021
dblaikie added inline comments.
================
Comment at: lld/COFF/Chunks.cpp:818-821
+ (void)eq;
std::sort(begin, begin + cnt, lt);
assert(std::unique(begin, begin + cnt, eq) == begin + cnt &&
"RVA tables should be de-duplicated");
----------------
Rather than void casting the lambda, it's probably better to roll the lambda into the usage:
```
assert(std::unique(begin, begin + cnt, [](const RVAFlag &a, const RVAFlag &b) { return a.rva == b.rva; }) == begin + cnt && "...");
```
Also the lt lambda could be rolled into the std::sort call as well.
And perhaps making begin+cnt into an ArrayRef might be nice too. (then this code could use llvm::sort(container, comparator) for convenience - I don't think there's an llvm::unique that takes a container yet - but maybe someone will add one)
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D100451/new/
https://reviews.llvm.org/D100451
More information about the llvm-commits
mailing list