*
* \param options is reserved, always pass 0.
* \param out_buffer_ptr pointer to receive the buffer pointer, which should be
- * disposed using \c free().
+ * disposed using \c clang_free().
* \param out_buffer_size pointer to receive the buffer size.
* \returns 0 for success, non-zero to indicate an error.
*/
char **out_buffer_ptr,
unsigned *out_buffer_size);
+/**
+ * \brief free memory allocated by libclang, such as the buffer returned by
+ * \c CXVirtualFileOverlay() or \c clang_ModuleMapDescriptor_writeToBuffer().
+ *
+ * \param buffer memory pointer to free.
+ */
+CINDEX_LINKAGE void clang_free(void *buffer);
+
/**
* \brief Dispose a \c CXVirtualFileOverlay object.
*/
*
* \param options is reserved, always pass 0.
* \param out_buffer_ptr pointer to receive the buffer pointer, which should be
- * disposed using \c free().
+ * disposed using \c clang_free().
* \param out_buffer_size pointer to receive the buffer size.
* \returns 0 for success, non-zero to indicate an error.
*/
clang_VirtualFileOverlay_writeToBuffer(VFO, 0, &BufPtr, &BufSize);
std::string BufStr(BufPtr, BufSize);
EXPECT_STREQ(Contents, BufStr.c_str());
- free(BufPtr);
+ clang_free(BufPtr);
}
clang_VirtualFileOverlay_dispose(VFO);
}
clang_ModuleMapDescriptor_writeToBuffer(MMD, 0, &BufPtr, &BufSize);
std::string BufStr(BufPtr, BufSize);
EXPECT_STREQ(Contents, BufStr.c_str());
- free(BufPtr);
+ clang_free(BufPtr);
clang_ModuleMapDescriptor_dispose(MMD);
}