Skip to content

Commit c8ed2b8

Browse files
authored
[WebAssembly] Add a colon to type error message (#107980)
1 parent 90e8411 commit c8ed2b8

File tree

2 files changed

+13
-13
lines changed

2 files changed

+13
-13
lines changed

llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ bool WebAssemblyAsmTypeCheck::getGlobal(SMLoc ErrorLoc, const MCInst &Inst,
212212
[[fallthrough]];
213213
default:
214214
return typeError(ErrorLoc, StringRef("symbol ") + WasmSym->getName() +
215-
" missing .globaltype");
215+
": missing .globaltype");
216216
}
217217
return false;
218218
}
@@ -226,7 +226,7 @@ bool WebAssemblyAsmTypeCheck::getTable(SMLoc ErrorLoc, const MCInst &Inst,
226226
if (WasmSym->getType().value_or(wasm::WASM_SYMBOL_TYPE_DATA) !=
227227
wasm::WASM_SYMBOL_TYPE_TABLE)
228228
return typeError(ErrorLoc, StringRef("symbol ") + WasmSym->getName() +
229-
" missing .tabletype");
229+
": missing .tabletype");
230230
Type = static_cast<wasm::ValType>(WasmSym->getTableType().ElemType);
231231
return false;
232232
}
@@ -360,7 +360,7 @@ bool WebAssemblyAsmTypeCheck::typeCheck(SMLoc ErrorLoc, const MCInst &Inst,
360360
if (!Sig || WasmSym->getType() != wasm::WASM_SYMBOL_TYPE_TAG)
361361
return typeError(Operands[1]->getStartLoc(), StringRef("symbol ") +
362362
WasmSym->getName() +
363-
" missing .tagtype");
363+
": missing .tagtype");
364364
// catch instruction pushes values whose types are specified in the tag's
365365
// "params" part
366366
Stack.insert(Stack.end(), Sig->Params.begin(), Sig->Params.end());
@@ -391,7 +391,7 @@ bool WebAssemblyAsmTypeCheck::typeCheck(SMLoc ErrorLoc, const MCInst &Inst,
391391
if (!Sig || WasmSym->getType() != wasm::WASM_SYMBOL_TYPE_FUNCTION)
392392
return typeError(Operands[1]->getStartLoc(), StringRef("symbol ") +
393393
WasmSym->getName() +
394-
" missing .functype");
394+
": missing .functype");
395395
if (checkSig(ErrorLoc, *Sig))
396396
return true;
397397
if (Name == "return_call" && endOfFunction(ErrorLoc))

llvm/test/MC/WebAssembly/type-checker-errors.s

+9-9
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ local_tee_type_mismatch:
5454

5555
global_get_missing_globaltype:
5656
.functype global_get_missing_globaltype () -> ()
57-
# CHECK: :[[@LINE+1]]:14: error: symbol foo missing .globaltype
57+
# CHECK: :[[@LINE+1]]:14: error: symbol foo: missing .globaltype
5858
global.get foo
5959
end_function
6060

@@ -66,7 +66,7 @@ global_get_expected_expression_operand:
6666

6767
global_set_missing_globaltype:
6868
.functype global_set_missing_globaltype () -> ()
69-
# CHECK: :[[@LINE+1]]:14: error: symbol foo missing .globaltype
69+
# CHECK: :[[@LINE+1]]:14: error: symbol foo: missing .globaltype
7070
global.set foo
7171
end_function
7272

@@ -99,7 +99,7 @@ table_get_expected_expression_operand:
9999

100100
table_get_missing_tabletype:
101101
.functype table_get_missing_tabletype () -> ()
102-
# CHECK: :[[@LINE+1]]:13: error: symbol foo missing .tabletype
102+
# CHECK: :[[@LINE+1]]:13: error: symbol foo: missing .tabletype
103103
table.get foo
104104
end_function
105105

@@ -126,7 +126,7 @@ table_set_expected_expression_operand:
126126

127127
table_set_missing_tabletype:
128128
.functype table_set_missing_tabletype () -> ()
129-
# CHECK: :[[@LINE+1]]:13: error: symbol foo missing .tabletype
129+
# CHECK: :[[@LINE+1]]:13: error: symbol foo: missing .tabletype
130130
table.set foo
131131
end_function
132132

@@ -166,7 +166,7 @@ table_fill_expected_expression_operand:
166166

167167
table_fill_missing_tabletype:
168168
.functype table_fill_missing_tabletype () -> ()
169-
# CHECK: :[[@LINE+1]]:14: error: symbol foo missing .tabletype
169+
# CHECK: :[[@LINE+1]]:14: error: symbol foo: missing .tabletype
170170
table.fill foo
171171
end_function
172172

@@ -235,7 +235,7 @@ table_grow_non_exist_table:
235235
.functype table_grow_non_exist_table (externref, i32) -> (i32)
236236
local.get 0
237237
local.get 1
238-
# CHECK: [[@LINE+1]]:14: error: symbol invalid_table missing .tabletype
238+
# CHECK: [[@LINE+1]]:14: error: symbol invalid_table: missing .tabletype
239239
table.grow invalid_table
240240
end_function
241241

@@ -554,7 +554,7 @@ call_superfluous_value_at_end:
554554

555555
call_missing_functype:
556556
.functype call_missing_functype () -> ()
557-
# CHECK: :[[@LINE+1]]:8: error: symbol no_functype missing .functype
557+
# CHECK: :[[@LINE+1]]:8: error: symbol no_functype: missing .functype
558558
call no_functype
559559
end_function
560560

@@ -579,7 +579,7 @@ return_call_type_mismatch:
579579

580580
return_call_missing_functype:
581581
.functype return_call_missing_functype () -> ()
582-
# CHECK: :[[@LINE+1]]:15: error: symbol no_functype missing .functype
582+
# CHECK: :[[@LINE+1]]:15: error: symbol no_functype: missing .functype
583583
return_call no_functype
584584
end_function
585585

@@ -594,7 +594,7 @@ catch_expected_expression_operand:
594594
catch_missing_tagtype:
595595
.functype catch_missing_tagtype () -> ()
596596
try
597-
# CHECK: :[[@LINE+1]]:9: error: symbol no_tagtype missing .tagtype
597+
# CHECK: :[[@LINE+1]]:9: error: symbol no_tagtype: missing .tagtype
598598
catch no_tagtype
599599
end_try
600600
end_function

0 commit comments

Comments
 (0)