This patch fixes false line number in a function definition with "void" parameter.
For more details PR46417.
Details
Diff Detail
Event Timeline
clang/test/Sema/void-argument.cpp | ||
---|---|---|
2 | These kinds of tests are typically done with a -verify test. See the other tests in Sema/ for examples. |
clang/test/Sema/void-argument.cpp | ||
---|---|---|
2 | we are testing here line number rather than diagnostic. |
clang/test/Sema/void-argument.cpp | ||
---|---|---|
2 | -verify implicitly checks line numbers. Even better: you don't have to hard-code the specific line numbers into the test. |
clang/lib/Sema/SemaType.cpp | ||
---|---|---|
5112 | Are you sure that all parameters will have a valid IdentLoc? I am worried about the common case where the void parameter is unnamed. | |
clang/test/Sema/void-argument.cpp | ||
10 | I'd like to see some additional testing: void foo( int a, void, int b ); void bar( void, ... ); struct S { S( void, void ); }; |
Address @aaron.ballman review comments.
I have added your test case that is passing as well.
This patch covers this scenario also.
Thanks @aaron.ballman
LGTM with a small nit about the tests, though I'm still surprised IdentLoc is valid even when there's no identifier present. :-)
clang/test/Sema/void-unnamed.cpp | ||
---|---|---|
1 | I think these test should be combined with the other ones (no real need for separate files to test the same functionality, as that causes tests to be a bit slower to run for no real gain). |
Hi @aaron.ballman ,
Address your review comments.
Thank you for accepting this. I don't have commit access please commit this.
Thanks.
As discussed with Aaron on IRC I can commit it for you. To do that I need a name and an email for the attribution.
But first move the test to the already existing test/Sema/void_arg.c which already test this diagnostic.
Hi @riccibruno,
Address your review comment.Add please use
Name :- Jaydeep Chauhan
Mail id:- jaydeepchauhan1494@gmail.com
Thanks
Are you sure that all parameters will have a valid IdentLoc? I am worried about the common case where the void parameter is unnamed.