[clang-tools-extra] ebda5e1 - [clangd] Fix use-after-free in test
Kadir Cetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Fri Nov 12 05:51:14 PST 2021
Author: Kadir Cetinkaya
Date: 2021-11-12T14:50:23+01:00
New Revision: ebda5e1e521f4e7e47ccddb51a6a1d0d586b4265
URL: https://github.com/llvm/llvm-project/commit/ebda5e1e521f4e7e47ccddb51a6a1d0d586b4265
DIFF: https://github.com/llvm/llvm-project/commit/ebda5e1e521f4e7e47ccddb51a6a1d0d586b4265.diff
LOG: [clangd] Fix use-after-free in test
Added:
Modified:
clang-tools-extra/clangd/unittests/FileIndexTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/unittests/FileIndexTests.cpp b/clang-tools-extra/clangd/unittests/FileIndexTests.cpp
index 5b429d61a9e4..a88900c47884 100644
--- a/clang-tools-extra/clangd/unittests/FileIndexTests.cpp
+++ b/clang-tools-extra/clangd/unittests/FileIndexTests.cpp
@@ -736,7 +736,8 @@ TEST(FileIndexTest, MacrosFromMainFile) {
auto AST = TU.build();
Idx.updateMain(testPath(TU.Filename), AST);
- auto &FooSymbol = findSymbol(runFuzzyFind(Idx, ""), "FOO");
+ auto Slab = runFuzzyFind(Idx, "");
+ auto &FooSymbol = findSymbol(Slab, "FOO");
EXPECT_TRUE(FooSymbol.Flags & Symbol::IndexedForCodeCompletion);
}
More information about the cfe-commits
mailing list