Issue 173042
Summary clang-tidy bugprone-argument-comment interaction with preprocessor macros / #define
Labels clang-tidy
Assignees
Reporter MatzeB
    An example like the following currently produces a warning with `bugprone-argument-comment` but most users should be surprised by this:

```
$ cat test.cpp
extern void print(const char *string);
#define LOG(message)   print(/*string=*/message)
int main() {
 LOG(/*message=*/"Hello World");
}

$ clang-tidy -checks=bugprone-argument-comment ./test.cpp
...
/home/matthiasb/test.cpp:4:7: warning: argument name 'message' in comment does not match parameter name 'string' [bugprone-argument-comment]
    4 |   LOG(/*message=*/"Hello World");
 |       ^
/home/matthiasb/test.cpp:1:31: note: 'string' declared here
 1 | extern void print(const char *string);
      | ^
```

Would be neat if it could match for the macro parameter names instead of the parameter names after substitution...
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to