[lld] [ELF] Keep non-alloc orphan sections at the end (PR #94519)

Peter Smith via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 6 03:48:05 PDT 2024


================
@@ -1316,8 +1320,8 @@ template <class ELFT> void Writer<ELFT>::sortOrphanSections() {
   i = firstSectionOrDotAssignment;
 
   while (nonScriptI != e) {
-    auto pos = findOrphanPos(i, nonScriptI);
     OutputSection *orphan = &cast<OutputDesc>(*nonScriptI)->osec;
+    auto pos = findOrphanPos(i, nonScriptI);
----------------
smithp35 wrote:

Although not part of this patch, I'm wondering whether `nonScriptI` would be better called `getNonScriptI` to make it a bit clearer that it is a lambda. It's current name implies that it is a variable. 

https://github.com/llvm/llvm-project/pull/94519


More information about the llvm-commits mailing list