[clang-tools-extra] [clang-tidy] Allow renaming macro arguments (PR #87792)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Apr 9 06:45:26 PDT 2024


AaronBallman wrote:

> > the user may not have the ability to change the definition of the macro to be able to appease the check
> 
> My understanding of this PR is that the user would only need to change what they pass into the macro, not the macro itself, or? E.g.
> 
> ```c++
> -MY_MACRO(foo)
> +MY_MACRO(g_foo)
> ```

In this case, yes, but consider a macro like:
```
#define CAT_IMPL(l, r) l ## r
#define CAT(l, r) CAT_IMPL(l, r)
#define MY_MACRO(foo) int CAT(awesome_, CAT(foo, __COUNTER__)) = 0
```
or some other form where the user doesn't necessarily control the exact identifier of what gets declared. Won't we suggest trying to rename the macro argument here?

https://github.com/llvm/llvm-project/pull/87792


More information about the cfe-commits mailing list