[lld] r319876 - [WebAssembly] Remove wasm/Strings.cpp+h

Sam Clegg via llvm-commits llvm-commits at lists.llvm.org
Tue Dec 5 19:10:39 PST 2017


Author: sbc
Date: Tue Dec  5 19:10:39 2017
New Revision: 319876

URL: http://llvm.org/viewvc/llvm-project?rev=319876&view=rev
Log:
[WebAssembly] Remove wasm/Strings.cpp+h

This file contained only a single function that was only
really needed in one place, so just inline it.

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

Removed:
    lld/trunk/wasm/Strings.cpp
    lld/trunk/wasm/Strings.h
Modified:
    lld/trunk/wasm/CMakeLists.txt
    lld/trunk/wasm/InputFiles.cpp
    lld/trunk/wasm/SymbolTable.cpp
    lld/trunk/wasm/Symbols.cpp

Modified: lld/trunk/wasm/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/CMakeLists.txt?rev=319876&r1=319875&r2=319876&view=diff
==============================================================================
--- lld/trunk/wasm/CMakeLists.txt (original)
+++ lld/trunk/wasm/CMakeLists.txt Tue Dec  5 19:10:39 2017
@@ -7,7 +7,6 @@ add_lld_library(lldWasm
   InputFiles.cpp
   InputSegment.cpp
   OutputSections.cpp
-  Strings.cpp
   SymbolTable.cpp
   Symbols.cpp
   Writer.cpp

Modified: lld/trunk/wasm/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/InputFiles.cpp?rev=319876&r1=319875&r2=319876&view=diff
==============================================================================
--- lld/trunk/wasm/InputFiles.cpp (original)
+++ lld/trunk/wasm/InputFiles.cpp Tue Dec  5 19:10:39 2017
@@ -11,7 +11,6 @@
 
 #include "Config.h"
 #include "InputSegment.h"
-#include "Strings.h"
 #include "SymbolTable.h"
 #include "lld/Common/ErrorHandler.h"
 #include "lld/Common/Memory.h"
@@ -245,7 +244,7 @@ void ArchiveFile::addMember(const Archiv
   if (!Seen.insert(C.getChildOffset()).second)
     return;
 
-  DEBUG(dbgs() << "loading lazy: " << displayName(Sym->getName()) << "\n");
+  DEBUG(dbgs() << "loading lazy: " << Sym->getName() << "\n");
   DEBUG(dbgs() << "from archive: " << toString(this) << "\n");
 
   MemoryBufferRef MB =

Removed: lld/trunk/wasm/Strings.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Strings.cpp?rev=319875&view=auto
==============================================================================
--- lld/trunk/wasm/Strings.cpp (original)
+++ lld/trunk/wasm/Strings.cpp (removed)
@@ -1,22 +0,0 @@
-//===- Strings.cpp -------------------------------------------------------===//
-//
-//                             The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#include "Strings.h"
-#include "Config.h"
-#include "lld/Common/Strings.h"
-#include "llvm/ADT/StringRef.h"
-
-using namespace llvm;
-
-std::string lld::wasm::displayName(StringRef Name) {
-  if (Config->Demangle)
-    if (Optional<std::string> S = demangleItanium(Name))
-      return "`" + *S + "'";
-  return Name;
-}

Removed: lld/trunk/wasm/Strings.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Strings.h?rev=319875&view=auto
==============================================================================
--- lld/trunk/wasm/Strings.h (original)
+++ lld/trunk/wasm/Strings.h (removed)
@@ -1,25 +0,0 @@
-//===- Strings.h ------------------------------------------------*- C++ -*-===//
-//
-//                             The LLVM Linker
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
-//
-//===----------------------------------------------------------------------===//
-
-#ifndef LLD_WASM_STRINGS_H
-#define LLD_WASM_STRINGS_H
-
-#include "llvm/ADT/Optional.h"
-#include "llvm/ADT/StringRef.h"
-#include <string>
-
-namespace lld {
-namespace wasm {
-
-std::string displayName(llvm::StringRef Name);
-
-} // namespace wasm
-} // namespace lld
-
-#endif

Modified: lld/trunk/wasm/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/SymbolTable.cpp?rev=319876&r1=319875&r2=319876&view=diff
==============================================================================
--- lld/trunk/wasm/SymbolTable.cpp (original)
+++ lld/trunk/wasm/SymbolTable.cpp Tue Dec  5 19:10:39 2017
@@ -10,7 +10,6 @@
 #include "SymbolTable.h"
 
 #include "Config.h"
-#include "Strings.h"
 #include "WriterUtils.h"
 #include "lld/Common/ErrorHandler.h"
 #include "lld/Common/Memory.h"
@@ -201,7 +200,7 @@ Symbol *SymbolTable::addUndefinedFunctio
 }
 
 Symbol *SymbolTable::addUndefined(InputFile *F, const WasmSymbol *Sym) {
-  DEBUG(dbgs() << "addUndefined: " << displayName(Sym->Name) << "\n");
+  DEBUG(dbgs() << "addUndefined: " << Sym->Name << "\n");
   Symbol *S;
   bool WasInserted;
   Symbol::Kind Kind = Symbol::UndefinedFunctionKind;
@@ -225,7 +224,7 @@ Symbol *SymbolTable::addUndefined(InputF
 }
 
 void SymbolTable::addLazy(ArchiveFile *F, const Archive::Symbol *Sym) {
-  DEBUG(dbgs() << "addLazy: " << displayName(Sym->getName()) << "\n");
+  DEBUG(dbgs() << "addLazy: " << Sym->getName() << "\n");
   StringRef Name = Sym->getName();
   Symbol *S;
   bool WasInserted;

Modified: lld/trunk/wasm/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/wasm/Symbols.cpp?rev=319876&r1=319875&r2=319876&view=diff
==============================================================================
--- lld/trunk/wasm/Symbols.cpp (original)
+++ lld/trunk/wasm/Symbols.cpp Tue Dec  5 19:10:39 2017
@@ -12,8 +12,8 @@
 #include "Config.h"
 #include "InputFiles.h"
 #include "InputSegment.h"
-#include "Strings.h"
 #include "lld/Common/ErrorHandler.h"
+#include "lld/Common/Strings.h"
 
 #define DEBUG_TYPE "lld"
 
@@ -84,7 +84,10 @@ bool Symbol::isWeak() const { return Sym
 bool Symbol::isHidden() const { return Sym && Sym->isHidden(); }
 
 std::string lld::toString(const wasm::Symbol &Sym) {
-  return wasm::displayName(Sym.getName());
+  if (Config->Demangle)
+    if (Optional<std::string> S = demangleItanium(Sym.getName()))
+      return "`" + *S + "'";
+  return Sym.getName();
 }
 
 std::string lld::toString(wasm::Symbol::Kind Kind) {




More information about the llvm-commits mailing list