[clang] 7f43120 - [Serialization] Free memory in LoadSpecLazilyTest

Ilya Biryukov via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 12 02:19:35 PST 2024


Author: Ilya Biryukov
Date: 2024-12-12T11:19:11+01:00
New Revision: 7f4312015291a32d811a0f37e24b4d9736c524f7

URL: https://github.com/llvm/llvm-project/commit/7f4312015291a32d811a0f37e24b4d9736c524f7
DIFF: https://github.com/llvm/llvm-project/commit/7f4312015291a32d811a0f37e24b4d9736c524f7.diff

LOG: [Serialization] Free memory in LoadSpecLazilyTest

Default Clang invocations set DisableFree = true, which causes ASAN to
complain. Override it in tests that are not supposed to leak.

Added: 
    

Modified: 
    clang/unittests/Serialization/LoadSpecLazilyTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Serialization/LoadSpecLazilyTest.cpp b/clang/unittests/Serialization/LoadSpecLazilyTest.cpp
index 0e452652a940d5..7cc074c51fcd03 100644
--- a/clang/unittests/Serialization/LoadSpecLazilyTest.cpp
+++ b/clang/unittests/Serialization/LoadSpecLazilyTest.cpp
@@ -82,6 +82,8 @@ class LoadSpecLazilyTest : public ::testing::Test {
     Instance.setDiagnostics(Diags.get());
     Instance.setInvocation(Invocation);
     Instance.getFrontendOpts().OutputFile = CacheBMIPath;
+    // Avoid memory leaks.
+    Instance.getFrontendOpts().DisableFree = false;
     GenerateModuleInterfaceAction Action;
     EXPECT_TRUE(Instance.ExecuteAction(Action));
     EXPECT_FALSE(Diags->hasErrorOccurred());


        


More information about the cfe-commits mailing list