This is an archive of the discontinued LLVM Phabricator instance.

[NFC] Fix unused variable warning.
ClosedPublic

Authored by bgraur on Apr 14 2021, 12:33 AM.

Diff Detail

Event Timeline

bgraur requested review of this revision.Apr 14 2021, 12:33 AM
bgraur created this revision.
Herald added a project: Restricted Project. · View Herald TranscriptApr 14 2021, 12:33 AM
This revision was not accepted when it landed; it landed in state Needs Review.Apr 14 2021, 12:36 AM
This revision was landed with ongoing or failed builds.
Closed by commit rG7975dd033cb9: [NFC] Fix unused variable warning. (authored by bgraur, committed by kadircet). · Explain Why
This revision was automatically updated to reflect the committed changes.
dblaikie added inline comments.
lld/COFF/Chunks.cpp
818–821

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)

dblaikie added inline comments.May 24 2021, 6:04 PM
lld/COFF/Chunks.cpp
818–821

Ended up doing a few cleanups in e5b66a373414036db22d19647d913c2571df2701