[all-commits] [llvm/llvm-project] 57b78f: [clang-tidy] Support std::format and std::print in...

Mike Crowe via All-commits all-commits at lists.llvm.org
Sun Mar 12 14:43:28 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 57b78faa9eb08017d95bb4e43242648953b08c13
      https://github.com/llvm/llvm-project/commit/57b78faa9eb08017d95bb4e43242648953b08c13
  Author: Mike Crowe <mac at mcrowe.com>
  Date:   2023-03-12 (Sun, 12 Mar 2023)

  Changed paths:
    M clang-tools-extra/clang-tidy/readability/RedundantStringCStrCheck.cpp
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string
    A clang-tools-extra/test/clang-tidy/checkers/readability/redundant-string-cstr-format.cpp

  Log Message:
  -----------
  [clang-tidy] Support std::format and std::print in readability-redundant-string-cstr

std::format (C++20) and std::print (C++23) are perfectly happy to accept
std::string arguments. Converting them to C-style strings by calling
c_str() is unnecessary and may cause extra walking of the string to
determine its length.

Depends on D144216

Reviewed By: carlosgalvezp, PiotrZSL

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




More information about the All-commits mailing list