PiotrZSL wrote:

> * How do I correctly parse the values in a macro? While the test locally 
> works, it doesn't in CI. I also don't differentiate between what kind of 
> numeric constant the token is, which might be another problem. Any pointers 
> on how to do this correctly are greatly appreciated.
> * Macros currently don't distinguish between `float`, `double` and `long 
> double` like the AST-based check does. The values matched in the PPCallback 
> should be able to provide the `..._v<>` versions of replacements as well. The 
> question about how to detect the difference is probably related to the point 
> above.

I think you can't, instead of handling macro definitions, you just should 
handle places where macro is used.
It's fine if someone define a macro MY_PI, check should flag usage of such 
macro, not necessarily a macro.

Instead of using MacroDefined and try to find those #define MY_PI, you should 
just use MacroExpands, and find usage of those system macros like M_PI, and 
suggest replacement usage of them without checking an value.

As for #define MY_PI 3.14, this should be handled like it is now, simply 
isMacro shouldn't be used, and warning should be produced inside macro.



https://github.com/llvm/llvm-project/pull/66583
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to