[all-commits] [llvm/llvm-project] babe86: [NFC][Clang] Fix static analyzer tool remarks abou...

smanna12 via All-commits all-commits at lists.llvm.org
Fri May 5 18:58:43 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: babe8629d73fb52bf85516222cd484da0eed6c12
      https://github.com/llvm/llvm-project/commit/babe8629d73fb52bf85516222cd484da0eed6c12
  Author: Manna, Soumi <soumi.manna at intel.com>
  Date:   2023-05-05 (Fri, 05 May 2023)

  Changed paths:
    M clang/lib/Format/Format.cpp

  Log Message:
  -----------
  [NFC][Clang] Fix static analyzer tool remarks about large copies by values in Format.cpp file

Reported by Static Analyzer Tool, Coverity:

Inside "Format.cpp" file, in clang::format::internal::reformat(clang::format::FormatStyle const &, llvm::StringRef, llvm::ArrayRef<clang::tooling::Range>, unsigned int, unsigned int, unsigned int, llvm::StringRef, clang::format::FormattingAttemptStatus *)::[lambda(clang::format::Environment const &) (instance 4)]::operator ()(clang::format::Environment const &): A very large function call parameter exceeding the high threshold is passed by value.

pass_by_value: Capturing variable S of type clang::format::FormatStyle (size 808 bytes) by value, which exceeds the high threshold of 512 bytes

This patch uses original code but with an init capture that does a move instead of a copy.

Reviewed By: tahonermann, erichkeane, MyDeveloperDay, owenpan, HazardyKnusperkeks

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




More information about the All-commits mailing list