diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-06-29 22:20:07 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2011-06-29 22:20:07 +0000 |
commit | 8ccac3de1335f1cfd7cea56ba1cefcf0b724ce3f (patch) | |
tree | 5924fc990c04ca6884e928687cffc4a1f1226e4b | |
parent | c5c5e92ec53f7e6ac7ebbbf77c6d8e4b7d88daec (diff) |
[libclang] Introduce cxcursor::getCursorParentDecl(CXCursor Cursor) and use it at the appropriate place in CIndex.cpp
No functionality change.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@134104 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | tools/libclang/CIndex.cpp | 2 | ||||
-rw-r--r-- | tools/libclang/CXCursor.cpp | 4 | ||||
-rw-r--r-- | tools/libclang/CXCursor.h | 1 |
3 files changed, 6 insertions, 1 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 3f9d34f675..ec78caa783 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -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() && diff --git a/tools/libclang/CXCursor.cpp b/tools/libclang/CXCursor.cpp index f2ee2a9225..b9842b6df0 100644 --- a/tools/libclang/CXCursor.cpp +++ b/tools/libclang/CXCursor.cpp @@ -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(); } diff --git a/tools/libclang/CXCursor.h b/tools/libclang/CXCursor.h index 11f2500fb1..545ea8751b 100644 --- a/tools/libclang/CXCursor.h +++ b/tools/libclang/CXCursor.h @@ -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); |