[PATCH] D148318: [clang-tidy] Add `performance-avoid-endl` check
André Schackier via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Sat Apr 15 03:11:46 PDT 2023
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
----------------
njames93 wrote:
> I know it's asking a lot, but it would be amazing if the fix here could be changed to
> ```lang=c++
> std::cout << "World\n";```
> To do this would require checking if the first argument to the `endl` `operator<<` call was another `operator<<` call whose second argument was a string literal.
I agree this would be even cleaner
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D148318/new/
https://reviews.llvm.org/D148318
More information about the cfe-commits
mailing list