[WebAssembly] Remove a second parameter from toString().

toString(T) is a stringize function for an object of type T. Each type
that has that function defined should know how to stringize itself, and
there should be one string representation of an object. Passing a
"supplemental" argument to toString() breaks that princple. We shouldn't
add a second parameter to that function.

Differential Revision: https://reviews.llvm.org/D44323

llvm-svn: 327182
This commit is contained in:
Rui Ueyama 2018-03-09 22:59:34 +00:00
parent a9098c66bf
commit 72a9a2321f
3 changed files with 4 additions and 5 deletions

View File

@ -239,8 +239,7 @@ static void handleWeakUndefines() {
// Add a synthetic dummy for weak undefined functions. These dummies will
// be GC'd if not used as the target of any "call" instructions.
StringRef StubName =
Saver.save("undefined function " + toString(*Sym, false));
StringRef StubName = Saver.save("undefined function " + toString(*Sym));
SyntheticFunction *Func = make<SyntheticFunction>(Sig, StubName);
Func->setBody(UnreachableFn);
// Ensure it compares equal to the null pointer, and so that table relocs

View File

@ -180,10 +180,10 @@ DefinedGlobal::DefinedGlobal(StringRef Name, uint32_t Flags, InputFile *File,
void LazySymbol::fetch() { cast<ArchiveFile>(File)->addMember(&ArchiveSymbol); }
std::string lld::toString(const wasm::Symbol &Sym, bool QuoteDemangled) {
std::string lld::toString(const wasm::Symbol &Sym) {
if (Config->Demangle)
if (Optional<std::string> S = demangleItanium(Sym.getName()))
return QuoteDemangled ? ("`" + *S + "'") : *S;
return *S;
return Sym.getName();
}

View File

@ -312,7 +312,7 @@ T *replaceSymbol(Symbol *S, ArgT &&... Arg) {
} // namespace wasm
// Returns a symbol name for an error message.
std::string toString(const wasm::Symbol &Sym, bool QuoteDemangled = true);
std::string toString(const wasm::Symbol &Sym);
std::string toString(wasm::Symbol::Kind Kind);
std::string toString(WasmSymbolType Type);