[clang] [WebAssembly][Clang] Add __builtin_wasm_ref_is_null_extern (PR #139580)

2025-05-13 Thread Hood Chatham via cfe-commits
https://github.com/hoodmane updated https://github.com/llvm/llvm-project/pull/139580 >From 2ca282f0a20088bef15289a8ce5167d1e23595c3 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Fri, 9 May 2025 00:16:26 -0400 Subject: [PATCH 1/3] [Wasm][Clang] Add __builtin_wasm_ref_is_null_extern I also

[clang] [Clang] Fix Sema::checkArgCount for 0-arg functions (PR #139638)

2025-05-13 Thread Hood Chatham via cfe-commits
hoodmane wrote: CI looks green now. https://github.com/llvm/llvm-project/pull/139638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix Sema::checkArgCount for 0-arg functions (PR #139638)

2025-05-13 Thread Hood Chatham via cfe-commits
hoodmane wrote: Can somebody merge when it's appropriate? I don't have merge rights. https://github.com/llvm/llvm-project/pull/139638 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Clang] Fix Sema::checkArgCount for 0-arg functions (PR #139638)

2025-05-13 Thread Hood Chatham via cfe-commits
hoodmane wrote: > are we sure they weren't intentionally skipping diagnostic there? The behavior before was ``` error: cannot compile this scalar expression yet 2 | __externref_t ref = __builtin_wasm_ref_null_extern(0); | ^ PLEAS

[clang] [WebAssembly][Clang] Add __builtin_wasm_ref_is_null_extern (PR #139580)

2025-05-12 Thread Hood Chatham via cfe-commits
https://github.com/hoodmane edited https://github.com/llvm/llvm-project/pull/139580 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [WebAssembly][Clang] Add __builtin_wasm_ref_is_null_extern (PR #139580)

2025-05-12 Thread Hood Chatham via cfe-commits
@@ -168,7 +168,7 @@ bool Sema::checkArgCount(CallExpr *Call, unsigned DesiredArgCount) { return Diag(Range.getBegin(), diag::err_typecheck_call_too_many_args) << 0 /*function call*/ << DesiredArgCount << ArgCount - << /*is non object*/ 0 << Call->getArg(1)-

[clang] [WebAssembly][Clang] Add __builtin_wasm_ref_is_null_extern (PR #139580)

2025-05-12 Thread Hood Chatham via cfe-commits
@@ -168,7 +168,7 @@ bool Sema::checkArgCount(CallExpr *Call, unsigned DesiredArgCount) { return Diag(Range.getBegin(), diag::err_typecheck_call_too_many_args) << 0 /*function call*/ << DesiredArgCount << ArgCount - << /*is non object*/ 0 << Call->getArg(1)-

[clang] [WebAssembly][Clang] Add __builtin_wasm_ref_is_null_extern (PR #139580)

2025-05-12 Thread Hood Chatham via cfe-commits
https://github.com/hoodmane updated https://github.com/llvm/llvm-project/pull/139580 Rate limit ยท GitHub body { background-color: #f6f8fa; color: #24292e; font-family: -apple-system,BlinkMacSystemFont,Segoe UI,Helvetica,Arial,sans-

[clang] [WebAssembly][Clang] Add __builtin_wasm_ref_is_null_extern (PR #139580)

2025-05-12 Thread Hood Chatham via cfe-commits
@@ -52,14 +52,33 @@ static bool CheckWasmBuiltinArgIsInteger(Sema &S, CallExpr *E, } bool SemaWasm::BuiltinWasmRefNullExtern(CallExpr *TheCall) { - if (TheCall->getNumArgs() != 0) + if (TheCall->getNumArgs() != 0) { hoodmane wrote: Oh right, `getArg(1)` wi

[clang] [WebAssembly][Clang] Add __builtin_wasm_ref_is_null_extern (PR #139580)

2025-05-12 Thread Hood Chatham via cfe-commits
https://github.com/hoodmane edited https://github.com/llvm/llvm-project/pull/139580 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

[clang] [Wasm][Clang] Add __builtin_wasm_ref_is_null_extern (PR #139580)

2025-05-12 Thread Hood Chatham via cfe-commits
@@ -52,14 +52,33 @@ static bool CheckWasmBuiltinArgIsInteger(Sema &S, CallExpr *E, } bool SemaWasm::BuiltinWasmRefNullExtern(CallExpr *TheCall) { - if (TheCall->getNumArgs() != 0) + if (TheCall->getNumArgs() != 0) { hoodmane wrote: If a positive number of

[clang] [Wasm][Clang] Add __builtin_wasm_ref_is_null_extern (PR #139580)

2025-05-12 Thread Hood Chatham via cfe-commits
@@ -741,6 +741,12 @@ __externref_t externref_null() { // WEBASSEMBLY-NEXT: ret } +int externref_is_null(__externref_t arg) { + return __builtin_wasm_ref_is_null_extern(arg); + // WEBASSEMBLY: tail call i32 @llvm.wasm.ref.is_null.extern(ptr addrspace(10) %arg)

[clang] [Wasm][Clang] Add __builtin_wasm_ref_is_null_extern (PR #139580)

2025-05-12 Thread Hood Chatham via cfe-commits
https://github.com/hoodmane updated https://github.com/llvm/llvm-project/pull/139580 >From 2ca282f0a20088bef15289a8ce5167d1e23595c3 Mon Sep 17 00:00:00 2001 From: Hood Chatham Date: Fri, 9 May 2025 00:16:26 -0400 Subject: [PATCH 1/2] [Wasm][Clang] Add __builtin_wasm_ref_is_null_extern I also

[clang] [Wasm][Clang] Add __builtin_wasm_ref_is_null_extern (PR #139580)

2025-05-12 Thread Hood Chatham via cfe-commits
https://github.com/hoodmane created https://github.com/llvm/llvm-project/pull/139580 I also fixed __builtin_wasm_ref_null_extern() to generate a diagnostic when it gets an argument. It seems like `SemaRef.checkArgCount()` has a bug that makes it unable to check for 0 args. cc @sbc100 @pmatos