[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-22 Thread Piotr Zegar via Phabricator via cfe-commits
This revision was automatically updated to reflect the committed changes. Closed by commit rGcd893308b5d4: [clang-tidy] Add `performance-avoid-endl` check (authored by AMS21, committed by PiotrZSL). Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-22 Thread André Schackier via Phabricator via cfe-commits
AMS21 added a comment. If someone could be so kind as to push this on my behalf, it would be greatly appreciated Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148318/new/ https://reviews.llvm.org/D148318

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-20 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL accepted this revision. PiotrZSL added a comment. This revision is now accepted and ready to land. More or less looks good. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148318/new/ https://reviews.llvm.org/D148318

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-20 Thread André Schackier via Phabricator via cfe-commits
AMS21 added inline comments. Comment at: clang-tools-extra/clang-tidy/performance/AvoidEndlCheck.cpp:48-51 +const CharSourceRange TokenRange = +CharSourceRange::getTokenRange(Expression->getSourceRange()); +const StringRef SourceText = Lexer::getSourceText( +

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-20 Thread André Schackier via Phabricator via cfe-commits
AMS21 updated this revision to Diff 515283. AMS21 marked 12 inline comments as done. AMS21 added a comment. Implement suggested changes. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148318/new/ https://reviews.llvm.org/D148318 Files:

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-19 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL added a comment. Overall looks good, didn't found any bugs, just some potential improvements. Comment at: clang-tools-extra/clang-tidy/performance/AvoidEndlCheck.cpp:23 +void AvoidEndlCheck::registerMatchers(MatchFinder *Finder) { + Finder->addMatcher( +

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-19 Thread André Schackier via Phabricator via cfe-commits
AMS21 updated this revision to Diff 514908. AMS21 added a comment. Minor code cleanup Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148318/new/ https://reviews.llvm.org/D148318 Files: clang-tools-extra/clang-tidy/performance/AvoidEndlCheck.cpp

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-17 Thread André Schackier via Phabricator via cfe-commits
AMS21 updated this revision to Diff 514367. AMS21 added a comment. Fix docs Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148318/new/ https://reviews.llvm.org/D148318 Files: clang-tools-extra/clang-tidy/performance/AvoidEndlCheck.cpp

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-17 Thread André Schackier via Phabricator via cfe-commits
AMS21 updated this revision to Diff 514366. AMS21 added a comment. Handle the function calling case Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148318/new/ https://reviews.llvm.org/D148318 Files:

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-17 Thread André Schackier via Phabricator via cfe-commits
AMS21 added a comment. I've also notices that we don't handle this case std::endl(std::cout); Although a rather unusual thing to use, its still valid and has the same problems. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148318/new/

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-17 Thread André Schackier via Phabricator via cfe-commits
AMS21 updated this revision to Diff 514118. AMS21 added a comment. Remove std::ends from the check Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148318/new/ https://reviews.llvm.org/D148318 Files:

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-15 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL added inline comments. Comment at: clang-tools-extra/clang-tidy/performance/AvoidEndlEndsCheck.cpp:28 + declRefExpr( + to(namedDecl(hasAnyName("endl", "ends")).bind("decl"))) + .bind("expr", njames93

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-15 Thread Nathan James via Phabricator via cfe-commits
njames93 added inline comments. Comment at: clang-tools-extra/clang-tidy/performance/AvoidEndlEndsCheck.cpp:28 + declRefExpr( + to(namedDecl(hasAnyName("endl", "ends")).bind("decl"))) + .bind("expr", Why are you

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-15 Thread André Schackier via Phabricator via cfe-commits
AMS21 added inline comments. Comment at: clang-tools-extra/test/clang-tidy/checkers/performance/avoid-endl.cpp:46 +void bad() { + std::cout << "World" << std::endl; + // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: do not use std::endl with iostreams; use '\n' instead

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-15 Thread André Schackier via Phabricator via cfe-commits
AMS21 updated this revision to Diff 513878. AMS21 marked 12 inline comments as done. AMS21 added a comment. Implement suggested fixes Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D148318/new/ https://reviews.llvm.org/D148318 Files:

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-14 Thread Nathan James via Phabricator via cfe-commits
njames93 added a comment. For what its worth, there typically isn't any performance gain using `\n` over `std::endl` when writing to `std::cerr` or `std::clog` (or their wide string counterparts) as every write operation on those implicitly calls flush. However If the fix was changed to convert

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-14 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL added inline comments. Comment at: clang-tools-extra/clang-tidy/performance/AvoidEndlCheck.cpp:1 +//===--- AvoidEndlCheck.cpp - clang-tidy ===// +// rename script got problem with this comment, you may need to align it

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-14 Thread Piotr Zegar via Phabricator via cfe-commits
PiotrZSL added a comment. Consider extending this check to suport also std::ends, maybe name it performance-avoid-endl-ends. Comment at: clang-tools-extra/clang-tidy/performance/DontUseEndlCheck.cpp:26 + callee(cxxMethodDecl(ofClass( +

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-14 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added inline comments. Comment at: clang-tools-extra/test/clang-tidy/checkers/performance/avoid-endl.cpp:47 + std::cout << "World" << std::endl; + // CHECK-MESSAGES: :[[@LINE-1]]:27: warning: do not use std::endl with iostreams; use '\n' instead + std::cerr <<

[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check

2023-04-14 Thread Carlos Galvez via Phabricator via cfe-commits
carlosgalvezp added a comment. Thank you for the contribution! Looks good in general, have minor comments. Comment at: clang-tools-extra/docs/clang-tidy/checks/performance/avoid-endl.rst:1 +.. title:: clang-tidy - performance-avoid-endl + Please wrap file to