diff --git a/clang-tools-extra/clangd/ConfigCompile.cpp b/clang-tools-extra/clangd/ConfigCompile.cpp index 3d7f792aa136b..13c2405e76df7 100644 --- a/clang-tools-extra/clangd/ConfigCompile.cpp +++ b/clang-tools-extra/clangd/ConfigCompile.cpp @@ -535,7 +535,7 @@ struct FragmentCompiler { } if (Filters->empty()) return std::nullopt; - auto Filter = [Filters](llvm::StringRef Path) { + auto Filter = [Filters = std::move(Filters)](llvm::StringRef Path) { for (auto &Regex : *Filters) if (Regex.match(Path)) return true; diff --git a/clang-tools-extra/clangd/Headers.cpp b/clang-tools-extra/clangd/Headers.cpp index 0ffd9ee4d2751..87fd261b906e6 100644 --- a/clang-tools-extra/clangd/Headers.cpp +++ b/clang-tools-extra/clangd/Headers.cpp @@ -305,14 +305,14 @@ IncludeInserter::calculateIncludePath(const HeaderFile &InsertedHeader, if (llvm::sys::path::is_absolute(Suggested)) return std::nullopt; bool IsAngled = false; - for (auto Filter : AngledHeaders) { + for (auto &Filter : AngledHeaders) { if (Filter(Suggested)) { IsAngled = true; break; } } bool IsQuoted = false; - for (auto Filter : QuotedHeaders) { + for (auto &Filter : QuotedHeaders) { if (Filter(Suggested)) { IsQuoted = true; break;