Add clang_getNullCursor() and clang_equalCursors() (the latter for comparing cursors).

llvm-svn: 89131
This commit is contained in:
Ted Kremenek 2009-11-17 19:28:59 +00:00
parent 57be2f2c40
commit e05d7806ff
3 changed files with 18 additions and 0 deletions

View File

@ -294,6 +294,8 @@ CINDEX_LINKAGE CXFile clang_getDeclSourceFile(CXDecl);
*/
CINDEX_LINKAGE CXCursor clang_getCursor(CXTranslationUnit, const char *source_name,
unsigned line, unsigned column);
CINDEX_LINKAGE CXCursor clang_getNullCursor(void);
CINDEX_LINKAGE enum CXCursorKind clang_getCursorKind(CXCursor);
CINDEX_LINKAGE unsigned clang_isDeclaration(enum CXCursorKind);
@ -301,6 +303,8 @@ CINDEX_LINKAGE unsigned clang_isReference(enum CXCursorKind);
CINDEX_LINKAGE unsigned clang_isDefinition(enum CXCursorKind);
CINDEX_LINKAGE unsigned clang_isInvalid(enum CXCursorKind);
CINDEX_LINKAGE unsigned clang_equalCursors(CXCursor, CXCursor);
CINDEX_LINKAGE unsigned clang_getCursorLine(CXCursor);
CINDEX_LINKAGE unsigned clang_getCursorColumn(CXCursor);
CINDEX_LINKAGE CXString clang_getCursorSpelling(CXCursor);

View File

@ -875,6 +875,18 @@ CXCursor clang_getCursor(CXTranslationUnit CTUnit, const char *source_name,
return C;
}
CXCursor clang_getNullCursor(void) {
CXCursor C;
C.kind = CXCursor_InvalidFile;
C.decl = NULL;
C.stmt = NULL;
return C;
}
unsigned clang_equalCursors(CXCursor X, CXCursor Y) {
return X.kind == Y.kind && X.decl == Y.decl && X.stmt == Y.stmt;
}
CXCursor clang_getCursorFromDecl(CXDecl AnonDecl)
{
assert(AnonDecl && "Passed null CXDecl");

View File

@ -5,6 +5,7 @@ _clang_createTranslationUnitFromSourceFile
_clang_disposeIndex
_clang_disposeString
_clang_disposeTranslationUnit
_clang_equalCursors
_clang_getCompletionChunkCompletionString
_clang_getCompletionChunkKind
_clang_getCompletionChunkText
@ -30,6 +31,7 @@ _clang_getEntity
_clang_getEntityFromDecl
_clang_getFileName
_clang_getFileTime
_clang_getNullCursor
_clang_getNumCompletionChunks
_clang_getTranslationUnitSpelling
_clang_getURI