[clang] [clang] model WASM alloca addrspaces in Sema (PR #197540)

Demetrius Kanios via cfe-commits cfe-commits at lists.llvm.org
Wed May 13 12:54:39 PDT 2026


================
@@ -89,13 +89,13 @@ __externref_t func(__externref_t ref) {
   // cpp-error at +1 {{no matching function for call to 'illegal_argument_1'}}
   illegal_argument_1(table);
   varargs(1, table);              // expected-error {{cannot use WebAssembly table as a function parameter}}
-  table == 1;                     // expected-error {{invalid operands to binary expression ('__attribute__((address_space(1))) __externref_t[0]' and 'int')}}
-  1 >= table;                     // expected-error {{invalid operands to binary expression ('int' and '__attribute__((address_space(1))) __externref_t[0]')}}
-  table == other_table;           // expected-error {{invalid operands to binary expression ('__attribute__((address_space(1))) __externref_t[0]' and '__attribute__((address_space(1))) __externref_t[0]')}}
-  table !=- table;                // expected-error {{invalid argument type '__attribute__((address_space(1))) __externref_t *' to unary expression}}
-  !table;                         // expected-error {{invalid argument type '__attribute__((address_space(1))) __externref_t *' to unary expression}}
-  1 && table;                     // expected-error {{invalid operands to binary expression ('int' and '__attribute__((address_space(1))) __externref_t[0]')}}
-  table || 1;                     // expected-error {{invalid operands to binary expression ('__attribute__((address_space(1))) __externref_t[0]' and 'int')}}
+  table == 1;                     // expected-error {{invalid operands to binary expression ('__externref __externref_t[0]' and 'int')}}
----------------
QuantumSegfault wrote:

Yeah, I this shouldn't be `__externref` but perhaps `__wasm_var` (which covers both globals and locals).

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


More information about the cfe-commits mailing list