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

Thomas Lively via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 15 11:45:32 PDT 2019


tlively marked 2 inline comments as done.
tlively added inline comments.


================
Comment at: lld/wasm/OutputSections.cpp:219
+                        return !seg->isImplicit;
+                      }) != segments.end();
+}
----------------
ruiu wrote:
> 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.
I agree the for loop is more readable, and it's a real shame that all the nice functional programming idioms are so ugly in C++. Will fix.


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


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