[clang] [clang] Improve diagnostics for constraints of inline asm (NFC) (PR #96363)
via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 24 04:13:54 PDT 2024
================
@@ -309,6 +309,39 @@ def err_asm_invalid_type : Error<
def err_ms_asm_bitfield_unsupported : Error<
"an inline asm block cannot have an operand which is a bit-field">;
+def asm_invalid_constraint_generic : TextSubstitution<
+ "invalid %select{input|output}0 constraint '%1' in asm">;
+def err_asm_invalid_constraint : Error<
+ "%sub{asm_invalid_constraint_generic}0,1">;
+def err_asm_invalid_constraint_start : Error<
+ "%sub{asm_invalid_constraint_generic}0,1: output constraint must start with"
+ " '=' or '+'">;
+def err_asm_invalid_constraint_rw_clobber : Error<
+ "%sub{asm_invalid_constraint_generic}0,1: early clobber with a read-write"
+ " constraint must be a register">;
+def err_asm_invalid_constraint_mem_or_reg : Error<
+ "%sub{asm_invalid_constraint_generic}0,1: constraint must allow either"
+ " memory or register operands">;
+def err_asm_invalid_constraint_missing_bracket : Error<
+ "%sub{asm_invalid_constraint_generic}0,1: missing ']'">;
+def err_asm_invalid_constraint_wrong_symbol : Error<
+ "%sub{asm_invalid_constraint_generic}0,1: cannot find an output constraint"
+ " with the specified name">;
----------------
Sirraide wrote:
```suggestion
"%sub{asm_invalid_constraint_generic}0,1: no matching output constraint">;
```
There has to be a corresponding output constraint with the same name as I understand it? This confused me a bit just now while I was looking at the tests, so maybe something like this would make that a bit clearer?
https://github.com/llvm/llvm-project/pull/96363
More information about the cfe-commits
mailing list