[PATCH] D22749: [ELF] - Linkerscript: Implemented SORT command

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Thu Jul 28 15:43:57 PDT 2016


ruiu added inline comments.

================
Comment at: ELF/LinkerScript.cpp:153
@@ +152,3 @@
+
+      std::vector<InputSectionBase<ELFT> *> Candidates;
+      for (InputSectionBase<ELFT> *S : getInputSections(InCmd)) {
----------------
Candidate for what? Maybe just `Sections` is better.

================
Comment at: ELF/LinkerScript.cpp:162
@@ -147,2 +161,3 @@
       }
-      Add(S, OutputName);
+      mayBeSort(Candidates, InCmd->Sort);
+      for (InputSectionBase<ELFT> *I : Candidates)
----------------
I don't think making this a separate function improves readability. This is probably better.

  if (InCmd->Sort)
    std::stable_sort(Candidates.begin(), Candidates.end(), compareByName);

where compareByName is a separate file-scope function.


https://reviews.llvm.org/D22749





More information about the llvm-commits mailing list