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

Rui Ueyama via llvm-commits llvm-commits at lists.llvm.org
Fri Mar 9 14:59:35 PST 2018


Author: ruiu
Date: Fri Mar  9 14:59:34 2018
New Revision: 327182

URL: http://llvm.org/viewvc/llvm-project?rev=327182&view=rev
Log:
[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

Modified:
    lld/trunk/wasm/Driver.cpp
    lld/trunk/wasm/Symbols.cpp
    lld/trunk/wasm/Symbols.h

Modified: lld/trunk/wasm/Driver.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Driver.cpp?rev=327182&r1=327181&r2=327182&view=diff
==============================================================================
--- lld/trunk/wasm/Driver.cpp (original)
+++ lld/trunk/wasm/Driver.cpp Fri Mar  9 14:59:34 2018
@@ -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

Modified: lld/trunk/wasm/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Symbols.cpp?rev=327182&r1=327181&r2=327182&view=diff
==============================================================================
--- lld/trunk/wasm/Symbols.cpp (original)
+++ lld/trunk/wasm/Symbols.cpp Fri Mar  9 14:59:34 2018
@@ -180,10 +180,10 @@ DefinedGlobal::DefinedGlobal(StringRef N
 
 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();
 }
 

Modified: lld/trunk/wasm/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Symbols.h?rev=327182&r1=327181&r2=327182&view=diff
==============================================================================
--- lld/trunk/wasm/Symbols.h (original)
+++ lld/trunk/wasm/Symbols.h Fri Mar  9 14:59:34 2018
@@ -312,7 +312,7 @@ T *replaceSymbol(Symbol *S, ArgT &&... A
 } // 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);
 




More information about the llvm-commits mailing list