[WebAssembly] Improve toString(OutputSection). NFC.
llvm-svn: 321146
diff --git a/lld/wasm/OutputSections.cpp b/lld/wasm/OutputSections.cpp
index 16837d8..a555382 100644
--- a/lld/wasm/OutputSections.cpp
+++ b/lld/wasm/OutputSections.cpp
@@ -63,10 +63,10 @@
}
}
-std::string lld::toString(OutputSection *Section) {
- std::string rtn = sectionTypeToString(Section->Type);
- if (!Section->Name.empty())
- rtn += "(" + Section->Name + ")";
+std::string lld::toString(const OutputSection &Section) {
+ std::string rtn = Section.getSectionName();
+ if (!Section.Name.empty())
+ rtn += "(" + Section.Name + ")";
return rtn;
}
@@ -177,11 +177,11 @@
}
}
-std::string OutputSection::getSectionName() {
+std::string OutputSection::getSectionName() const {
return sectionTypeToString(Type);
}
-std::string SubSection::getSectionName() {
+std::string SubSection::getSectionName() const {
return std::string("subsection <type=") + std::to_string(Type) + ">";
}
@@ -191,7 +191,7 @@
writeUleb128(OS, Type, nullptr);
writeUleb128(OS, BodySize, "section size");
OS.flush();
- log("createHeader: " + toString(this) + " body=" + Twine(BodySize) +
+ log("createHeader: " + toString(*this) + " body=" + Twine(BodySize) +
" total=" + Twine(getSize()));
}
@@ -222,7 +222,7 @@
}
void CodeSection::writeTo(uint8_t *Buf) {
- log("writing " + toString(this));
+ log("writing " + toString(*this));
log(" size=" + Twine(getSize()));
Buf += Offset;
@@ -303,7 +303,7 @@
}
void DataSection::writeTo(uint8_t *Buf) {
- log("writing " + toString(this) + " size=" + Twine(getSize()) +
+ log("writing " + toString(*this) + " size=" + Twine(getSize()) +
" body=" + Twine(BodySize));
Buf += Offset;