[PATCH] D149647: [NFC][Clang]Fix static analyzer tool remarks about large copies by value

Tom Honermann via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue May 2 12:49:50 PDT 2023


tahonermann added a comment.

Thank you for catching that @HazardyKnusperkeks! I completely missed (somehow) that the changed code modified `Expanded`. I offered another suggestion.



================
Comment at: clang/lib/Format/Format.cpp:3486-3489
+      Expanded.InsertBraces = true;
+      Passes.emplace_back([&](const Environment &Env) {
+        return BracesInserter(Env, Expanded).process(/*SkipAnnotation=*/true);
       });
----------------
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.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D149647



More information about the cfe-commits mailing list