[clang-tools-extra] 89cb5d5 - [clangd] Delete remapped buffers in tests
Kadir Cetinkaya via cfe-commits
cfe-commits at lists.llvm.org
Thu Apr 23 07:34:42 PDT 2020
Author: Kadir Cetinkaya
Date: 2020-04-23T16:31:35+02:00
New Revision: 89cb5d558895706e053bc3af972aa5b15aa82863
URL: https://github.com/llvm/llvm-project/commit/89cb5d558895706e053bc3af972aa5b15aa82863
DIFF: https://github.com/llvm/llvm-project/commit/89cb5d558895706e053bc3af972aa5b15aa82863.diff
LOG: [clangd] Delete remapped buffers in tests
These buffers normally get freed after being used in a CompilerInstance.
but tests don't make use of those, so we need to free them explicitly.
Added:
Modified:
clang-tools-extra/clangd/unittests/PreambleTests.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/clangd/unittests/PreambleTests.cpp b/clang-tools-extra/clangd/unittests/PreambleTests.cpp
index 6382285b63fc..5ff7ebc27e09 100644
--- a/clang-tools-extra/clangd/unittests/PreambleTests.cpp
+++ b/clang-tools-extra/clangd/unittests/PreambleTests.cpp
@@ -91,6 +91,8 @@ TEST(PreamblePatchTest, IncludeParsing) {
PreamblePatch::create(FileName, PI, *EmptyPreamble).apply(*CI);
EXPECT_THAT(CI->getPreprocessorOpts().RemappedFileBuffers,
Contains(Pair(_, HasContents(ExpectedBuffer))));
+ for (const auto &RB : CI->getPreprocessorOpts().RemappedFileBuffers)
+ delete RB.second;
}
}
@@ -120,6 +122,8 @@ TEST(PreamblePatchTest, ContainsNewIncludes) {
PreamblePatch::create(FileName, PI, *FullPreamble).apply(*CI);
EXPECT_THAT(CI->getPreprocessorOpts().RemappedFileBuffers,
Contains(Pair(_, HasContents(Patch))));
+ for (const auto &RB : CI->getPreprocessorOpts().RemappedFileBuffers)
+ delete RB.second;
}
} // namespace
More information about the cfe-commits
mailing list