[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/

[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:

[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

[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/

[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

[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/

[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

[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/

[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

[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

[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

[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

[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/

[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:

[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] 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

[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] 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/

[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

[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 + <<

[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

[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:

[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

[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

[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

[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

[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] 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

[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 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 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

[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] 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}

[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 >

[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

[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

[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

[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:

[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

[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()) { +

[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

[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( +

[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-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 , const char

[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] 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:

[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:

[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:

[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

[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:

[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] 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-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

[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] 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

[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: -

[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-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

[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:

[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'

[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

[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,

[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

[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

[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

[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/

[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/

[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

[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:

[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:

[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

[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

[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 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] 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

[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-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

[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] 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

[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

[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] 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: [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-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

[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] 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] 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 {};

[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

[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:

[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

[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] 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

[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 > .

[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

[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

[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

[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

[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: -

[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

  1   2   >