diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp --- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp +++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmParser.cpp @@ -671,11 +671,12 @@ } else { // Assume this identifier is a label. const MCExpr *Val; + SMLoc Start = Id.getLoc(); SMLoc End; if (Parser.parseExpression(Val, End)) return error("Cannot parse symbol: ", Lexer.getTok()); Operands.push_back(std::make_unique( - WebAssemblyOperand::Symbol, Id.getLoc(), Id.getEndLoc(), + WebAssemblyOperand::Symbol, Start, End, WebAssemblyOperand::SymOp{Val})); if (checkForP2AlignIfLoadStore(Operands, Name)) return true; diff --git a/llvm/test/MC/WebAssembly/type-checker-errors.s b/llvm/test/MC/WebAssembly/type-checker-errors.s --- a/llvm/test/MC/WebAssembly/type-checker-errors.s +++ b/llvm/test/MC/WebAssembly/type-checker-errors.s @@ -54,8 +54,7 @@ global_get_missing_globaltype: .functype global_get_missing_globaltype () -> () -# FIXME: Error location should be at beginning of operand. -# CHECK: :[[@LINE+1]]:17: error: symbol foo missing .globaltype +# CHECK: :[[@LINE+1]]:14: error: symbol foo missing .globaltype global.get foo end_function @@ -67,8 +66,7 @@ global_set_missing_globaltype: .functype global_set_missing_globaltype () -> () -# FIXME: Error location should be at beginning of operand. -# CHECK: :[[@LINE+1]]:17: error: symbol foo missing .globaltype +# CHECK: :[[@LINE+1]]:14: error: symbol foo missing .globaltype global.set foo end_function @@ -101,8 +99,7 @@ table_get_missing_tabletype: .functype table_get_missing_tabletype () -> () -# FIXME: Error location should be at beginning of operand. -# CHECK: :[[@LINE+1]]:16: error: symbol foo missing .tabletype +# CHECK: :[[@LINE+1]]:13: error: symbol foo missing .tabletype table.get foo end_function @@ -129,8 +126,7 @@ table_set_missing_tabletype: .functype table_set_missing_tabletype () -> () -# FIXME: Error location should be at beginning ofoperand. -# CHECK: :[[@LINE+1]]:16: error: symbol foo missing .tabletype +# CHECK: :[[@LINE+1]]:13: error: symbol foo missing .tabletype table.set foo end_function @@ -170,8 +166,7 @@ table_fill_missing_tabletype: .functype table_fill_missing_tabletype () -> () -# FIXME: Error location should be at beginning of operand. -# CHECK: :[[@LINE+1]]:17: error: symbol foo missing .tabletype +# CHECK: :[[@LINE+1]]:14: error: symbol foo missing .tabletype table.fill foo end_function @@ -418,8 +413,7 @@ call_missing_functype: .functype call_missing_functype () -> () -# FIXME: Error location should be at beginning of operand. -# CHECK: :[[@LINE+1]]:19: error: symbol no_functype missing .functype +# CHECK: :[[@LINE+1]]:8: error: symbol no_functype missing .functype call no_functype end_function @@ -444,8 +438,7 @@ return_call_missing_functype: .functype return_call_missing_functype () -> () -# FIXME: Error location should be at beginning of operand. -# CHECK: :[[@LINE+1]]:26: error: symbol no_functype missing .functype +# CHECK: :[[@LINE+1]]:15: error: symbol no_functype missing .functype return_call no_functype end_function @@ -460,8 +453,7 @@ catch_missing_tagtype: .functype catch_missing_tagtype () -> () try -# FIXME: Error location should be at beginning of operand. -# CHECK: :[[@LINE+1]]:19: error: symbol no_tagtype missing .tagtype +# CHECK: :[[@LINE+1]]:9: error: symbol no_tagtype missing .tagtype catch no_tagtype end_try end_function