aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2009-11-17 19:28:59 +0000
committerTed Kremenek <kremenek@apple.com>2009-11-17 19:28:59 +0000
commit738855554394a6afcf39cc8345fd22c3756b8dd0 (patch)
tree95ab3c13b4bc0a7bb5ea92d687f66f7d7200ccd0
parentaa069aee2e6290af170a48110641a43f80d25840 (diff)
Add clang_getNullCursor() and clang_equalCursors() (the latter for comparing cursors).
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@89131 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang-c/Index.h4
-rw-r--r--tools/CIndex/CIndex.cpp12
-rw-r--r--tools/CIndex/CIndex.exports2
3 files changed, 18 insertions, 0 deletions
diff --git a/include/clang-c/Index.h b/include/clang-c/Index.h
index ccdddf6cdb..85f7a6a31b 100644
--- a/include/clang-c/Index.h
+++ b/include/clang-c/Index.h
@@ -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);
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp
index 2e0eafebb2..ebdba29d92 100644
--- a/tools/CIndex/CIndex.cpp
+++ b/tools/CIndex/CIndex.cpp
@@ -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");
diff --git a/tools/CIndex/CIndex.exports b/tools/CIndex/CIndex.exports
index df94c6a5e1..2892ce50e7 100644
--- a/tools/CIndex/CIndex.exports
+++ b/tools/CIndex/CIndex.exports
@@ -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