[libclang] Introduce clang_Cursor_isNull and clang_Cursor_getTranslationUnit functions.

llvm-svn: 140587
This commit is contained in:
Argyrios Kyrtzidis 2011-09-27 00:30:30 +00:00
parent 698bd3113e
commit d6e9fa55eb
3 changed files with 21 additions and 0 deletions

View File

@ -1554,6 +1554,13 @@ CINDEX_LINKAGE CXCursor clang_getTranslationUnitCursor(CXTranslationUnit);
*/
CINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor);
/**
* \brief Returns non-zero if \arg cursor is null.
*/
static inline int clang_Cursor_isNull(CXCursor cursor) {
return clang_equalCursors(cursor, clang_getNullCursor());
}
/**
* \brief Compute a hash value for the given cursor.
*/
@ -1669,6 +1676,11 @@ CINDEX_LINKAGE enum CXLanguageKind {
*/
CINDEX_LINKAGE enum CXLanguageKind clang_getCursorLanguage(CXCursor cursor);
/**
* \brief Returns the translation unit that a cursor originated from.
*/
CINDEX_LINKAGE CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor);
/**
* \brief A fast container representing a set of CXCursors.

View File

@ -518,6 +518,14 @@ bool cxcursor::isFirstInDeclGroup(CXCursor C) {
return ((uintptr_t) (C.data[1])) != 0;
}
//===----------------------------------------------------------------------===//
// libclang CXCursor APIs
//===----------------------------------------------------------------------===//
CXTranslationUnit clang_Cursor_getTranslationUnit(CXCursor cursor) {
return getCursorTU(cursor);
}
//===----------------------------------------------------------------------===//
// CXCursorSet.
//===----------------------------------------------------------------------===//

View File

@ -20,6 +20,7 @@ clang_createCXCursorSet
clang_createIndex
clang_createTranslationUnit
clang_createTranslationUnitFromSourceFile
clang_Cursor_getTranslationUnit
clang_defaultCodeCompleteOptions
clang_defaultDiagnosticDisplayOptions
clang_defaultEditingTranslationUnitOptions