[clang] [clang-format] Lambda parameter should be passed by const reference (PR #87306)

via cfe-commits cfe-commits at lists.llvm.org
Mon Apr 1 20:11:55 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-clang-format

Author: Owen Pan (owenca)

<details>
<summary>Changes</summary>

Closes #<!-- -->87254.

---
Full diff: https://github.com/llvm/llvm-project/pull/87306.diff


1 Files Affected:

- (modified) clang/lib/Format/Format.cpp (+1-1) 


``````````diff
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 46ed5baaeacead..1a45d5089e209c 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -3578,7 +3578,7 @@ cleanupAroundReplacements(StringRef Code, const tooling::Replacements &Replaces,
   // We need to use lambda function here since there are two versions of
   // `cleanup`.
   auto Cleanup = [](const FormatStyle &Style, StringRef Code,
-                    std::vector<tooling::Range> Ranges,
+                    const std::vector<tooling::Range> &Ranges,
                     StringRef FileName) -> tooling::Replacements {
     return cleanup(Style, Code, Ranges, FileName);
   };

``````````

</details>


https://github.com/llvm/llvm-project/pull/87306


More information about the cfe-commits mailing list