[PATCH] D106427: [lld][ELF] remove empty SyntheticSections from inputSections
Fangrui Song via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 21 13:05:31 PDT 2021
MaskRay added inline comments.
================
Comment at: lld/ELF/Writer.cpp:1896
+ [](InputSectionBase *s) {
+ return !dyn_cast<SyntheticSection>(s);
+ })
----------------
Use `isa`
================
Comment at: lld/ELF/Writer.cpp:1901
+ // All inputSections are regular ones. Nothing to do.
+ if (start == inputSections.end())
+ return;
----------------
Delete. The code below can handle the case.
================
Comment at: lld/ELF/Writer.cpp:1915
+ // orphanSections.
+ for (BaseCommand *b : os->sectionCommands)
+ if (auto *isd = dyn_cast<InputSectionDescription>(b))
----------------
The right hand side of `auto end` is now complex.
While here, you can refactor the code to do one batch `llvm::erase_if` for `isd->sections` instead of N `llvm::erase_if`.
You may need a DenseSet
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D106427/new/
https://reviews.llvm.org/D106427
More information about the llvm-commits
mailing list