[llvm] [WebAssembly] Add a colon to type error message (PR #107980)

via llvm-commits llvm-commits at lists.llvm.org
Tue Sep 10 01:02:41 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mc

Author: Heejin Ahn (aheejin)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/107980.diff


2 Files Affected:

- (modified) llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp (+4-4) 
- (modified) llvm/test/MC/WebAssembly/type-checker-errors.s (+9-9) 


``````````diff
diff --git a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
index f81f4556a00a14..9f9e7d1c0ed066 100644
--- a/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
+++ b/llvm/lib/Target/WebAssembly/AsmParser/WebAssemblyAsmTypeCheck.cpp
@@ -212,7 +212,7 @@ bool WebAssemblyAsmTypeCheck::getGlobal(SMLoc ErrorLoc, const MCInst &Inst,
     [[fallthrough]];
   default:
     return typeError(ErrorLoc, StringRef("symbol ") + WasmSym->getName() +
-                                   " missing .globaltype");
+                                   ": missing .globaltype");
   }
   return false;
 }
@@ -226,7 +226,7 @@ bool WebAssemblyAsmTypeCheck::getTable(SMLoc ErrorLoc, const MCInst &Inst,
   if (WasmSym->getType().value_or(wasm::WASM_SYMBOL_TYPE_DATA) !=
       wasm::WASM_SYMBOL_TYPE_TABLE)
     return typeError(ErrorLoc, StringRef("symbol ") + WasmSym->getName() +
-                                   " missing .tabletype");
+                                   ": missing .tabletype");
   Type = static_cast<wasm::ValType>(WasmSym->getTableType().ElemType);
   return false;
 }
@@ -360,7 +360,7 @@ bool WebAssemblyAsmTypeCheck::typeCheck(SMLoc ErrorLoc, const MCInst &Inst,
       if (!Sig || WasmSym->getType() != wasm::WASM_SYMBOL_TYPE_TAG)
         return typeError(Operands[1]->getStartLoc(), StringRef("symbol ") +
                                                          WasmSym->getName() +
-                                                         " missing .tagtype");
+                                                         ": missing .tagtype");
       // catch instruction pushes values whose types are specified in the tag's
       // "params" part
       Stack.insert(Stack.end(), Sig->Params.begin(), Sig->Params.end());
@@ -391,7 +391,7 @@ bool WebAssemblyAsmTypeCheck::typeCheck(SMLoc ErrorLoc, const MCInst &Inst,
     if (!Sig || WasmSym->getType() != wasm::WASM_SYMBOL_TYPE_FUNCTION)
       return typeError(Operands[1]->getStartLoc(), StringRef("symbol ") +
                                                        WasmSym->getName() +
-                                                       " missing .functype");
+                                                       ": missing .functype");
     if (checkSig(ErrorLoc, *Sig))
       return true;
     if (Name == "return_call" && endOfFunction(ErrorLoc))
diff --git a/llvm/test/MC/WebAssembly/type-checker-errors.s b/llvm/test/MC/WebAssembly/type-checker-errors.s
index d2841250137a8c..e8b8274036a832 100644
--- a/llvm/test/MC/WebAssembly/type-checker-errors.s
+++ b/llvm/test/MC/WebAssembly/type-checker-errors.s
@@ -54,7 +54,7 @@ local_tee_type_mismatch:
 
 global_get_missing_globaltype:
   .functype global_get_missing_globaltype () -> ()
-# CHECK: :[[@LINE+1]]:14: error: symbol foo missing .globaltype
+# CHECK: :[[@LINE+1]]:14: error: symbol foo: missing .globaltype
   global.get foo
   end_function
 
@@ -66,7 +66,7 @@ global_get_expected_expression_operand:
 
 global_set_missing_globaltype:
   .functype global_set_missing_globaltype () -> ()
-# CHECK: :[[@LINE+1]]:14: error: symbol foo missing .globaltype
+# CHECK: :[[@LINE+1]]:14: error: symbol foo: missing .globaltype
   global.set foo
   end_function
 
@@ -99,7 +99,7 @@ table_get_expected_expression_operand:
 
 table_get_missing_tabletype:
   .functype table_get_missing_tabletype () -> ()
-# CHECK: :[[@LINE+1]]:13: error: symbol foo missing .tabletype
+# CHECK: :[[@LINE+1]]:13: error: symbol foo: missing .tabletype
   table.get foo
   end_function
 
@@ -126,7 +126,7 @@ table_set_expected_expression_operand:
 
 table_set_missing_tabletype:
   .functype table_set_missing_tabletype () -> ()
-# CHECK: :[[@LINE+1]]:13: error: symbol foo missing .tabletype
+# CHECK: :[[@LINE+1]]:13: error: symbol foo: missing .tabletype
   table.set foo
   end_function
 
@@ -166,7 +166,7 @@ table_fill_expected_expression_operand:
 
 table_fill_missing_tabletype:
   .functype table_fill_missing_tabletype () -> ()
-# CHECK: :[[@LINE+1]]:14: error: symbol foo missing .tabletype
+# CHECK: :[[@LINE+1]]:14: error: symbol foo: missing .tabletype
   table.fill foo
   end_function
 
@@ -235,7 +235,7 @@ table_grow_non_exist_table:
   .functype table_grow_non_exist_table (externref, i32) -> (i32)
   local.get 0
   local.get 1
-# CHECK: [[@LINE+1]]:14: error: symbol invalid_table missing .tabletype
+# CHECK: [[@LINE+1]]:14: error: symbol invalid_table: missing .tabletype
   table.grow invalid_table
   end_function
 
@@ -554,7 +554,7 @@ call_superfluous_value_at_end:
 
 call_missing_functype:
   .functype call_missing_functype () -> ()
-# CHECK: :[[@LINE+1]]:8: error: symbol no_functype missing .functype
+# CHECK: :[[@LINE+1]]:8: error: symbol no_functype: missing .functype
   call no_functype
   end_function
 
@@ -579,7 +579,7 @@ return_call_type_mismatch:
 
 return_call_missing_functype:
   .functype return_call_missing_functype () -> ()
-# CHECK: :[[@LINE+1]]:15: error: symbol no_functype missing .functype
+# CHECK: :[[@LINE+1]]:15: error: symbol no_functype: missing .functype
   return_call no_functype
   end_function
 
@@ -594,7 +594,7 @@ catch_expected_expression_operand:
 catch_missing_tagtype:
   .functype catch_missing_tagtype () -> ()
   try
-# CHECK: :[[@LINE+1]]:9: error: symbol no_tagtype missing .tagtype
+# CHECK: :[[@LINE+1]]:9: error: symbol no_tagtype: missing .tagtype
   catch no_tagtype
   end_try
   end_function

``````````

</details>


https://github.com/llvm/llvm-project/pull/107980


More information about the llvm-commits mailing list