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

We already have isa<> for this, and these methods were simply
duplicating those redundantly.

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

llvm-svn: 325418
This commit is contained in:
Sam Clegg 2018-02-17 00:44:21 +00:00
parent 0bcdd399e7
commit caca8d5db3
4 changed files with 4 additions and 11 deletions

View File

@ -86,9 +86,9 @@ static void checkSymbolTypes(const Symbol &Existing, const InputFile &F,
// 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;

View File

@ -100,7 +100,6 @@ void FunctionSymbol::setTableIndex(uint32_t Index) {
}
uint32_t DefinedGlobal::getVirtualAddress() const {
assert(isGlobal());
DEBUG(dbgs() << "getVirtualAddress: " << getName() << "\n");
return Chunk ? dyn_cast<InputSegment>(Chunk)->translateVA(VirtualAddress)
: VirtualAddress;
@ -108,7 +107,6 @@ uint32_t DefinedGlobal::getVirtualAddress() const {
void DefinedGlobal::setVirtualAddress(uint32_t Value) {
DEBUG(dbgs() << "setVirtualAddress " << Name << " -> " << Value << "\n");
assert(isGlobal());
VirtualAddress = Value;
}

View File

@ -49,11 +49,6 @@ public:
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;

View File

@ -290,7 +290,7 @@ void Writer::createExportSection() {
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 @@ void Writer::calculateExports() {
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;