[clang] 160a750 - [clang-repl][test] Suppress memory lease after #76218

Vitaly Buka via cfe-commits cfe-commits at lists.llvm.org
Thu Jan 18 13:09:29 PST 2024


Author: Vitaly Buka
Date: 2024-01-18T13:09:13-08:00
New Revision: 160a750e63256e58fc171f1b6cccf8b61bb05f42

URL: https://github.com/llvm/llvm-project/commit/160a750e63256e58fc171f1b6cccf8b61bb05f42
DIFF: https://github.com/llvm/llvm-project/commit/160a750e63256e58fc171f1b6cccf8b61bb05f42.diff

LOG: [clang-repl][test] Suppress memory lease after #76218

`new` was introduced in this patch, but I don't see `delete` to release
the memory.

Added: 
    

Modified: 
    clang/unittests/Interpreter/InterpreterTest.cpp

Removed: 
    


################################################################################
diff  --git a/clang/unittests/Interpreter/InterpreterTest.cpp b/clang/unittests/Interpreter/InterpreterTest.cpp
index 1e0854b3c4af46..d6eb0684ba49d8 100644
--- a/clang/unittests/Interpreter/InterpreterTest.cpp
+++ b/clang/unittests/Interpreter/InterpreterTest.cpp
@@ -34,6 +34,12 @@ using namespace clang;
 #define CLANG_INTERPRETER_NO_SUPPORT_EXEC
 #endif
 
+#if LLVM_ADDRESS_SANITIZER_BUILD || LLVM_HWADDRESS_SANITIZER_BUILD
+#include <sanitizer/lsan_interface.h>
+#else
+extern "C" void __lsan_ignore_object(const void *p) {}
+#endif
+
 int Global = 42;
 // JIT reports symbol not found on Windows without the visibility attribute.
 REPL_EXTERNAL_VISIBILITY int getGlobal() { return Global; }
@@ -311,6 +317,8 @@ TEST(IncrementalProcessing, InstantiateTemplate) {
   auto fn =
       cantFail(Interp->getSymbolAddress(MangledName)).toPtr<TemplateSpecFn>();
   EXPECT_EQ(42, fn(NewA.getPtr()));
+  // FIXME: release the memory.
+  __lsan_ignore_object(NewA.getPtr());
 }
 
 #ifdef CLANG_INTERPRETER_NO_SUPPORT_EXEC


        


More information about the cfe-commits mailing list