[PATCH] D68965: [WebAssembly] Elide data segments for .bss sections

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 15 02:37:15 PDT 2019


ruiu added inline comments.


================
Comment at: lld/wasm/OutputSections.cpp:219
+                        return !seg->isImplicit;
+                      }) != segments.end();
+}
----------------
sbc100 wrote:
> You find this easier to read than:
> 
> ```
> for (auto S : segments) 
>   if (!seg->isImplicit)
>     return true;
> return false;
> ```
> 
> ?
> 
> Maybe I just need get of board with the kids and accept the C++ lambda future that we now live in?  I mean it is kinda cool.
> 
> Is there something like python's `any()` builtin in stl that might make this more readable?
Yeah, in lld the `for` loops such as the one Sam suggested are used more often than the higher-order predicate function. Rewriting this with `for` is perhaps more preferable.


================
Comment at: lld/wasm/OutputSegment.h:35
   StringRef name;
+  bool isImplicit = false;
   uint32_t index = 0;
----------------
`isBss` is I think more straightforward name, and I believe we use that variable name in ELF too.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D68965/new/

https://reviews.llvm.org/D68965





More information about the llvm-commits mailing list