[PATCH] D59239: ELF: Simplify. NFCI.
Peter Collingbourne via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Mon Mar 11 19:19:13 PDT 2019
pcc created this revision.
pcc added reviewers: ruiu, grimar.
Herald added subscribers: MaskRay, arichardson, emaste.
Herald added a reviewer: espindola.
Herald added a project: LLVM.
We don't need to take a slice of SectionCommands in addOrphanSections()
because it is not modified until the end of the function.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D59239
Files:
lld/ELF/LinkerScript.cpp
Index: lld/ELF/LinkerScript.cpp
===================================================================
--- lld/ELF/LinkerScript.cpp
+++ lld/ELF/LinkerScript.cpp
@@ -636,7 +636,6 @@
// Add sections that didn't match any sections command.
void LinkerScript::addOrphanSections() {
- unsigned End = SectionCommands.size();
StringMap<OutputSection *> Map;
std::vector<OutputSection *> V;
@@ -651,8 +650,7 @@
else if (Config->OrphanHandling == OrphanHandlingPolicy::Warn)
warn(toString(S) + " is being placed in '" + Name + "'");
- if (OutputSection *Sec =
- findByName(makeArrayRef(SectionCommands).slice(0, End), Name)) {
+ if (OutputSection *Sec = findByName(SectionCommands, Name)) {
Sec->addSection(cast<InputSection>(S));
return;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D59239.190201.patch
Type: text/x-patch
Size: 792 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190312/aa28cb99/attachment.bin>
More information about the llvm-commits
mailing list