[PATCH] D42626: [WebAssembly] Add getName and getFileName methods to InputChunk base class. NFC.
Sam Clegg via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Sun Jan 28 11:49:25 PST 2018
sbc100 created this revision.
Herald added subscribers: llvm-commits, sunfish, aheejin, jgravelle-google, dschuff, jfb.
sbc100 edited the summary of this revision.
These are useful to upcoming addition of --gc-sections support.
The InputFunction subclass already added this method anyway so
this change just makes it a little more general.
Repository:
rLLD LLVM Linker
https://reviews.llvm.org/D42626
Files:
wasm/InputChunks.cpp
wasm/InputChunks.h
Index: wasm/InputChunks.h
===================================================================
--- wasm/InputChunks.h
+++ wasm/InputChunks.h
@@ -51,8 +51,10 @@
uint32_t getOutputOffset() const { return OutputOffset; }
ArrayRef<WasmRelocation> getRelocations() const { return Relocations; }
+ StringRef getFileName() const { return File->getName(); }
virtual StringRef getComdat() const = 0;
+ virtual StringRef getName() const = 0;
bool Discarded = false;
std::vector<OutputRelocation> OutRelocations;
@@ -99,7 +101,7 @@
uint32_t getAlignment() const { return Segment.Data.Alignment; }
uint32_t startVA() const { return Segment.Data.Offset.Value.Int32; }
uint32_t endVA() const { return startVA() + getSize(); }
- StringRef getName() const { return Segment.Data.Name; }
+ StringRef getName() const override { return Segment.Data.Name; }
StringRef getComdat() const override { return Segment.Data.Comdat; }
int32_t OutputSegmentOffset = 0;
@@ -126,7 +128,7 @@
return C->kind() == InputChunk::Function;
}
- virtual StringRef getName() const { return Function->Name; }
+ StringRef getName() const override { return Function->Name; }
StringRef getComdat() const override { return Function->Comdat; }
uint32_t getOutputIndex() const { return OutputIndex.getValue(); }
bool hasOutputIndex() const { return OutputIndex.hasValue(); }
Index: wasm/InputChunks.cpp
===================================================================
--- wasm/InputChunks.cpp
+++ wasm/InputChunks.cpp
@@ -113,13 +113,13 @@
}
void InputFunction::setOutputIndex(uint32_t Index) {
- DEBUG(dbgs() << "InputFunction::setOutputIndex: " << Index << "\n");
+ DEBUG(dbgs() << "InputFunction::setOutputIndex: " << getName() << " -> " << Index << "\n");
assert(!hasOutputIndex());
OutputIndex = Index;
}
void InputFunction::setTableIndex(uint32_t Index) {
- DEBUG(dbgs() << "InputFunction::setTableIndex " << Index << "\n");
+ DEBUG(dbgs() << "InputFunction::setTableIndex: " << getName() << " -> " << Index << "\n");
assert(!hasTableIndex());
TableIndex = Index;
}
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D42626.131715.patch
Type: text/x-patch
Size: 2113 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180128/b8765b40/attachment.bin>
More information about the llvm-commits
mailing list