[PATCH] D35832: [ELF] - Store PhdrEntry values by pointers instead of storing by value.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 25 11:32:36 PDT 2017


ruiu added a comment.

This doesn't really seem to improve the code, although it probably won't decrease the quality as well. I looked at your two other patches, but I cannot find why they need this change.



================
Comment at: ELF/LinkerScript.cpp:802-805
   auto FirstPTLoad = llvm::find_if(
-      Phdrs, [](const PhdrEntry &E) { return E.p_type == PT_LOAD; });
+      Phdrs, [](const PhdrEntry *E) { return E->p_type == PT_LOAD; });
   if (FirstPTLoad == Phdrs.end())
     return;
----------------
FirstPTLoad is not a type that you can handle easily as it needs to dereference twice. You can do this.

  auto It = llvm::find_if(...);
  if (It == Phdrs.end())
    return;
  PhdrEntry *FirstPTLoad = *It;


https://reviews.llvm.org/D35832





More information about the llvm-commits mailing list