[clang-tidy] bugprone-reserved-identifier will not emit a diagnostic for declarations if the identifier is used in an invoked macro
The bugprone-reserved-identifier check is supposed to identify declarations which use names reserved by the C/C++ standard.
E.g.:
// declarations for which I would expect diagnostics from bugprone-reserved-identifier
void __foo() {}
int __x{};
That works for the most part, but if those symbols are used inside an invoked macro, then bugprone-reserved-identifier won't report them at all. I would understand if it would report them, but not provide a FixIt.
To reproduce (godbolt):
void __foo() {}
void __bar() {}
int __x{};
int __y{};
#define FOO __foo
#define BAR __bar
#define X __x
int main() {
__foo();
BAR();
return X;
}
clang-tidy --checks="-*,bugprone-reserved-identifier" test.cpp
For __foo and __y, diagnostics are emitted, but not for __bar and __x.
@llvm/issue-subscribers-clang-tidy
Author: PWVEC
E.g.:
// declarations for which I would expect diagnostics from bugprone-reserved-identifier
void __foo() {}
int __x{};
That works for the most part, but if those symbols are used inside an invoked macro, then bugprone-reserved-identifier won't report them at all. I would understand if it would report them, but not provide a FixIt.
To reproduce (godbolt):
void __foo() {}
void __bar() {}
int __x{};
int __y{};
#define FOO __foo
#define BAR __bar
#define X __x
int main() {
__foo();
BAR();
return X;
}
clang-tidy --checks=-*,bugprone-reserved-identifier" test.cpp
For __foo and __y, diagnostics are emitted, but not for __bar and __x.
Hi, I would like to work on this issue. Could you assign it to me? Thanks.
https://godbolt.org/z/o8fT16eEP
Hi, I would like to work on this issue. Could you assign it to me? Thanks.
Just post a PR when ready