[clang-tools-extra] r352957 - [clangd] Fix heap-use-after-free after r352868
Eric Liu via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 2 02:35:39 PST 2019
Author: ioeric
Date: Sat Feb 2 02:35:39 2019
New Revision: 352957
URL: http://llvm.org/viewvc/llvm-project?rev=352957&view=rev
Log:
[clangd] Fix heap-use-after-free after r352868
Modified:
clang-tools-extra/trunk/unittests/clangd/QualityTests.cpp
Modified: clang-tools-extra/trunk/unittests/clangd/QualityTests.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/unittests/clangd/QualityTests.cpp?rev=352957&r1=352956&r2=352957&view=diff
==============================================================================
--- clang-tools-extra/trunk/unittests/clangd/QualityTests.cpp (original)
+++ clang-tools-extra/trunk/unittests/clangd/QualityTests.cpp Sat Feb 2 02:35:39 2019
@@ -180,14 +180,17 @@ TEST(QualityTests, SymbolRelevanceSignal
EXPECT_TRUE(Relevance.InBaseClass);
auto Index = Test.index();
- Symbol X;
FuzzyFindRequest Req;
Req.Query = "X";
Req.AnyScope = true;
- Index->fuzzyFind(Req, [&X](const Symbol& S){ X = S; });
- Relevance = {};
- Relevance.merge(X);
- EXPECT_EQ(Relevance.Scope, SymbolRelevanceSignals::FileScope);
+ bool Matched = false;
+ Index->fuzzyFind(Req, [&](const Symbol &S) {
+ Matched = true;
+ Relevance = {};
+ Relevance.merge(S);
+ EXPECT_EQ(Relevance.Scope, SymbolRelevanceSignals::FileScope);
+ });
+ EXPECT_TRUE(Matched);
}
// Do the signals move the scores in the direction we expect?
More information about the cfe-commits
mailing list