Add clang_disposeTranslationUnit() and clang_disposeIndex().
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@82154 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index 1efb50f..b2fca60 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -190,6 +190,12 @@
return new Indexer(*new Program(), *new FileManager());
}
+void clang_disposeIndex(CXIndex CIdx)
+{
+ assert(CIdx && "Passed null CXIndex");
+ delete static_cast<Indexer *>(CIdx);
+}
+
// FIXME: need to pass back error info.
CXTranslationUnit clang_createTranslationUnit(
CXIndex CIdx, const char *ast_filename)
@@ -202,6 +208,13 @@
return ASTUnit::LoadFromPCHFile(astName, CXXIdx->getFileManager(), &ErrMsg);
}
+void clang_disposeTranslationUnit(
+ CXTranslationUnit CTUnit)
+{
+ assert(CTUnit && "Passed null CXTranslationUnit");
+ delete static_cast<ASTUnit *>(CTUnit);
+}
+
const char *clang_getTranslationUnitSpelling(CXTranslationUnit CTUnit)
{
assert(CTUnit && "Passed null CXTranslationUnit");
diff --git a/tools/CIndex/CIndex.exports b/tools/CIndex/CIndex.exports
index 17aba04..a06d7bc 100644
--- a/tools/CIndex/CIndex.exports
+++ b/tools/CIndex/CIndex.exports
@@ -1,4 +1,5 @@
_clang_createIndex
+_clang_disposeIndex
_clang_getCursor
_clang_getCursorColumn
_clang_getCursorDecl
@@ -14,6 +15,7 @@
_clang_loadDeclaration
_clang_loadTranslationUnit
_clang_createTranslationUnit
+_clang_disposeTranslationUnit
_clang_isDeclaration
_clang_isReference
_clang_isDefinition