From 45a5bfef44c1e0a825e695ced1f9a91641042171 Mon Sep 17 00:00:00 2001 From: Yaron Keren Date: Thu, 9 Jul 2015 07:53:23 +0000 Subject: Add clang_free to libclang to free memory allocated in libclang. One of the problems libclang tests has running under Windows is memory allocated in libclang.dll but being freed in the test executable, possibly by a different memory manager. This patch exposes a new export function, clang_free(), used to free any allocated memory with the same libclang.dll memory manager that allocated the memory. http://reviews.llvm.org/D10949 Reviewed by Reid Kleckner, Douglas Gregor. llvm-svn: 241789 --- clang/tools/libclang/BuildSystem.cpp | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'clang/tools/libclang/BuildSystem.cpp') diff --git a/clang/tools/libclang/BuildSystem.cpp b/clang/tools/libclang/BuildSystem.cpp index e9423c32869..fe3db755eba 100644 --- a/clang/tools/libclang/BuildSystem.cpp +++ b/clang/tools/libclang/BuildSystem.cpp @@ -84,6 +84,10 @@ clang_VirtualFileOverlay_writeToBuffer(CXVirtualFileOverlay VFO, unsigned, return CXError_Success; } +void clang_free(void *buffer) { + free(buffer); +} + void clang_VirtualFileOverlay_dispose(CXVirtualFileOverlay VFO) { delete unwrap(VFO); } -- cgit v1.2.3