aboutsummaryrefslogtreecommitdiff
path: root/clang-tools-extra/clang-tidy/boost/UseRangesCheck.cpp
diff options
context:
space:
mode:
authorNathan Ridge <zeratul976@hotmail.com>2024-10-06 18:13:36 -0400
committerGitHub <noreply@github.com>2024-10-06 18:13:36 -0400
commitacf92a47c0ece8562fd745215c478fe2d4ab5896 (patch)
tree29b496b9143e209939b41d3501304552c1b2cc20 /clang-tools-extra/clang-tidy/boost/UseRangesCheck.cpp
parent7f74651837b8f95996ea4c774b2e604020446951 (diff)
downloadllvm-acf92a47c0ece8562fd745215c478fe2d4ab5896.zip
llvm-acf92a47c0ece8562fd745215c478fe2d4ab5896.tar.gz
llvm-acf92a47c0ece8562fd745215c478fe2d4ab5896.tar.bz2
[clang-tidy] Avoid capturing a local variable in a static lambda in UseRangesCheck (#111282)
Fixes https://github.com/llvm/llvm-project/issues/109367
Diffstat (limited to 'clang-tools-extra/clang-tidy/boost/UseRangesCheck.cpp')
-rw-r--r--clang-tools-extra/clang-tidy/boost/UseRangesCheck.cpp18
1 files changed, 9 insertions, 9 deletions
diff --git a/clang-tools-extra/clang-tidy/boost/UseRangesCheck.cpp b/clang-tools-extra/clang-tidy/boost/UseRangesCheck.cpp
index 4022ea0..e45687f 100644
--- a/clang-tools-extra/clang-tidy/boost/UseRangesCheck.cpp
+++ b/clang-tools-extra/clang-tidy/boost/UseRangesCheck.cpp
@@ -204,7 +204,7 @@ utils::UseRangesCheck::ReplacerMap UseRangesCheck::getReplacerMap() const {
ReplacerMap Results;
static const Signature SingleSig = {{0}};
static const Signature TwoSig = {{0}, {2}};
- static const auto AddFrom =
+ const auto AddFrom =
[&Results](llvm::IntrusiveRefCntPtr<UseRangesCheck::Replacer> Replacer,
std::initializer_list<StringRef> Names, StringRef Prefix) {
llvm::SmallString<64> Buffer;
@@ -214,17 +214,17 @@ utils::UseRangesCheck::ReplacerMap UseRangesCheck::getReplacerMap() const {
}
};
- static const auto AddFromStd =
- [](llvm::IntrusiveRefCntPtr<UseRangesCheck::Replacer> Replacer,
- std::initializer_list<StringRef> Names) {
+ const auto AddFromStd =
+ [&](llvm::IntrusiveRefCntPtr<UseRangesCheck::Replacer> Replacer,
+ std::initializer_list<StringRef> Names) {
AddFrom(Replacer, Names, "std");
};
- static const auto AddFromBoost =
- [](llvm::IntrusiveRefCntPtr<UseRangesCheck::Replacer> Replacer,
- std::initializer_list<
- std::pair<StringRef, std::initializer_list<StringRef>>>
- NamespaceAndNames) {
+ const auto AddFromBoost =
+ [&](llvm::IntrusiveRefCntPtr<UseRangesCheck::Replacer> Replacer,
+ std::initializer_list<
+ std::pair<StringRef, std::initializer_list<StringRef>>>
+ NamespaceAndNames) {
for (auto [Namespace, Names] : NamespaceAndNames)
AddFrom(Replacer, Names,
SmallString<64>{"boost", (Namespace.empty() ? "" : "::"),