mstorsjo wrote:

> We already have header test coverage, and 
> `clang\test\Headers\x86-intrinsics-headers-clean.cpp` in particular is there 
> to catch this kind of thing:
> 
> https://github.com/RKSimon/llvm-project/blob/7eb5c08ac3a5bc524a5fe4e2e91db3a5b1ffe3cd/clang/test/Headers/x86-intrinsics-headers-clean.cpp#L7-L9
> 
> Are there any other warnings that we can add to help catch this?

I'm not sure if there are warning in Clang proper; @AaronBallman 's comment 
above suggested using 
https://clang.llvm.org/extra/clang-tidy/checks/bugprone/reserved-identifier.html.
 The libcxx testcase, 
https://github.com/llvm/llvm-project/blob/main/libcxx/test/libcxx/system_reserved_names.gen.py,
 uses a bunch of defines of every known potentially problematic symbol name, 
before testing including the header - e.g. like this:
```c++
#define SYSTEM_RESERVED_NAME This name should not be used in libc++
#define A SYSTEM_RESERVED_NAME
#define Arg SYSTEM_RESERVED_NAME
#define Args SYSTEM_RESERVED_NAME
#define As SYSTEM_RESERVED_NAME
#define B SYSTEM_RESERVED_NAME
#define Bs SYSTEM_RESERVED_NAME
#define C SYSTEM_RESERVED_NAME
#define Cp SYSTEM_RESERVED_NAME
#define Cs SYSTEM_RESERVED_NAME
...
```

https://github.com/llvm/llvm-project/pull/98478
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to