[clang-tools-extra] [clang-tidy] Only expand <inttypes.h> macros in modernize-use-std-format/print (PR #97911)
Mike Crowe via cfe-commits
cfe-commits at lists.llvm.org
Thu Jul 11 11:36:25 PDT 2024
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.
https://github.com/llvm/llvm-project/pull/97911
More information about the cfe-commits
mailing list