Commit 0857b1de authored by Christian Hergert's avatar Christian Hergert
Browse files

clang: add g_auto() helpers

parent 48758207
......@@ -33,7 +33,9 @@ IdeClangTranslationUnit *_ide_clang_translation_unit_new (IdeContext
IdeHighlightIndex *index,
gint64 serial);
void _ide_clang_dispose_diagnostic (CXDiagnostic *diag);
void _ide_clang_dispose_index (CXIndex *index);
void _ide_clang_dispose_string (CXString *str);
void _ide_clang_dispose_unit (CXTranslationUnit *unit);
IdeSymbolNode *_ide_clang_symbol_node_new (IdeContext *context,
CXCursor cursor);
CXCursor _ide_clang_symbol_node_get_cursor (IdeClangSymbolNode *self);
......@@ -42,6 +44,9 @@ void _ide_clang_symbol_node_set_children (IdeClangSymbolNode
GArray *children);
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (CXString, _ide_clang_dispose_string)
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (CXIndex, _ide_clang_dispose_index)
G_DEFINE_AUTO_CLEANUP_CLEAR_FUNC (CXTranslationUnit, _ide_clang_dispose_unit)
G_DEFINE_AUTOPTR_CLEANUP_FUNC (CXDiagnostic, _ide_clang_dispose_diagnostic)
G_END_DECLS
......@@ -829,3 +829,17 @@ _ide_clang_dispose_diagnostic (CXDiagnostic *diag)
if (diag != NULL)
clang_disposeDiagnostic (diag);
}
void
_ide_clang_dispose_index (CXIndex *idx)
{
if (idx != NULL && *idx != NULL)
clang_disposeIndex (*idx);
}
void
_ide_clang_dispose_unit (CXTranslationUnit *unit)
{
if (unit != NULL && *unit != NULL)
clang_disposeTranslationUnit (*unit);
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment