[PATCH] D40338: Use lambdas to store lazy-evaluated .dynamic entries.

James Henderson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 22 04:50:29 PST 2017


jhenderson accepted this revision.
jhenderson added a comment.
This revision is now accepted and ready to land.

LGTM.

It's a lot bigger a change than I'd expected, but I like it!



================
Comment at: lld/ELF/SyntheticSections.cpp:1176
 
-  for (const Entry &E : Entries) {
-    P->d_tag = E.Tag;
-    switch (E.Kind) {
-    case Entry::SecAddr:
-      P->d_un.d_ptr = E.OutSec->Addr;
-      break;
-    case Entry::InSecAddr:
-      P->d_un.d_ptr = E.InSec->getParent()->Addr + E.InSec->OutSecOff;
-      break;
-    case Entry::SecSize:
-      P->d_un.d_val = E.OutSec->Size;
-      break;
-    case Entry::SymAddr:
-      P->d_un.d_ptr = E.Sym->getVA();
-      break;
-    case Entry::PlainInt:
-      P->d_un.d_val = E.Val;
-      break;
-    }
+  for (std::pair<int32_t, std::function<uint64_t()>> &KV : Entries) {
+    P->d_tag = KV.first;
----------------
Missing const maybe - what's the policy on const in LLD?


https://reviews.llvm.org/D40338





More information about the llvm-commits mailing list