[PATCH] D46977: [NFC] WebAssembly build fix
JF Bastien via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Wed May 16 14:28:30 PDT 2018
jfb created this revision.
jfb added reviewers: sbc100, ncw, paquette.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff.
jfb accepted this revision.
jfb added a comment.
This revision is now accepted and ready to land.
Seems like a no-brainer, I'll commit.
r332305 added a use of llvm::wasm::toString in llvm::object::WasmSymbol::print,
which is in a header file. It also moves toString to BinaryFormat. This has the
unintended side-effect that any inclusion of Object/Wasm.h now relies on
toString, and needs to required_libraries = BinaryFormat. Thankfully most builds
don't fail with this because print just isn't used and gets eliminated, dropping
the required dependency in the process. Not all builds are so lucky.
Fix this issue by moving print to the corresponding .cpp file.
rdar://problem/40258137
Repository:
rL LLVM
https://reviews.llvm.org/D46977
Files:
include/llvm/Object/Wasm.h
lib/Object/WasmObjectFile.cpp
Index: lib/Object/WasmObjectFile.cpp
===================================================================
--- lib/Object/WasmObjectFile.cpp
+++ lib/Object/WasmObjectFile.cpp
@@ -35,6 +35,19 @@
using namespace llvm;
using namespace object;
+void WasmSymbol::print(raw_ostream &Out) const {
+ Out << "Name=" << Info.Name
+ << ", Kind=" << toString(wasm::WasmSymbolType(Info.Kind))
+ << ", Flags=" << Info.Flags;
+ if (!isTypeData()) {
+ Out << ", ElemIndex=" << Info.ElementIndex;
+ } else if (isDefined()) {
+ Out << ", Segment=" << Info.DataRef.Segment;
+ Out << ", Offset=" << Info.DataRef.Offset;
+ Out << ", Size=" << Info.DataRef.Size;
+ }
+}
+
Expected<std::unique_ptr<WasmObjectFile>>
ObjectFile::createWasmObjectFile(MemoryBufferRef Buffer) {
Error Err = Error::success();
Index: include/llvm/Object/Wasm.h
===================================================================
--- include/llvm/Object/Wasm.h
+++ include/llvm/Object/Wasm.h
@@ -88,18 +88,7 @@
return Info.Flags & wasm::WASM_SYMBOL_VISIBILITY_MASK;
}
- void print(raw_ostream &Out) const {
- Out << "Name=" << Info.Name
- << ", Kind=" << toString(wasm::WasmSymbolType(Info.Kind))
- << ", Flags=" << Info.Flags;
- if (!isTypeData()) {
- Out << ", ElemIndex=" << Info.ElementIndex;
- } else if (isDefined()) {
- Out << ", Segment=" << Info.DataRef.Segment;
- Out << ", Offset=" << Info.DataRef.Offset;
- Out << ", Size=" << Info.DataRef.Size;
- }
- }
+ void print(raw_ostream &Out) const;
#if !defined(NDEBUG) || defined(LLVM_ENABLE_DUMP)
LLVM_DUMP_METHOD void dump() const { print(dbgs()); }
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D46977.147180.patch
Type: text/x-patch
Size: 1651 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180516/d6e39d69/attachment.bin>
More information about the llvm-commits
mailing list