[WebAssembly] Simplify Symbol::getWasmType. NFC.
authorRui Ueyama <ruiu@google.com>
Wed, 28 Feb 2018 01:10:50 +0000 (01:10 +0000)
committerRui Ueyama <ruiu@google.com>
Wed, 28 Feb 2018 01:10:50 +0000 (01:10 +0000)
Differential Revision: https://reviews.llvm.org/D43717

llvm-svn: 326293

lld/wasm/Symbols.cpp

index 7f3775c..f968c9d 100644 (file)
@@ -30,19 +30,13 @@ DefinedData *WasmSym::HeapBase;
 DefinedGlobal *WasmSym::StackPointer;
 
 WasmSymbolType Symbol::getWasmType() const {
-  switch (SymbolKind) {
-  case Symbol::DefinedFunctionKind:
-  case Symbol::UndefinedFunctionKind:
+  if (isa<FunctionSymbol>(this))
     return llvm::wasm::WASM_SYMBOL_TYPE_FUNCTION;
-  case Symbol::DefinedDataKind:
-  case Symbol::UndefinedDataKind:
+  if (isa<DataSymbol>(this))
     return llvm::wasm::WASM_SYMBOL_TYPE_DATA;
-  case Symbol::DefinedGlobalKind:
-  case Symbol::UndefinedGlobalKind:
+  if (isa<GlobalSymbol>(this))
     return llvm::wasm::WASM_SYMBOL_TYPE_GLOBAL;
-  default:
-    llvm_unreachable("invalid symbol kind");
-  }
+  llvm_unreachable("invalid symbol kind");
 }
 
 bool Symbol::hasOutputIndex() const {