[all-commits] [llvm/llvm-project] cd8933: [clang-tidy] Add `performance-avoid-endl` check

AMS21 via All-commits all-commits at lists.llvm.org
Sat Apr 22 03:51:33 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: cd893308b5d4d058b8ec6a2c4b00843d89e25552
      https://github.com/llvm/llvm-project/commit/cd893308b5d4d058b8ec6a2c4b00843d89e25552
  Author: AMS21 <AMS21.github at gmail.com>
  Date:   2023-04-22 (Sat, 22 Apr 2023)

  Changed paths:
    A clang-tools-extra/clang-tidy/performance/AvoidEndlCheck.cpp
    A clang-tools-extra/clang-tidy/performance/AvoidEndlCheck.h
    M clang-tools-extra/clang-tidy/performance/CMakeLists.txt
    M clang-tools-extra/clang-tidy/performance/PerformanceTidyModule.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/docs/clang-tidy/checks/list.rst
    A clang-tools-extra/docs/clang-tidy/checks/performance/avoid-endl.rst
    A clang-tools-extra/test/clang-tidy/checkers/performance/avoid-endl.cpp

  Log Message:
  -----------
  [clang-tidy] Add `performance-avoid-endl` check

This check flags uses of `std::endl` on streams 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

Reviewed By: PiotrZSL

Differential Revision: https://reviews.llvm.org/D148318




More information about the All-commits mailing list