forked from OSchip/llvm-project
[WebAssembly] Refactor InputChunk.getSize(). NFC
Also, remove trailing semicolons. Patch by Nicholas Wilson! llvm-svn: 322726
This commit is contained in:
parent
c4526fc5af
commit
fc0723c73f
|
@ -34,7 +34,7 @@ class OutputSegment;
|
||||||
|
|
||||||
class InputChunk {
|
class InputChunk {
|
||||||
public:
|
public:
|
||||||
virtual uint32_t getSize() const = 0;
|
uint32_t getSize() const { return data().size(); }
|
||||||
|
|
||||||
void copyRelocations(const WasmSection &Section);
|
void copyRelocations(const WasmSection &Section);
|
||||||
|
|
||||||
|
@ -88,7 +88,6 @@ public:
|
||||||
OutputSegmentOffset = Offset;
|
OutputSegmentOffset = Offset;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t getSize() const override { return Segment.Data.Content.size(); }
|
|
||||||
uint32_t getAlignment() const { return Segment.Data.Alignment; }
|
uint32_t getAlignment() const { return Segment.Data.Alignment; }
|
||||||
uint32_t startVA() const { return Segment.Data.Offset.Value.Int32; }
|
uint32_t startVA() const { return Segment.Data.Offset.Value.Int32; }
|
||||||
uint32_t endVA() const { return startVA() + getSize(); }
|
uint32_t endVA() const { return startVA() + getSize(); }
|
||||||
|
@ -115,10 +114,9 @@ public:
|
||||||
const ObjFile *F)
|
const ObjFile *F)
|
||||||
: InputChunk(F), Signature(S), WrittenToNameSec(false), Function(Func) {}
|
: InputChunk(F), Signature(S), WrittenToNameSec(false), Function(Func) {}
|
||||||
|
|
||||||
uint32_t getSize() const override { return Function->Size; }
|
|
||||||
StringRef getComdat() const override { return Function->Comdat; }
|
StringRef getComdat() const override { return Function->Comdat; }
|
||||||
uint32_t getOutputIndex() const { return OutputIndex.getValue(); };
|
uint32_t getOutputIndex() const { return OutputIndex.getValue(); }
|
||||||
bool hasOutputIndex() const { return OutputIndex.hasValue(); };
|
bool hasOutputIndex() const { return OutputIndex.hasValue(); }
|
||||||
void setOutputIndex(uint32_t Index);
|
void setOutputIndex(uint32_t Index);
|
||||||
|
|
||||||
const WasmSignature &Signature;
|
const WasmSignature &Signature;
|
||||||
|
@ -127,7 +125,8 @@ public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ArrayRef<uint8_t> data() const override {
|
ArrayRef<uint8_t> data() const override {
|
||||||
return File->CodeSection->Content.slice(getInputSectionOffset(), getSize());
|
return File->CodeSection->Content.slice(getInputSectionOffset(),
|
||||||
|
Function->Size);
|
||||||
}
|
}
|
||||||
uint32_t getInputSectionOffset() const override {
|
uint32_t getInputSectionOffset() const override {
|
||||||
return Function->CodeSectionOffset;
|
return Function->CodeSectionOffset;
|
||||||
|
@ -142,8 +141,6 @@ public:
|
||||||
SyntheticFunction(const WasmSignature &S, ArrayRef<uint8_t> Body)
|
SyntheticFunction(const WasmSignature &S, ArrayRef<uint8_t> Body)
|
||||||
: InputFunction(S, nullptr, nullptr), Body(Body) {}
|
: InputFunction(S, nullptr, nullptr), Body(Body) {}
|
||||||
|
|
||||||
uint32_t getSize() const override { return Body.size(); }
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
ArrayRef<uint8_t> data() const override { return Body; }
|
ArrayRef<uint8_t> data() const override { return Body; }
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue