[PATCH] D43097: [WebAssembly] Allow for the creation of user-defined custom sections
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Thu Mar 8 13:56:19 PST 2018
sbc100 added inline comments.
================
Comment at: lib/MC/WasmObjectWriter.cpp:234
void startSection(SectionBookkeeping &Section, unsigned SectionId,
- const char *Name = nullptr);
+ Optional<StringRef> Name = Optional<StringRef>());
void endSection(SectionBookkeeping &Section);
----------------
This seems like it makes the code more complex than it needs to be.
If you must change it from `char*` how about just `StringRef Name = ""` and use `Name.empty()` to check for its presence?
Is ths part of the change needed for the new feature?
================
Comment at: lib/MC/WasmObjectWriter.cpp:1077
+ StringRef UserName = Section.getSectionName().substr(16);
+ const SmallVectorImpl<char> &Contents = DataFrag.getContents();
+ CustomSections.push_back(WasmCustomSection(UserName, Contents));
----------------
Use ArrayRef<char>, here and in WasmCustomSection?
Repository:
rL LLVM
https://reviews.llvm.org/D43097
More information about the llvm-commits
mailing list