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

Mariya Podchishchaeva via cfe-commits cfe-commits at lists.llvm.org
Tue May 13 06:24:46 PDT 2025


================
@@ -62,12 +62,8 @@ bool SemaWasm::BuiltinWasmRefNullExtern(CallExpr *TheCall) {
 
 bool SemaWasm::BuiltinWasmRefNullFunc(CallExpr *TheCall) {
   ASTContext &Context = getASTContext();
-  if (TheCall->getNumArgs() != 0) {
-    Diag(TheCall->getBeginLoc(), diag::err_typecheck_call_too_many_args)
-        << 0 /*function call*/ << /*expected*/ 0 << TheCall->getNumArgs()
-        << /*is non object*/ 0;
+  if (SemaRef.checkArgCount(TheCall, 0))
----------------
Fznamznon wrote:

```suggestion
  if (SemaRef.checkArgCount(TheCall, /*DesiredArgCount=*/ 0))
```

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


More information about the cfe-commits mailing list