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

Mike Crowe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun May 14 07:51:09 PDT 2023


mikecrowe added inline comments.


================
Comment at: clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp:27
+  using namespace clang;
+  if (const auto *BT = llvm::dyn_cast<BuiltinType>(Ty)) {
+    const bool result = (BT->getKind() == BuiltinType::Char_U ||
----------------
This apparently need to be `Ty->getUnqualifiedDesugaredType()` to ensure that arguments like std::string().c_str() are correctly treated as being of `char` type. Without, the `dyn_cast<BuiltinType>` fails.


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