[libclang] Introduce cxcursor::getCursorParentDecl(CXCursor Cursor) and use it at the appropriate place in CIndex.cpp

No functionality change.

llvm-svn: 134104
This commit is contained in:
Argyrios Kyrtzidis 2011-06-29 22:20:07 +00:00
parent e379ee31c0
commit 8bb2ecf32d
3 changed files with 6 additions and 1 deletions

View File

@ -4658,7 +4658,7 @@ AnnotateTokensWorker::Visit(CXCursor cursor, CXCursor parent) {
// MyCXXClass foo; // Make sure we don't annotate 'foo' as a CallExpr cursor.
if (clang_isExpression(cursorK)) {
Expr *E = getCursorExpr(cursor);
if (Decl *D = getCursorDecl(cursor)) {
if (Decl *D = getCursorParentDecl(cursor)) {
const unsigned I = NextToken();
if (E->getLocStart().isValid() && D->getLocation().isValid() &&
E->getLocStart() == D->getLocation() &&

View File

@ -484,6 +484,10 @@ Attr *cxcursor::getCursorAttr(CXCursor Cursor) {
return (Attr *)Cursor.data[1];
}
Decl *cxcursor::getCursorParentDecl(CXCursor Cursor) {
return (Decl *)Cursor.data[0];
}
ASTContext &cxcursor::getCursorContext(CXCursor Cursor) {
return getCursorASTUnit(Cursor)->getASTContext();
}

View File

@ -184,6 +184,7 @@ Decl *getCursorDecl(CXCursor Cursor);
Expr *getCursorExpr(CXCursor Cursor);
Stmt *getCursorStmt(CXCursor Cursor);
Attr *getCursorAttr(CXCursor Cursor);
Decl *getCursorParentDecl(CXCursor Cursor);
ASTContext &getCursorContext(CXCursor Cursor);
ASTUnit *getCursorASTUnit(CXCursor Cursor);