diff options
| author | Rafael Espindola <rafael.espindola@gmail.com> | 2017-05-23 22:47:31 +0000 |
|---|---|---|
| committer | Rafael Espindola <rafael.espindola@gmail.com> | 2017-05-23 22:47:31 +0000 |
| commit | 6a1aa8d9b451b9d9f1452e86ce0b02993b8fae36 (patch) | |
| tree | 43b34796daaf0467559eaec6423bdd696a5ced8f /lld/ELF/LinkerScript.cpp | |
| parent | 65ab07b1f1989b532083c6198faac276f6c43dbd (diff) | |
| download | bcm5719-llvm-6a1aa8d9b451b9d9f1452e86ce0b02993b8fae36.tar.gz bcm5719-llvm-6a1aa8d9b451b9d9f1452e86ce0b02993b8fae36.zip | |
Use more strict types. NFC.
By the time we get to linker scripts, all special InputSectionBase
should have been combined into synthetic sections, which are a type of
InputSection. The net result is that we can use InputSection in a few
places that were using InputSectionBase.
llvm-svn: 303702
Diffstat (limited to 'lld/ELF/LinkerScript.cpp')
| -rw-r--r-- | lld/ELF/LinkerScript.cpp | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/lld/ELF/LinkerScript.cpp b/lld/ELF/LinkerScript.cpp index c303f0524ad..e3c08a34246 100644 --- a/lld/ELF/LinkerScript.cpp +++ b/lld/ELF/LinkerScript.cpp @@ -263,16 +263,16 @@ static bool matchConstraints(ArrayRef<InputSectionBase *> Sections, (!IsRW && Kind == ConstraintKind::ReadOnly); } -static void sortSections(InputSectionBase **Begin, InputSectionBase **End, +static void sortSections(InputSection **Begin, InputSection **End, SortSectionPolicy K) { if (K != SortSectionPolicy::Default && K != SortSectionPolicy::None) std::stable_sort(Begin, End, getComparator(K)); } // Compute and remember which sections the InputSectionDescription matches. -std::vector<InputSectionBase *> +std::vector<InputSection *> LinkerScript::computeInputSections(const InputSectionDescription *Cmd) { - std::vector<InputSectionBase *> Ret; + std::vector<InputSection *> Ret; // Collects all sections that satisfy constraints of Cmd. for (const SectionPattern &Pat : Cmd->SectionPatterns) { @@ -294,7 +294,7 @@ LinkerScript::computeInputSections(const InputSectionDescription *Cmd) { !Pat.SectionPat.match(Sec->Name)) continue; - Ret.push_back(Sec); + Ret.push_back(cast<InputSection>(Sec)); Sec->Assigned = true; } @@ -309,8 +309,8 @@ LinkerScript::computeInputSections(const InputSectionDescription *Cmd) { // --sort-section is handled as an inner SORT command. // 3. If one SORT command is given, and if it is SORT_NONE, don't sort. // 4. If no SORT command is given, sort according to --sort-section. - InputSectionBase **Begin = Ret.data() + SizeBefore; - InputSectionBase **End = Ret.data() + Ret.size(); + InputSection **Begin = Ret.data() + SizeBefore; + InputSection **End = Ret.data() + Ret.size(); if (Pat.SortOuter != SortSectionPolicy::None) { if (Pat.SortInner == SortSectionPolicy::Default) sortSections(Begin, End, Config->SortSection); @@ -493,7 +493,7 @@ void LinkerScript::addOrphanSections(OutputSectionFactory &Factory) { Sec->SectionIndex = Index; } auto *ISD = make<InputSectionDescription>(""); - ISD->Sections.push_back(S); + ISD->Sections.push_back(cast<InputSection>(S)); Cmd->Commands.push_back(ISD); } } @@ -875,20 +875,20 @@ void LinkerScript::synchronize() { if (!Cmd) continue; ArrayRef<InputSection *> Sections = Cmd->Sec->Sections; - std::vector<InputSectionBase **> ScriptSections; - DenseSet<InputSectionBase *> ScriptSectionsSet; + std::vector<InputSection **> ScriptSections; + DenseSet<InputSection *> ScriptSectionsSet; for (BaseCommand *Base : Cmd->Commands) { auto *ISD = dyn_cast<InputSectionDescription>(Base); if (!ISD) continue; - for (InputSectionBase *&IS : ISD->Sections) { + for (InputSection *&IS : ISD->Sections) { if (IS->Live) { ScriptSections.push_back(&IS); ScriptSectionsSet.insert(IS); } } } - std::vector<InputSectionBase *> Missing; + std::vector<InputSection *> Missing; for (InputSection *IS : Sections) if (!ScriptSectionsSet.count(IS)) Missing.push_back(IS); @@ -896,7 +896,7 @@ void LinkerScript::synchronize() { auto ISD = make<InputSectionDescription>(""); ISD->Sections = Missing; Cmd->Commands.push_back(ISD); - for (InputSectionBase *&IS : ISD->Sections) + for (InputSection *&IS : ISD->Sections) if (IS->Live) ScriptSections.push_back(&IS); } |

