[PATCH] D156616: [clang-tidy] Fix c_str() removal and cast addition when re-ordering arguments

Mike Crowe via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Sun Jul 30 07:13:18 PDT 2023


mikecrowe created this revision.
mikecrowe added a reviewer: PiotrZSL.
Herald added subscribers: carlosgalvezp, xazax.hun.
Herald added a reviewer: njames93.
Herald added a project: All.
mikecrowe requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

The modernize-use-std-print check would get confused if it had to
re-order field-width and precision arguments at the same time as adding
casts or removing calls to c_str().

Fix this by tracking the argument indices and combining c_str() removal
with argument re-ordering. Add missing test cases to lit check.

Fixes https://github.com/llvm/llvm-project/issues/64033


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D156616

Files:
  clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp
  clang-tools-extra/clang-tidy/utils/FormatStringConverter.h
  clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-print.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D156616.545435.patch
Type: text/x-patch
Size: 16894 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230730/d3832123/attachment-0001.bin>


More information about the cfe-commits mailing list