Manna added a comment.

Thanks @erichkeane for response.

@MyDeveloperDay, Our internal Coverity link won't work without login. 
This is what Coverity was complaining about.

Big parameter passed by value
Copying large values is inefficient, consider passing by reference; Low, 
medium, and high size thresholds for detection can be adjusted.

1. 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 5)]::​operator 
()(clang::​format::​Environment const &): A very large function call parameter 
exceeding the high threshold is passed by value. (CWE-398)

if (Style.RemoveSemicolon) {
3499      FormatStyle S = Expanded;
3500      S.RemoveSemicolon = true;

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

3501      Passes.emplace_back([&, S](const Environment &Env) {
3502        return SemiRemover(Env, S).process(/*SkipAnnotation=*/true);
3503      });
3504    }

2. 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. (CWE-398)

if (Style.RemoveBracesLLVM) {
3491      FormatStyle S = Expanded;
3492      S.RemoveBracesLLVM = true;

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

3493      Passes.emplace_back([&, S](const Environment &Env) {
3494        return BracesRemover(Env, S).process(/*SkipAnnotation=*/true);
3495      });
3496    }

3. 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 3)]::​operator 
()(clang::​format::​Environment const &): A very large function call parameter 
exceeding the high threshold is passed by value. (CWE-398)

if (Style.InsertBraces) {
3483      FormatStyle S = Expanded;
3484      S.InsertBraces = true;

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

3485      Passes.emplace_back([&, S](const Environment &Env) {
3486        return BracesInserter(Env, S).process(/*SkipAnnotation=*/true);
3487      });
3488    }

In D149647#4316169 <https://reviews.llvm.org/D149647#4316169>, @erichkeane 
wrote:

> In D149647#4316134 <https://reviews.llvm.org/D149647#4316134>, 
> @MyDeveloperDay wrote:
>
>> Can you link to the Coverity issue so we can see what it was complaining 
>> about?
>
> Unfortunately this is from an internal-run of Coverity that Intel is running. 
>  I'd be shocked if it doesn't appear on the open-source/LLVM version though?




Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D149647/new/

https://reviews.llvm.org/D149647

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to