[PATCH] D43717: [WebAssembly] Make getWasmType a non-member function.

Rui Ueyama via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 27 17:13:02 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rLLD326293: [WebAssembly] Simplify Symbol::getWasmType. NFC. (authored by ruiu, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D43717?vs=136201&id=136202#toc

Repository:
  rLLD LLVM Linker

https://reviews.llvm.org/D43717

Files:
  wasm/Symbols.cpp


Index: wasm/Symbols.cpp
===================================================================
--- wasm/Symbols.cpp
+++ wasm/Symbols.cpp
@@ -30,19 +30,13 @@
 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 {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43717.136202.patch
Type: text/x-patch
Size: 876 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180228/352df9e2/attachment.bin>


More information about the llvm-commits mailing list