diff options
-rw-r--r-- | tools/CIndex/CIndex.cpp | 4 | ||||
-rw-r--r-- | tools/CIndex/CXCursor.cpp | 17 | ||||
-rw-r--r-- | tools/CIndex/CXCursor.h | 4 |
3 files changed, 9 insertions, 16 deletions
diff --git a/tools/CIndex/CIndex.cpp b/tools/CIndex/CIndex.cpp index b9bd48f024..267fcf7336 100644 --- a/tools/CIndex/CIndex.cpp +++ b/tools/CIndex/CIndex.cpp @@ -797,11 +797,11 @@ CXCursor clang_getCursor(CXTranslationUnit CTUnit, const char *source_name, } return MakeCXCursor(Dcl); } - return MakeCXCursor(CXCursor_NoDeclFound, 0); + return MakeCXCursorInvalid(CXCursor_NoDeclFound); } CXCursor clang_getNullCursor(void) { - return MakeCXCursor(CXCursor_InvalidFile, 0); + return MakeCXCursorInvalid(CXCursor_InvalidFile); } unsigned clang_equalCursors(CXCursor X, CXCursor Y) { diff --git a/tools/CIndex/CXCursor.cpp b/tools/CIndex/CXCursor.cpp index 7dd3ae9cc0..7c8b33d1ae 100644 --- a/tools/CIndex/CXCursor.cpp +++ b/tools/CIndex/CXCursor.cpp @@ -22,16 +22,10 @@ using namespace clang; -CXCursor cxcursor::MakeCXCursor(CXCursorKind K, Decl *D) { - CXCursor C = { K, { D, 0, 0 } }; - return C; -} - -CXCursor cxcursor::MakeCXCursor(CXCursorKind K, Decl *D, Stmt *S, - ASTContext &Context) { - assert(clang_isReference(K)); - CXCursor C = { K, { D, S, &Context } }; - return C; +CXCursor cxcursor::MakeCXCursorInvalid(CXCursorKind K) { + assert(K >= CXCursor_FirstInvalid && K <= CXCursor_LastInvalid); + CXCursor C = { K, { 0, 0, 0 } }; + return C; } static CXCursorKind GetCursorKind(Decl *D) { @@ -78,7 +72,8 @@ static CXCursorKind GetCursorKind(Decl *D) { } CXCursor cxcursor::MakeCXCursor(Decl *D) { - return MakeCXCursor(GetCursorKind(D), D); + CXCursor C = { GetCursorKind(D), { D, 0, 0 } }; + return C; } CXCursor cxcursor::MakeCXCursor(Stmt *S, Decl *Parent) { diff --git a/tools/CIndex/CXCursor.h b/tools/CIndex/CXCursor.h index a203ba633f..9c438d9e69 100644 --- a/tools/CIndex/CXCursor.h +++ b/tools/CIndex/CXCursor.h @@ -30,9 +30,7 @@ class Stmt; namespace cxcursor { -CXCursor MakeCXCursor(CXCursorKind K, clang::Decl *D); -CXCursor MakeCXCursor(CXCursorKind K, clang::Decl *D, clang::Stmt *S, - ASTContext &Context); +CXCursor MakeCXCursorInvalid(CXCursorKind K); CXCursor MakeCXCursor(clang::Stmt *S, clang::Decl *Parent); CXCursor MakeCXCursor(clang::Decl *D); |