[PATCH] D149280: [clang-tidy] Add modernize-printf-to-std-print check

Piotr Zegar via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jun 25 08:56:17 PDT 2023


PiotrZSL accepted this revision.
PiotrZSL added a comment.

Consider delivering this check. I do not think that it will become much better with more refactoring.



================
Comment at: clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp:202-203
+  assert(FormatExpr);
+  if (!FormatExpr->isOrdinary())
+    return; // No wide string support yet
+  PrintfFormatString = FormatExpr->getString();
----------------
this check for isOrdinary could be done on matcher level, just add anonymous matcher, and use it there, you can still use it also here, but my idea is to reduce amount of calls to check method.
```
AST_MATCHER(StringLiteral, isOrdinary) {
  return Node.isOrdinary();
}
```


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149280/new/

https://reviews.llvm.org/D149280



More information about the cfe-commits mailing list