Reported by Static Analyzer Tool:
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 removes redundant capturing variable S and passes type clang::format::FormatStyle Expanded instead as parameter in functions: BracesInserter(), BracesRemover(), and SemiRemover().
How about using an init capture instead? This will suffice to avoid one of the copies but means that InsertBraces doesn't get set until the lambda is invoked. I wouldn't expect that to matter though.