[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-02-05 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe created this revision. mikecrowe added a reviewer: njames93. mikecrowe added a project: clang-tools-extra. Herald added subscribers: carlosgalvezp, xazax.hun. Herald added a project: All. mikecrowe requested review of this revision. Herald added a subscriber: cfe-commits. std::format (C+

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-02-05 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. This check can also work trivially for fmt::format and fmt::print[1] too (in fact, that's what I'm actually using), if the project would allow them to be added too. [1] https://fmt.dev/ Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://revie

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-02-05 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 494937. mikecrowe added a comment. carlosgalvezp wrote: > Please document change in Release Notes, as well as in the check > documentation, together with its limitations (can only handle 1 argument at a > time). Hopefully I've done those things. CHANGE

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-02-06 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. > The limitation about only transforming the first argument can be alleviated > by using the forEachArgumentWithParam matcher I shall try to make that work. My initial attempts were not successful, but there's still more to try. If I can't make it work I'll ask for mo

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

2023-07-30 Thread Mike Crowe via Phabricator via cfe-commits
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 subscribe

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

2023-07-30 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. Fixing this was rather messier than I expected, but this solution does seem to work for the test cases. Here's my original commit message before I trimmed it, in case it provides any more insight. [clang-tidy] Fix c_str() removal and cast addition when re-ordering a

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

2023-07-30 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 545446. mikecrowe added a comment. Rebase on top of D156616 and add more tests Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156616/new/ https://reviews.llvm.org/D156616 Fi

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

2023-08-02 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 546414. mikecrowe added a comment. Reinstate version I incorrectly replaced with D154287 Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156616/new/ https://reviews.llvm.org/

[PATCH] D154287: [clang-tidy] Add modernize-use-std-format check

2023-08-02 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 546418. mikecrowe added a comment. Rebase on top of D156616 and add more tests Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D154287/new/ https://reviews.llvm.org/D154287 Fi

[PATCH] D154283: [clang-tidy] Fix width/precision argument order in modernize-use-std-print

2023-07-01 Thread Mike Crowe via Phabricator via cfe-commits
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 subscribe

[PATCH] D154287: [clang-tidy] Add modernize-use-std-format check

2023-07-01 Thread Mike Crowe via Phabricator via cfe-commits
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 subscribe

[PATCH] D154283: [clang-tidy] Fix width/precision argument order in modernize-use-std-print

2023-07-02 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. Thanks for the review. Comment at: clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp:356-357 + if (ArgCount) +ArgRotates.push_back( +std::make_tuple(FS.getArgIndex() + ArgsOffset, ArgCount)); +} PiotrZSL wrote:

[PATCH] D154283: [clang-tidy] Fix width/precision argument order in modernize-use-std-print

2023-07-02 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 536595. mikecrowe added a comment. Use emplace_back rather than push_back(make_tuple()) Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D154283/new/ https://reviews.llvm.org/D154283 Files: clang-tools-extra/c

[PATCH] D154283: [clang-tidy] Fix width/precision argument order in modernize-use-std-print

2023-07-02 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added inline comments. Comment at: clang-tools-extra/clang-tidy/utils/FormatStringConverter.h:73 + // puts the width and preicision first. + std::vector> ArgRotates; + PiotrZSL wrote: > mikecrowe wrote: > > PiotrZSL wrote: > > > NOTE: You can use std:

[PATCH] D154287: [clang-tidy] Add modernize-use-std-format check

2023-07-09 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe marked 9 inline comments as done. mikecrowe added a comment. Thanks for the reviews! Comment at: clang-tools-extra/clang-tidy/modernize/UseStdFormatCheck.cpp:81 + << ReplacementFormatFunction + << OldFunction->ge

[PATCH] D154788: [clang-tidy] Don't split \r\n in modernize-use-std-print check

2023-07-09 Thread Mike Crowe via Phabricator via cfe-commits
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 subscribe

[PATCH] D154287: [clang-tidy] Add modernize-use-std-format check

2023-07-09 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 538427. mikecrowe marked 3 inline comments as done. mikecrowe added a comment. Address review comments and improve documentation. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D154287/new/ https://reviews.llvm

[PATCH] D154287: [clang-tidy] Add modernize-use-std-format check

2023-07-09 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/UseStdFormatCheck.cpp:46 +void UseStdFormatCheck::registerMatchers(MatchFinder *Finder) { + Finder->addMatcher( + callExpr(argumentCountAtLeast(1), hasArgument(0, stringLiteral()), -

[PATCH] D154884: [clang-tidy] Make MatchesAnyListedNameMatcher cope with unnamed Decl

2023-07-10 Thread Mike Crowe via Phabricator via cfe-commits
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 subscribe

[PATCH] D154287: [clang-tidy] Add modernize-use-std-format check

2023-07-10 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/UseStdFormatCheck.cpp:46 +void UseStdFormatCheck::registerMatchers(MatchFinder *Finder) { + Finder->addMatcher( + callExpr(argumentCountAtLeast(1), hasArgument(0, stringLiteral()), -

[PATCH] D154287: [clang-tidy] Add modernize-use-std-format check

2023-07-10 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 538806. mikecrowe added a comment. Use isOrdinary in stringLiteral() match on first argument Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D154287/new/ https://reviews.llvm.org/D154287 Files: clang-tools-ex

[PATCH] D154884: [clang-tidy] Make MatchesAnyListedNameMatcher cope with unnamed Decl

2023-07-11 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 538940. mikecrowe marked an inline comment as done. mikecrowe added a comment. Remove unnecessary init-statement and test case in commit message Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D154884/new/ https

[PATCH] D154884: [clang-tidy] Make MatchesAnyListedNameMatcher cope with unnamed Decl

2023-07-11 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. Thanks for the review. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D154884/new/ https://reviews.llvm.org/D154884 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https:

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

2023-08-28 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. @PiotrZSL, I think that this is quite an important fix since without it the check completely mangles the code. Should it be put in the 17.x release branch too? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156616/new/ h

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

2023-08-28 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. In D156616#4621945 , @PiotrZSL wrote: > In D156616#4621914 , @mikecrowe > wrote: > >> @PiotrZSL, I think that this is quite an important fix since without it the >> check completely ma

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

2023-08-28 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. > Additionally user could always take "main" version, and use it just to apply > fixes from this check. OK. Can this land on main then? Thanks. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156616/new/ https://reviews.

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

2023-08-29 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. Thanks for the review and landing this. Mike. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D156616/new/ https://reviews.llvm.org/D156616 ___ cfe-commits mailing list cfe-commi

[PATCH] D154287: [clang-tidy] Add modernize-use-std-format check

2023-08-29 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 55. mikecrowe added a comment. Rebase and fix minor doc conflicts. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D154287/new/ https://reviews.llvm.org/D154287 Files: clang-tools-extra/clang-tidy/moderni

[PATCH] D154287: [clang-tidy] Add modernize-use-std-format check

2023-08-29 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 554486. mikecrowe edited the summary of this revision. mikecrowe added a comment. Fix ReleaseNotes order and remove unnecessary .html from list.rst Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D154287/new/ ht

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

2023-03-04 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 502385. mikecrowe edited the summary of this revision. mikecrowe added a comment. This new version uses size_t and size_type rather than the annoyingly-named "size" type that the old implementation in redundant-string-cstr.cpp used and is the basis for usi

[PATCH] D145310: [clang-tidy] Make readability-container-data-pointer use header

2023-03-04 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe created this revision. 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. This requires operator[] to be added to the std::basic_string implemen

[PATCH] D145311: Make abseil-redundant-strcat-calls checker use header

2023-03-04 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe created this revision. mikecrowe added a reviewer: carlosgalvezp. Herald added a project: All. mikecrowe requested review of this revision. Herald added a project: clang-tools-extra. Herald added a subscriber: cfe-commits. It's unclear where the "string" in no namespace comes from in thi

[PATCH] D145312: [clang-tidy] Make readability-string-compare check use header

2023-03-04 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe created this revision. mikecrowe added a reviewer: carlosgalvezp. 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. Improve the generic header

[PATCH] D145313: [clang-tidy] Make readability-container-size-empty check using header

2023-03-04 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe created this revision. mikecrowe added a reviewer: carlosgalvezp. 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. Improve the generic header

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

2023-03-04 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. The changes that extend the header further and use it in a few more checks are: - https://reviews.llvm.org/D145310 - https://reviews.llvm.org/D145311 - https://reviews.llvm.org/D145312 - https://reviews.llvm.org/D145313 and of course my original change: - https://re

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

2023-03-05 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. > Sounds good, should we land this? If you're happy to do so, then so am I. > If you don't have commit rights, please let us know Github name and email for > attribution. These are my first code contributions to LLVM, so I don't really know the process. I don't beli

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

2023-03-05 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. > The purpose of this header is to not include any standard header, and yet > this is done in line 5 so it kinda defeats the purpose. I believe that this `` header is including `clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string.h` rather than the syste

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

2023-03-05 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. > I will double check that this is true once my current build is complete. Yes, it's true. I stuck a `#error` in `clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string.h` and I saw the expected error from a file including ``. CHANGES SINCE LAST ACTION h

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

2023-03-05 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. In D144216#4169772 , @carlosgalvezp wrote: > In D144216#4169764 , @mikecrowe > wrote: > >>> I will double check that this is true once my current build is complete. >> >> Yes, it's tru

[PATCH] D145313: [clang-tidy] Make readability-container-size-empty check using header

2023-03-05 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. In D145313#4169790 , @carlosgalvezp wrote: > Could you upload the patch with full context? I believe you need to do > something like `git show HEAD -U99` as per the guidelines > . O

[PATCH] D145719: [clang-tidy] Make readability-container-data-pointer use header

2023-03-09 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe created this revision. Herald added subscribers: PiotrZSL, 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. This requires operator[] to be added to the std::basic_string

[PATCH] D145719: [clang-tidy] Make readability-container-data-pointer use header

2023-03-09 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe abandoned this revision. mikecrowe added a comment. Whoops. I accidentally uploaded https://reviews.llvm.org/D145719 as a new change. :( Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145719/new/ https://reviews.llvm.org/D145719

[PATCH] D145310: [clang-tidy] Make readability-container-data-pointer use header

2023-03-09 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 503882. mikecrowe added a comment. Herald added a subscriber: PiotrZSL. Rebase on top of fb7ef637a84652dbd3d973a1ba7db9470181b5aa (which is a descendent of ae25e2f19decb94198301f0726ee61

[PATCH] D145311: [clang-tidy] Make abseil-redundant-strcat-calls checker use header

2023-03-09 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 503884. mikecrowe added a comment. Herald added a subscriber: PiotrZSL. Re-upload using arc. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145311/new/ https://reviews.llvm.org/D145311 Files: clang-tools-ex

[PATCH] D145724: [clang-tidy] Provide default template arguments in

2023-03-09 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe created this revision. mikecrowe added a reviewer: carlosgalvezp. Herald added subscribers: PiotrZSL, 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. Simplify the use o

[PATCH] D145312: [clang-tidy] Make readability-string-compare check use header

2023-03-09 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe marked an inline comment as done. mikecrowe added inline comments. Herald added a subscriber: PiotrZSL. Comment at: clang-tools-extra/test/clang-tidy/checkers/readability/string-compare.cpp:4-8 -template -class allocator {}; -template -class char_traits {}; -template

[PATCH] D145313: [clang-tidy] Make readability-container-size-empty check using header

2023-03-09 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 503896. mikecrowe added a comment. Herald added a subscriber: PiotrZSL. Upload using arc diff so more context is available. Now a descendent of D145724 . Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D145313: [clang-tidy] Make readability-container-size-empty check using header

2023-03-09 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. In D145313#4182637 , @mikecrowe wrote: > Now a descendent of D145724 . Oh. The commit message update didn't make it through. :( Never mind, this doesn't really depend on D145724

[PATCH] D145730: [clang-tidy] readability-redundant-string-cstr for smart pointer #576705

2023-03-09 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe created this revision. mikecrowe added a reviewer: njames93. Herald added subscribers: PiotrZSL, carlosgalvezp, 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. The read

[PATCH] D145730: [clang-tidy] readability-redundant-string-cstr for smart pointer #576705

2023-03-10 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. In D145730#4182949 , @PiotrZSL wrote: > Also consider reducing commit message, instead just copying issue description. > Simple description about issue would be sufficient. TBH, I wasn't expecting this change to be accepted. I

[PATCH] D145730: [clang-tidy] readability-redundant-string-cstr for smart pointer #576705

2023-03-10 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 504108. mikecrowe marked an inline comment as done. mikecrowe added a comment. Fix comment in code as suggested by PiotrZSL. Improve lit check tests. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145730/new/

[PATCH] D145730: [PATCH] [clang-tidy] Fix readability-redundant-string-cstr for smart pointer #576705

2023-03-10 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. Thanks for the speedy re-review. I don't have commit permission, so please can you land this if you are happy to do so? Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145730/new/ https://reviews.llvm.org/D145730

[PATCH] D145730: [clang-tidy] Fix readability-redundant-string-cstr for smart pointer #576705

2023-03-10 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. Thanks, and sorry about the erroneous `[PATCH]` in the summary. :( Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145730/new/ https://reviews.llvm.org/D145730 ___ cfe-commits ma

[PATCH] D145311: [clang-tidy] Make abseil-redundant-strcat-calls checker use header

2023-03-11 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. In D145311#4184159 , @PiotrZSL wrote: > It's fine, absl::StrCat returns std::string. > So those changes are correct. Thanks. Would you like me to remove the unnecessary noise from the commit message then, or will you do that a

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-03-11 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp:189 + getLangOpts().CPlusPlus2b + ? hasAnyName("::std::print", "::std::format") +

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-03-11 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. In D143342#4186809 , @PiotrZSL wrote: > Code is fine, probably If would would write this, then I would bother to > split into C++20 and C++2B simply because `std::print` wouldn't compile if it > wouldn't be available. So I wou

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-03-11 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp:189 + getLangOpts().CPlusPlus2b + ? hasAnyName("::std::print", "::std::format") +

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-03-12 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp:189 + getLangOpts().CPlusPlus2b + ? hasAnyName("::std::print", "::std::format") +

[PATCH] D145885: [clang-tidy] Support readability-redundant-string-cstr.StringParameterFunctions option

2023-03-12 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe created this revision. mikecrowe added reviewers: PiotrZSL, carlosgalvezp. Herald added a subscriber: 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 subscribe

[PATCH] D145885: [clang-tidy] Support readability-redundant-string-cstr.StringParameterFunctions option

2023-03-12 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. I can squash this with https://reviews.llvm.org/D143342 if required. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145885/new/ https://reviews.llvm.org/D145885 ___ cfe-commits

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-03-12 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp:189 + getLangOpts().CPlusPlus2b + ? hasAnyName("::std::print", "::std::format") +

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-03-12 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. In D143342#4187641 , @PiotrZSL wrote: > Correct commit message and this could land. I've read through all the comments and the commit message itself and I can't spot what's wrong with the commit message, except perhaps for its

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-03-12 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. Thank you for your patience. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D143342/new/ https://reviews.llvm.org/D143342 ___ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-03-12 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 504474. mikecrowe edited the summary of this revision. mikecrowe added a comment. Rebase. No conflicts. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D143342/new/ https://reviews.llvm.org/D143342 Files: cla

[PATCH] D145885: [clang-tidy] Support readability-redundant-string-cstr.StringParameterFunctions option

2023-03-12 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 504475. mikecrowe added a comment. Rebase. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145885/new/ https://reviews.llvm.org/D145885 Files: clang-tools-extra/clang-tidy/readability/RedundantStringCStrChec

[PATCH] D145885: [clang-tidy] Support readability-redundant-string-cstr.StringParameterFunctions option

2023-03-12 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. In D145885#4187679 , @PiotrZSL wrote: > My only complain is documentation, changes in code and tests are correct. > Build failed mainly due to conflicts in previous change. > It should get green once prev patch will land, and th

[PATCH] D145885: [clang-tidy] Support readability-redundant-string-cstr.StringParameterFunctions option

2023-03-13 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 504517. mikecrowe marked 2 inline comments as done. mikecrowe added a comment. Documentation updates suggested by @PiotrZSL. Rebase. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145885/new/ https://reviews.l

[PATCH] D145885: [clang-tidy] Support readability-redundant-string-cstr.StringParameterFunctions option

2023-03-13 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 504537. mikecrowe edited the summary of this revision. mikecrowe added a comment. Quote types and functions correctly in redundant-string-cstr.rst. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D145885/new/ ht

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

2023-06-18 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe marked 6 inline comments as done. mikecrowe added a comment. Thanks for the comprehensive review. Comment at: clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp:43-44 + + if (!MaybeHeaderToInclude && (ReplacementPrintFunction == "std::print" || +

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

2023-06-18 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added inline comments. Comment at: clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp:202 +/// Called for each format specifier by ParsePrintfString. +bool FormatStringConverter::HandlePrintfSpecifier( +const analyze_printf::PrintfSpecifier &FS, const char

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

2023-06-24 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe marked 7 inline comments as done. mikecrowe added a comment. I'm still working on the remaining items. Comment at: clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp:230 +return conversionNotPossible("'%m' is not supported in format string"); + } else {

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

2023-06-24 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe marked 4 inline comments as done. mikecrowe added inline comments. Comment at: clang-tools-extra/clang-tidy/utils/FormatStringConverter.cpp:384-397 +const auto StringDecl = type(hasUnqualifiedDesugaredType(recordType( +hasDeclaration(cxxRecordDecl(ha

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

2023-06-24 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. @Eugene.Zelenko, I will make the documentation changes you've suggested, but I can't say I really understand which document elements require single backticks and which require dual backticks. https://llvm.org/docs/SphinxQuickstartTemplate.html seems to imply that sing

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

2023-06-24 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe marked 2 inline comments as done. mikecrowe added a comment. Thanks for the further reviews. Comment at: clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp:37 + + if (PrintfLikeFunctions.empty() && FprintfLikeFunctions.empty()) { +PrintfLikeFunctions.pus

[PATCH] D153716: [ASTMatchers] Add argumentCountAtLeast narrowing matcher

2023-06-25 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added inline comments. Comment at: clang/unittests/ASTMatchers/ASTMatchersNarrowingTest.cpp:1671 + notMatches("void x(int, int = 1) { x(0); }", + traverse(TK_IgnoreUnlessSpelledInSource, Call2PlusArgs))); + EXPECT_TRUE( I'm not sur

[PATCH] D153716: [ASTMatchers] Add argumentCountAtLeast narrowing matcher

2023-06-25 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe created this revision. mikecrowe added a reviewer: PiotrZSL. Herald added a project: All. mikecrowe requested review of this revision. Herald added a project: clang. Herald added a subscriber: cfe-commits. mikecrowe added inline comments. Comment at: clang/unittests/AST

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

2023-06-25 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp:64 + if (MaybeHeaderToInclude) +Options.store(Opts, "PrintHeader", *MaybeHeaderToInclude); +} This is going to write the default value set in the constru

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

2023-06-25 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. In D149280#4447363 , @thakis wrote: > This breaks tests on windows: http://45.33.8.238/win/80283/step_8.txt > > Please take a look and revert for now if it takes a while to fix. Thanks for letting me know, I thought I could get

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

2023-06-25 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/use-std-print.cpp:9-15 +#include +#include +#include +// CHECK-FIXES: #include +#include +#include +#include Piot

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

2023-06-26 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe marked an inline comment as done. mikecrowe added a comment. In D149280#4448158 , @PiotrZSL wrote: > Test is failing: > https://lab.llvm.org/buildbot/#/builders/230/builds/14939/steps/6/logs/FAIL__Clang_Tools__use-std-print_cpp > https://lab.llv

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

2023-06-26 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added inline comments. Comment at: clang-tools-extra/test/clang-tidy/checkers/modernize/use-std-print.cpp:169 + // CHECK-MESSAGES: [[@LINE-1]]:3: warning: use 'std::println' instead of 'printf' [modernize-use-std-print] + // CHECK-FIXES: std::println("Integer {:d} f

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

2023-06-26 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. Despite the fact that I've worked on what became this check for about two years, now that it's landed I've suddenly spotted a significant flaw: `printf` returns the number of characters printed, whereas `std::print` doesn't return anything. None of my test cases made

[PATCH] D153860: [clang-tidy] Fix modernize-use-std-print check when return value used

2023-06-27 Thread Mike Crowe via Phabricator via cfe-commits
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 subscribe

[PATCH] D153860: [clang-tidy] Fix modernize-use-std-print check when return value used

2023-06-27 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe marked an inline comment as done. mikecrowe added inline comments. Comment at: clang-tools-extra/clang-tidy/modernize/UseStdPrintCheck.cpp:73-95 +static clang::ast_matchers::StatementMatcher +unusedReturnValue(clang::ast_matchers::StatementMatcher MatchedCallExpr) { +

[PATCH] D153860: [clang-tidy] Fix modernize-use-std-print check when return value used

2023-06-27 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe marked an inline comment as done. mikecrowe added a comment. In D153860#4453572 , @dyung wrote: > @mikecrowe Your change is causing a test failure on the PS4 linux and PS5 > Windows build bots. Can you take a look and fix or revert if you need

[PATCH] D153860: [clang-tidy] Fix modernize-use-std-print check when return value used

2023-06-27 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 535106. mikecrowe added a comment. Fix test failures on PS4 and PS5 and improve tests - Ensure that exceptions are available so the test can use try/catch - Remove unwanted -NOT checks - Add more return value tests Repository: rG LLVM Github Monorepo C

[PATCH] D153860: [clang-tidy] Fix modernize-use-std-print check when return value used

2023-06-29 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe requested review of this revision. mikecrowe added a comment. I believe that the problems that caused this to be reverted have been fixed. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D153860/new/ https://reviews.llvm.org/D153860 ___

[PATCH] D154151: [clang-tidy] Improve documentation for modernize-use-std-print check

2023-06-29 Thread Mike Crowe via Phabricator via cfe-commits
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 subscribe

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

2023-05-20 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:79 + +.. option:: StrictMode + It turns out that absl::PrintF and absl::FPrintF work like std::format, fmt::printf, etc. and use the signedness of

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

2023-05-23 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe marked an inline comment as done. mikecrowe added a comment. Thanks for the review. New version with the `static` added coming shortly. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D150602/new/ https://reviews.llvm.org/D150602 __

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

2023-05-23 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 524815. mikecrowe added a comment. Make needParensAfterUnaryOperator static 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/re

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

2023-05-31 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:79 + +.. option:: StrictMode + mikecrowe wrote: > It turns out that absl::PrintF and absl::FPrintF work like std::format, > fmt::printf, etc. and u

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-02-10 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp:188 + callee(functionDecl(hasName("::std::format", +hasAnyArgument(materializeTemporaryExpr( +

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-02-12 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added inline comments. Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp:188 + callee(functionDecl(hasName("::std::format", +hasAnyArgument(materializeTemporaryExpr( +

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-02-12 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 496758. mikecrowe added a comment. Incorporate feedback from Nathan James: - Simplify callExpr pattern in matcher. - Use `forEachArgumentWithParam` so that check works on all arguments and remove mentions of previous limitation in commit message and docume

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-02-15 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe added a comment. Thanks for the review and further suggestions. Mike. Comment at: clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp:181-190 + + // Detect redundant 'c_str()' calls in parameters passed to std::print and + // std::format. + Find

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

2023-02-16 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe created this revision. mikecrowe added a reviewer: njames93. 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. In preparation for using the imp

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-02-16 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe updated this revision to Diff 498136. mikecrowe edited the summary of this revision. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D143342/new/ https://reviews.llvm.org/D143342 Files: clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp clang-tools-extra/doc

[PATCH] D143342: [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

2023-02-16 Thread Mike Crowe via Phabricator via cfe-commits
mikecrowe marked 2 inline comments as done. mikecrowe added a comment. I ended up splitting out the std::format and std::print tests to their own file which meant that I didn't need to modify the existing `redundant-string-cstr.cpp` file in this commit. (Though of course I had to extract the h

[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#4133671 , @Eugene.Zelenko wrote: > May be you could use heard in other test in same patch? I'm not quite sure what you mean by "heard". Searching for "heard" in the LLVM code and Googling "llvm heard" reveal nothin

  1   2   >