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

André Schackier via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Apr 14 03:14:12 PDT 2023


AMS21 created this revision.
AMS21 added a reviewer: PiotrZSL.
Herald added subscribers: ChuanqiXu, carlosgalvezp, xazax.hun.
Herald added a reviewer: njames93.
Herald added a project: All.
AMS21 requested review of this revision.
Herald added a project: clang-tools-extra.
Herald added a subscriber: cfe-commits.

This check flags uses of `std::endl` on iostreams and suggests using the newline character `'\n'` instead. `std::endl` performs two operations: it writes a newline character to the output stream and then flushes the stream buffer, which can be less efficient than writing a single newline character using `'\n'`.

This fixes llvm#35321


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D148318

Files:
  clang-tools-extra/clang-tidy/performance/CMakeLists.txt
  clang-tools-extra/clang-tidy/performance/DontUseEndlCheck.cpp
  clang-tools-extra/clang-tidy/performance/DontUseEndlCheck.h
  clang-tools-extra/clang-tidy/performance/PerformanceTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/docs/clang-tidy/checks/performance/dont-use-endl.rst
  clang-tools-extra/test/clang-tidy/checkers/performance/dont-use-endl.cpp

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D148318.513513.patch
Type: text/x-patch
Size: 10256 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20230414/1974d370/attachment-0001.bin>


More information about the cfe-commits mailing list