[clang][Diagnostics] Provide parameter source range to arity-mismatch notes
authorTakuya Shimizu <shimizu2486@gmail.com>
Sun, 25 Jun 2023 15:27:15 +0000 (00:27 +0900)
committerTakuya Shimizu <shimizu2486@gmail.com>
Sun, 25 Jun 2023 15:27:15 +0000 (00:27 +0900)
commit409a8097c5c728607eb6b05efb1744bf5f9096e1
tree1e3d566c5960a8f01236f769e196045306769502
parentb3c8554f28a95063e406924c25336e0da7efb4fd
[clang][Diagnostics] Provide parameter source range to arity-mismatch notes

Consider the following piece of code:
```
void func( int aa,
           int bb,
           int cc) {}

void arity_mismatch() {
  func(2, 4);
}
```
BEFORE:
```
source.cpp:6:3: error: no matching function for call to 'func'
    6 |   func(2, 4);
      |   ^~~~
source.cpp:1:6: note: candidate function not viable: requires 3 arguments, but 2 were provided
    1 | void func( int aa,
      |      ^
```
AFTER:
```
source.cpp:6:3: error: no matching function for call to 'func'
    6 |   func(2, 4);
      |   ^~~~
source.cpp:1:6: note: candidate function not viable: requires 3 arguments, but 2 were provided
    1 | void func( int aa,
      |      ^     ~~~~~~~
    2 |            int bb,
      |            ~~~~~~~
    3 |            int cc) {}
      |            ~~~~~~
```

Reviewed By: cjdb, aaron.ballman

Differential Revision: https://reviews.llvm.org/D153267
clang/docs/ReleaseNotes.rst
clang/lib/Sema/SemaExpr.cpp
clang/lib/Sema/SemaOverload.cpp
clang/test/Misc/diag-func-call-ranges.c [new file with mode: 0644]
clang/test/Misc/diag-func-call-ranges.cpp [new file with mode: 0644]