[PATCH] D43422: [WebAssembly] Remove unneeded classifer methods from Symbol class. NFC.

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 16 16:46:19 PST 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL325418: [WebAssembly] Remove unneeded classifer methods from Symbol class. NFC. (authored by sbc, committed by ).

Repository:
  rL LLVM

https://reviews.llvm.org/D43422

Files:
  lld/trunk/wasm/SymbolTable.cpp
  lld/trunk/wasm/Symbols.cpp
  lld/trunk/wasm/Symbols.h
  lld/trunk/wasm/Writer.cpp


Index: lld/trunk/wasm/Symbols.cpp
===================================================================
--- lld/trunk/wasm/Symbols.cpp
+++ lld/trunk/wasm/Symbols.cpp
@@ -100,15 +100,13 @@
 }
 
 uint32_t DefinedGlobal::getVirtualAddress() const {
-  assert(isGlobal());
   DEBUG(dbgs() << "getVirtualAddress: " << getName() << "\n");
   return Chunk ? dyn_cast<InputSegment>(Chunk)->translateVA(VirtualAddress)
                : VirtualAddress;
 }
 
 void DefinedGlobal::setVirtualAddress(uint32_t Value) {
   DEBUG(dbgs() << "setVirtualAddress " << Name << " -> " << Value << "\n");
-  assert(isGlobal());
   VirtualAddress = Value;
 }
 
Index: lld/trunk/wasm/SymbolTable.cpp
===================================================================
--- lld/trunk/wasm/SymbolTable.cpp
+++ lld/trunk/wasm/SymbolTable.cpp
@@ -86,9 +86,9 @@
 
   // First check the symbol types match (i.e. either both are function
   // symbols or both are data symbols).
-  if (Existing.isFunction() != NewIsFunction) {
+  if (isa<FunctionSymbol>(Existing) != NewIsFunction) {
     error("symbol type mismatch: " + Existing.getName() + "\n>>> defined as " +
-          (Existing.isFunction() ? "Function" : "Global") + " in " +
+          (isa<FunctionSymbol>(Existing) ? "Function" : "Global") + " in " +
           toString(Existing.getFile()) + "\n>>> defined as " +
           (NewIsFunction ? "Function" : "Global") + " in " + F.getName());
     return;
Index: lld/trunk/wasm/Writer.cpp
===================================================================
--- lld/trunk/wasm/Writer.cpp
+++ lld/trunk/wasm/Writer.cpp
@@ -290,7 +290,7 @@
     WasmExport Export;
     Export.Name = E.FieldName;
     Export.Index = E.Sym->getOutputIndex();
-    if (E.Sym->isFunction())
+    if (isa<FunctionSymbol>(E.Sym))
       Export.Kind = WASM_EXTERNAL_FUNCTION;
     else
       Export.Kind = WASM_EXTERNAL_GLOBAL;
@@ -660,7 +660,7 @@
     for (Symbol *Sym : File->getSymbols()) {
       if (!Sym->isDefined() || File != Sym->getFile())
         continue;
-      if (Sym->isGlobal())
+      if (isa<GlobalSymbol>(Sym))
         continue;
       if (!Sym->getChunk()->Live)
         continue;
Index: lld/trunk/wasm/Symbols.h
===================================================================
--- lld/trunk/wasm/Symbols.h
+++ lld/trunk/wasm/Symbols.h
@@ -49,11 +49,6 @@
     return SymbolKind == UndefinedGlobalKind ||
            SymbolKind == UndefinedFunctionKind;
   }
-  bool isFunction() const {
-    return SymbolKind == DefinedFunctionKind ||
-           SymbolKind == UndefinedFunctionKind;
-  }
-  bool isGlobal() const { return !isFunction(); }
   bool isLocal() const;
   bool isWeak() const;
   bool isHidden() const;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D43422.134773.patch
Type: text/x-patch
Size: 2695 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180217/1a6bb61a/attachment.bin>


More information about the llvm-commits mailing list