[PATCH] D144216: [clang-tidy] Extract string header from redundant-string-cstr checker

2023-02-17 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe marked an inline comment as done. mikecrowe added a comment. > If you're suggesting that I could use the new header to replace > declarations of basic_string etc. in other tests then I think that would be > possible with some careful checking to make sure it include the necessary > f

[PATCH] D144216: [clang-tidy] Extract string header from redundant-string-cstr checker

2023-02-17 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. In D144216#4135431 , @carlosgalvezp wrote: > Fair enough! I think we should merge this patch as is first, so that people > can benefit from it already, and work through the technical debt afterwards. Great. Thank you. I'm sti

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

2023-05-08 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe marked 3 inline comments as done. mikecrowe added inline comments. Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-print.cpp:124-126 + printf("Integer %d from bool\n", b); + // CHECK-MESSAGES: [[@LINE-1]]:3: warning: use 'std::print' instead

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

2023-05-08 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 520439. mikecrowe added a comment. Address many more review comments, including: - Only add casts for signed/unsigned discrepancy if StrictMode option is set. - Use IncludeInserter to add or other required header. Review comments still outstanding: - Use

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

2023-05-11 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added inline comments. Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/use-std-print.rst:117 + +.. option:: PrintFunction + Is `PrintFunction` (and the soon-to-arrive `PrintlnFunction`) distinct enough from `PrintfLikeFunctions` and `Fp

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

2023-05-14 Thread Mike Crowe via Phabricator via cfe-commits
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(Ty)) { +const bool result = (BT->getKind() == BuiltinType::Char_U || This apparently

[PATCH] D150602: [clang-tidy] Move formatDereference to FixitHintUtils

2023-05-15 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe created this revision. mikecrowe added reviewers: njames93, carlosgalvezp, PiotrZSL. Herald added a subscriber: xazax.hun. Herald added a project: All. mikecrowe requested review of this revision. Herald added a project: clang-tools-extra. Herald added a subscriber: cfe-commits. I'd like

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

2023-04-26 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe created this revision. 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. Add FormatStringConve

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

2023-04-26 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. If this sort of check is deemed acceptable then I have plans for future improvements, including: 1. Automatically turning absl::StrFormat into fmt::format too (with an option to choose an alternative to `absl::StrFormat`.) 2. Detecting format strings that end in `"\n

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

2023-04-27 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. Thanks for all the reviews. In D149280#4301188 , @njames93 wrote: > It may be a good idea to create unittests for the formatconverter in > `clang-tools-extra/unittests/clang-tidy/` I started there but had decided that the eas

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

2023-04-29 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe marked 12 inline comments as done. mikecrowe added a comment. Thank you for all the review comments. Comment at: clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp:322 + if (!isRealCharType(Pointee)) +ArgFixes.emplace_back(Arg, "reinterp

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

2023-04-30 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe marked 4 inline comments as done. mikecrowe added inline comments. Comment at: clang-tools-extra/docs/clang-tidy/checks/modernize/printf-to-std-print.rst:61 +- any arguments where the format string and the parameter differ in + signedness will be wrapped in an appropr

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

2023-04-30 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe marked an inline comment as done. mikecrowe added inline comments. Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize/printf-to-std-print-convert.cpp:289 + // CHECK-MESSAGES: [[@LINE-1]]:3: warning: Replace 'printf' with 'std::print' [modernize-printf-t

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

2023-04-30 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added inline comments. Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize/printf-to-std-print-convert.cpp:289 + // CHECK-MESSAGES: [[@LINE-1]]:3: warning: Replace 'printf' with 'std::print' [modernize-printf-to-std-print] + // CHECK-FIXES: std::print("

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

2023-04-30 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 518315. mikecrowe added a comment. I've addressed most of the review comments. The work that remains outstanding is: - Emit warnings when conversion is not possible explaining why. - Only add signed/unsigned casts when in StrictMode. - Automatically remo

[PATCH] D150602: [clang-tidy] Move formatDereference to FixitHintUtils

2023-06-11 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 530384. mikecrowe added a comment. Rebase, no changes. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150602/new/ https://reviews.llvm.org/D150602 Files: clang-tools-extra/clang-tidy/readability/RedundantSt

[PATCH] D150602: [clang-tidy] Move formatDereference to FixitHintUtils

2023-06-12 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 530662. mikecrowe added a comment. Add clangTooling to LINK_LIBS for tooling::fixit::getText for clangTidyUtils to fix failure to build with BUILD_SHARED_LIBS=ON: ld.lld: error: undefined symbol: clang::tooling::fixit::internal::getText(clang::CharSourc

[PATCH] D150602: [clang-tidy] Move formatDereference to FixitHintUtils

2023-06-13 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 530943. mikecrowe added a comment. Move clangTooling to clang_target_link_libraries Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150602/new/ https://reviews.llvm.org/D150602 Files: clang-tools-extra/clang

<    1   2