Skip to content

Commit 44d6f9e

Browse files
author
Eric Liu
committed
[clangd] Fix heap-use-after-free after r352868
llvm-svn: 352957
1 parent 1be906a commit 44d6f9e

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

clang-tools-extra/unittests/clangd/QualityTests.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -180,14 +180,17 @@ TEST(QualityTests, SymbolRelevanceSignalExtraction) {
180180
EXPECT_TRUE(Relevance.InBaseClass);
181181

182182
auto Index = Test.index();
183-
Symbol X;
184183
FuzzyFindRequest Req;
185184
Req.Query = "X";
186185
Req.AnyScope = true;
187-
Index->fuzzyFind(Req, [&X](const Symbol& S){ X = S; });
188-
Relevance = {};
189-
Relevance.merge(X);
190-
EXPECT_EQ(Relevance.Scope, SymbolRelevanceSignals::FileScope);
186+
bool Matched = false;
187+
Index->fuzzyFind(Req, [&](const Symbol &S) {
188+
Matched = true;
189+
Relevance = {};
190+
Relevance.merge(S);
191+
EXPECT_EQ(Relevance.Scope, SymbolRelevanceSignals::FileScope);
192+
});
193+
EXPECT_TRUE(Matched);
191194
}
192195

193196
// Do the signals move the scores in the direction we expect?

0 commit comments

Comments
 (0)