Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 2 commits into from
Apr 3, 2024

Conversation

owenca
Copy link
Contributor

@owenca owenca commented Apr 2, 2024

Closes #87254.

@llvmbot
Copy link
Collaborator

llvmbot commented Apr 2, 2024

@llvm/pr-subscribers-clang-format

Author: Owen Pan (owenca)

Changes

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 --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);
   };

clang/lib/Format/Format.cpp Outdated Show resolved Hide resolved
Copy link
Collaborator

@RKSimon RKSimon left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM - cheers

@owenca owenca merged commit 72e2e4f into llvm:main Apr 3, 2024
4 checks passed
@owenca owenca deleted the 87254 branch April 3, 2024 16:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

clang/lib/Format/Format.cpp:3581: vector copy problem ?
4 participants