@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
}
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;
}
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;
}
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,
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");
}
}
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");
-}