[WebAssembly] Update to match llvm changes

Subscribers: dschuff, jgravelle-google, aheejin, sunfish, llvm-commits

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

llvm-svn: 332306
diff --git a/lld/test/wasm/symbol-type-mismatch.ll b/lld/test/wasm/symbol-type-mismatch.ll
index b38a219..4738c4b 100644
--- a/lld/test/wasm/symbol-type-mismatch.ll
+++ b/lld/test/wasm/symbol-type-mismatch.ll
@@ -7,5 +7,5 @@
 @ret32 = extern_weak global i32, align 4
 
 ; CHECK: error: symbol type mismatch: ret32
-; CHECK: >>> defined as Data in {{.*}}symbol-type-mismatch.ll.tmp.o
-; CHECK: >>> defined as Function in {{.*}}.ret32.o
+; CHECK: >>> defined as WASM_SYMBOL_TYPE_DATA in {{.*}}symbol-type-mismatch.ll.tmp.o
+; CHECK: >>> defined as WASM_SYMBOL_TYPE_FUNCTION in {{.*}}.ret32.o
diff --git a/lld/wasm/SymbolTable.cpp b/lld/wasm/SymbolTable.cpp
index 54e04ab..e86d82f 100644
--- a/lld/wasm/SymbolTable.cpp
+++ b/lld/wasm/SymbolTable.cpp
@@ -69,17 +69,17 @@
 }
 
 static void reportTypeError(const Symbol *Existing, const InputFile *File,
-                            StringRef Type) {
+                            llvm::wasm::WasmSymbolType Type) {
   error("symbol type mismatch: " + toString(*Existing) + "\n>>> defined as " +
         toString(Existing->getWasmType()) + " in " +
-        toString(Existing->getFile()) + "\n>>> defined as " + Type + " in " +
-        toString(File));
+        toString(Existing->getFile()) + "\n>>> defined as " + toString(Type) +
+        " in " + toString(File));
 }
 
 static void checkFunctionType(const Symbol *Existing, const InputFile *File,
                               const WasmSignature *NewSig) {
   if (!isa<FunctionSymbol>(Existing)) {
-    reportTypeError(Existing, File, "Function");
+    reportTypeError(Existing, File, WASM_SYMBOL_TYPE_FUNCTION);
     return;
   }
 
@@ -98,7 +98,7 @@
 static void checkGlobalType(const Symbol *Existing, const InputFile *File,
                             const WasmGlobalType *NewType) {
   if (!isa<GlobalSymbol>(Existing)) {
-    reportTypeError(Existing, File, "Global");
+    reportTypeError(Existing, File, WASM_SYMBOL_TYPE_GLOBAL);
     return;
   }
 
@@ -112,7 +112,7 @@
 
 static void checkDataType(const Symbol *Existing, const InputFile *File) {
   if (!isa<DataSymbol>(Existing))
-    reportTypeError(Existing, File, "Data");
+    reportTypeError(Existing, File, WASM_SYMBOL_TYPE_DATA);
 }
 
 DefinedFunction *SymbolTable::addSyntheticFunction(StringRef Name,
diff --git a/lld/wasm/Symbols.cpp b/lld/wasm/Symbols.cpp
index 1139e26..82310c4 100644
--- a/lld/wasm/Symbols.cpp
+++ b/lld/wasm/Symbols.cpp
@@ -31,13 +31,13 @@
 
 WasmSymbolType Symbol::getWasmType() const {
   if (isa<FunctionSymbol>(this))
-    return llvm::wasm::WASM_SYMBOL_TYPE_FUNCTION;
+    return WASM_SYMBOL_TYPE_FUNCTION;
   if (isa<DataSymbol>(this))
-    return llvm::wasm::WASM_SYMBOL_TYPE_DATA;
+    return WASM_SYMBOL_TYPE_DATA;
   if (isa<GlobalSymbol>(this))
-    return llvm::wasm::WASM_SYMBOL_TYPE_GLOBAL;
+    return WASM_SYMBOL_TYPE_GLOBAL;
   if (isa<SectionSymbol>(this))
-    return llvm::wasm::WASM_SYMBOL_TYPE_SECTION;
+    return WASM_SYMBOL_TYPE_SECTION;
   llvm_unreachable("invalid symbol kind");
 }
 
@@ -239,17 +239,3 @@
   }
   llvm_unreachable("invalid symbol kind");
 }
-
-std::string lld::toString(WasmSymbolType Type) {
-  switch (Type) {
-  case llvm::wasm::WASM_SYMBOL_TYPE_FUNCTION:
-    return "Function";
-  case llvm::wasm::WASM_SYMBOL_TYPE_DATA:
-    return "Data";
-  case llvm::wasm::WASM_SYMBOL_TYPE_GLOBAL:
-    return "Global";
-  case llvm::wasm::WASM_SYMBOL_TYPE_SECTION:
-    return "Section";
-  }
-  llvm_unreachable("invalid symbol type");
-}
diff --git a/lld/wasm/Symbols.h b/lld/wasm/Symbols.h
index 0fa599f..8556d32 100644
--- a/lld/wasm/Symbols.h
+++ b/lld/wasm/Symbols.h
@@ -340,7 +340,6 @@
 // Returns a symbol name for an error message.
 std::string toString(const wasm::Symbol &Sym);
 std::string toString(wasm::Symbol::Kind Kind);
-std::string toString(WasmSymbolType Type);
 
 } // namespace lld