[lld] r281222 - Simplify handling of /DISCARD/. NFC.
Rui Ueyama via llvm-commits
llvm-commits at lists.llvm.org
Mon Sep 12 10:33:10 PDT 2016
Nice. Thanks!
On Mon, Sep 12, 2016 at 9:05 AM, Rafael Espindola via llvm-commits <
llvm-commits at lists.llvm.org> wrote:
> Author: rafael
> Date: Mon Sep 12 11:05:16 2016
> New Revision: 281222
>
> URL: http://llvm.org/viewvc/llvm-project?rev=281222&view=rev
> Log:
> Simplify handling of /DISCARD/. NFC.
>
> Modified:
> lld/trunk/ELF/LinkerScript.cpp
> lld/trunk/ELF/LinkerScript.h
>
> Modified: lld/trunk/ELF/LinkerScript.cpp
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/
> LinkerScript.cpp?rev=281222&r1=281221&r2=281222&view=diff
> ============================================================
> ==================
> --- lld/trunk/ELF/LinkerScript.cpp (original)
> +++ lld/trunk/ELF/LinkerScript.cpp Mon Sep 12 11:05:16 2016
> @@ -149,14 +149,10 @@ getComparator(SortKind K) {
> }
>
> template <class ELFT>
> -void LinkerScript<ELFT>::discard(OutputSectionCommand &Cmd) {
> - for (const std::unique_ptr<BaseCommand> &Base : Cmd.Commands) {
> - if (auto *Cmd = dyn_cast<InputSectionDescription>(Base.get())) {
> - for (InputSectionBase<ELFT> *S : getInputSections(Cmd)) {
> - S->Live = false;
> - reportDiscarded(S);
> - }
> - }
> +void LinkerScript<ELFT>::discard(ArrayRef<InputSectionBase<ELFT> *> V) {
> + for (InputSectionBase<ELFT> *S : V) {
> + S->Live = false;
> + reportDiscarded(S);
> }
> }
>
> @@ -228,12 +224,13 @@ void LinkerScript<ELFT>::createSections(
> }
>
> if (auto *Cmd = dyn_cast<OutputSectionCommand>(Base1.get())) {
> + std::vector<InputSectionBase<ELFT> *> V =
> createInputSectionList(*Cmd);
> +
> if (Cmd->Name == "/DISCARD/") {
> - discard(*Cmd);
> + discard(V);
> continue;
> }
>
> - std::vector<InputSectionBase<ELFT> *> V =
> createInputSectionList(*Cmd);
> if (V.empty())
> continue;
>
>
> Modified: lld/trunk/ELF/LinkerScript.h
> URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/
> LinkerScript.h?rev=281222&r1=281221&r2=281222&view=diff
> ============================================================
> ==================
> --- lld/trunk/ELF/LinkerScript.h (original)
> +++ lld/trunk/ELF/LinkerScript.h Mon Sep 12 11:05:16 2016
> @@ -188,7 +188,7 @@ private:
> std::vector<InputSectionBase<ELFT> *>
> getInputSections(const InputSectionDescription *);
>
> - void discard(OutputSectionCommand &Cmd);
> + void discard(ArrayRef<InputSectionBase<ELFT> *> V);
>
> std::vector<InputSectionBase<ELFT> *>
> createInputSectionList(OutputSectionCommand &Cmd);
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160912/b54b30c2/attachment.html>
More information about the llvm-commits
mailing list