summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJF Bastien <jfb@google.com>2018-05-16 21:24:03 +0000
committerJF Bastien <jfb@google.com>2018-05-16 21:24:03 +0000
commit659932b0b2c7ec9895b34891f614970a22319c19 (patch)
tree87a523b67add92efe5ae7d7831965a0e0705c72c
parentddbf6d65146d9d4778ad8a7e31c9ea362e7fdde4 (diff)
downloadbcm5719-llvm-659932b0b2c7ec9895b34891f614970a22319c19.tar.gz
bcm5719-llvm-659932b0b2c7ec9895b34891f614970a22319c19.zip
[NFC] WebAssembly build fix
Summary: 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> Reviewers: sbc100, ncw, paquette Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits Differential Revision: https://reviews.llvm.org/D46977 llvm-svn: 332530
-rw-r--r--llvm/include/llvm/Object/Wasm.h13
-rw-r--r--llvm/lib/Object/WasmObjectFile.cpp13
2 files changed, 14 insertions, 12 deletions
diff --git a/llvm/include/llvm/Object/Wasm.h b/llvm/include/llvm/Object/Wasm.h
index 146b34af198..c9e630bccb3 100644
--- a/llvm/include/llvm/Object/Wasm.h
+++ b/llvm/include/llvm/Object/Wasm.h
@@ -88,18 +88,7 @@ public:
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()); }
diff --git a/llvm/lib/Object/WasmObjectFile.cpp b/llvm/lib/Object/WasmObjectFile.cpp
index 8b31c04a37a..388e04964b2 100644
--- a/llvm/lib/Object/WasmObjectFile.cpp
+++ b/llvm/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();
OpenPOWER on IntegriCloud