mikecrowe wrote:

> Unfortunately, walking the format string looking for macros also seems to 
> match a macro that encloses the whole function invocation. This results in 
> the check failing to work on expressions inside Catch2 `REQUIRE` macros for 
> example.
> 
> My new test case (that currently fails) is:
> 
> ```c++
> #define SURROUND(x) x
>   SURROUND(printf("Surrounding macro %d\n", 42));
>   // CHECK-MESSAGES: [[@LINE-1]]:3: warning: use 'std::println' instead of 
> 'printf' [modernize-use-std-print]
>   // CHECK-FIXES: std::print("Surrounding macro {}", 42);
> ```
> 
> I'll try to fix this, but any advice is gratefully received.
I've pushed a new commit that works for the Lit test cases that I've added by 
getting the macro name for the function call and permitting that macro for the 
format string too. I can't say that I'm particularly happy with it, and there 
may be corner cases such as the same macro being intentionally used in both 
places, but it's the best I can currently work out how to do.

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

Reply via email to