[all-commits] [llvm/llvm-project] 3b3ade: [Clang] Fix Sema::checkArgCount for 0-arg function...

Hood Chatham via All-commits all-commits at lists.llvm.org
Tue May 13 13:01:50 PDT 2025


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 3b3adefd58826ca4dfd87df8099766d416c54341
      https://github.com/llvm/llvm-project/commit/3b3adefd58826ca4dfd87df8099766d416c54341
  Author: Hood Chatham <roberthoodchatham at gmail.com>
  Date:   2025-05-13 (Tue, 13 May 2025)

  Changed paths:
    M clang/lib/Sema/SemaChecking.cpp
    M clang/lib/Sema/SemaWasm.cpp
    M clang/test/Sema/builtins-wasm.c

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

When calling a function that expects zero arguments with one argument,
`Call->getArg(1)` will trap when trying to format the diagnostic.

This also seems to improve the rendering of the diagnostic some of the
time. Before:
```
$ ./bin/clang -c a.c
a.c:2:30: error: too many arguments to function call, expected 2, have 4
    2 |   __builtin_annotation(1, 2, 3, 4);
      |                           ~  ^
```
After:
```
$ ./bin/clang -c a.c
a.c:2:30: error: too many arguments to function call, expected 2, have 4
    2 |   __builtin_annotation(1, 2, 3, 4);
      |                              ^~~~
```

Split from #139580.

---------

Co-authored-by: Mariya Podchishchaeva <mariya.podchishchaeva at intel.com>



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list