diff options
author | John McCall <rjmccall@apple.com> | 2013-04-16 07:28:30 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2013-04-16 07:28:30 +0000 |
commit | 76da55d3a49e1805f51b1ced7c5da5bcd7f759d8 (patch) | |
tree | 9681395543b144659b99a401d3a1ff0260bc08b4 /tools | |
parent | 459ef03126f9f0420efb3355e3b2ed3c1fdfb38a (diff) |
Basic support for Microsoft property declarations and
references thereto.
Patch by Tong Shen!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@179585 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libclang/CIndex.cpp | 1 | ||||
-rw-r--r-- | tools/libclang/CXCursor.cpp | 1 | ||||
-rw-r--r-- | tools/libclang/IndexBody.cpp | 6 | ||||
-rw-r--r-- | tools/libclang/IndexDecl.cpp | 5 | ||||
-rw-r--r-- | tools/libclang/IndexingContext.cpp | 6 | ||||
-rw-r--r-- | tools/libclang/IndexingContext.h | 3 | ||||
-rw-r--r-- | tools/libclang/RecursiveASTVisitor.h | 5 |
7 files changed, 27 insertions, 0 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 18821aaa45..d1aeee04ea 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -4458,6 +4458,7 @@ CXCursor clang_getCursorDefinition(CXCursor C) { case Decl::TemplateTypeParm: case Decl::EnumConstant: case Decl::Field: + case Decl::MSProperty: case Decl::IndirectField: case Decl::ObjCIvar: case Decl::ObjCAtDefsField: diff --git a/tools/libclang/CXCursor.cpp b/tools/libclang/CXCursor.cpp index 7b01ec2de0..a413903f9a 100644 --- a/tools/libclang/CXCursor.cpp +++ b/tools/libclang/CXCursor.cpp @@ -442,6 +442,7 @@ CXCursor cxcursor::MakeCXCursor(const Stmt *S, const Decl *Parent, case Stmt::CXXDependentScopeMemberExprClass: case Stmt::CXXPseudoDestructorExprClass: case Stmt::MemberExprClass: + case Stmt::MSPropertyRefExprClass: case Stmt::ObjCIsaExprClass: case Stmt::ObjCIvarRefExprClass: case Stmt::ObjCPropertyRefExprClass: diff --git a/tools/libclang/IndexBody.cpp b/tools/libclang/IndexBody.cpp index 95d74efc04..54711e6332 100644 --- a/tools/libclang/IndexBody.cpp +++ b/tools/libclang/IndexBody.cpp @@ -89,6 +89,12 @@ public: return true; } + bool VisitMSPropertyRefExpr(MSPropertyRefExpr *E) { + IndexCtx.handleReference(E->getPropertyDecl(), E->getMemberLoc(), Parent, + ParentDC, E, CXIdxEntityRef_Direct); + return true; + } + bool VisitObjCProtocolExpr(ObjCProtocolExpr *E) { IndexCtx.handleReference(E->getProtocol(), E->getProtocolIdLoc(), Parent, ParentDC, E, CXIdxEntityRef_Direct); diff --git a/tools/libclang/IndexDecl.cpp b/tools/libclang/IndexDecl.cpp index d7fb959b1e..756001c3c1 100644 --- a/tools/libclang/IndexDecl.cpp +++ b/tools/libclang/IndexDecl.cpp @@ -105,6 +105,11 @@ public: return true; } + bool VisitMSPropertyDecl(const MSPropertyDecl *D) { + handleDeclarator(D); + return true; + } + bool VisitEnumConstantDecl(const EnumConstantDecl *D) { IndexCtx.handleEnumerator(D); IndexCtx.indexBody(D->getInitExpr(), D); diff --git a/tools/libclang/IndexingContext.cpp b/tools/libclang/IndexingContext.cpp index 336892250e..14b430c7dc 100644 --- a/tools/libclang/IndexingContext.cpp +++ b/tools/libclang/IndexingContext.cpp @@ -396,6 +396,12 @@ bool IndexingContext::handleField(const FieldDecl *D) { return handleDecl(D, D->getLocation(), getCursor(D), DInfo); } +bool IndexingContext::handleMSProperty(const MSPropertyDecl *D) { + DeclInfo DInfo(/*isRedeclaration=*/false, /*isDefinition=*/true, + /*isContainer=*/false); + return handleDecl(D, D->getLocation(), getCursor(D), DInfo); +} + bool IndexingContext::handleEnumerator(const EnumConstantDecl *D) { DeclInfo DInfo(/*isRedeclaration=*/false, /*isDefinition=*/true, /*isContainer=*/false); diff --git a/tools/libclang/IndexingContext.h b/tools/libclang/IndexingContext.h index c9097c5e6e..62873bedb2 100644 --- a/tools/libclang/IndexingContext.h +++ b/tools/libclang/IndexingContext.h @@ -16,6 +16,7 @@ namespace clang { class FileEntry; + class MSPropertyDecl; class ObjCPropertyDecl; class ClassTemplateDecl; class FunctionTemplateDecl; @@ -404,6 +405,8 @@ public: bool handleField(const FieldDecl *D); + bool handleMSProperty(const MSPropertyDecl *D); + bool handleEnumerator(const EnumConstantDecl *D); bool handleTagDecl(const TagDecl *D); diff --git a/tools/libclang/RecursiveASTVisitor.h b/tools/libclang/RecursiveASTVisitor.h index 5862e12cd1..0312f1fbbd 100644 --- a/tools/libclang/RecursiveASTVisitor.h +++ b/tools/libclang/RecursiveASTVisitor.h @@ -1614,6 +1614,10 @@ DEF_TRAVERSE_DECL(FieldDecl, { TRY_TO(TraverseStmt(D->getInClassInitializer())); }) +DEF_TRAVERSE_DECL(MSPropertyDecl, { + TRY_TO(TraverseDeclaratorHelper(D)); + }) + DEF_TRAVERSE_DECL(ObjCAtDefsFieldDecl, { TRY_TO(TraverseDeclaratorHelper(D)); if (D->isBitField()) @@ -2133,6 +2137,7 @@ DEF_TRAVERSE_STMT(UnresolvedMemberExpr, { } }) +DEF_TRAVERSE_STMT(MSPropertyRefExpr, {}) DEF_TRAVERSE_STMT(SEHTryStmt, {}) DEF_TRAVERSE_STMT(SEHExceptStmt, {}) DEF_TRAVERSE_STMT(SEHFinallyStmt,{}) |