diff options
author | Olivier Goffart <ogoffart@woboq.com> | 2016-11-04 06:29:27 +0000 |
---|---|---|
committer | Olivier Goffart <ogoffart@woboq.com> | 2016-11-04 06:29:27 +0000 |
commit | 98cebfb1cf44e2aedf63e8f856cb08fc6ebc6855 (patch) | |
tree | 8741d18e66bb6ab95df28b87fcf4297b243a3a60 /tools | |
parent | f4b4bc99007592cd2b90e2e69d51149a7c34552b (diff) |
[index] Expose FriendDecl
Differential Revision: https://reviews.llvm.org/D26285
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@285984 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r-- | tools/libclang/CIndex.cpp | 13 | ||||
-rw-r--r-- | tools/libclang/CursorVisitor.h | 3 |
2 files changed, 15 insertions, 1 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index 284373c149..17fe88b631 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -1249,6 +1249,17 @@ bool CursorVisitor::VisitStaticAssertDecl(StaticAssertDecl *D) { return false; } +bool CursorVisitor::VisitFriendDecl(FriendDecl *D) { + if (NamedDecl *FriendD = D->getFriendDecl()) { + if (Visit(MakeCXCursor(FriendD, TU, RegionOfInterest))) + return true; + } else if (TypeSourceInfo *TI = D->getFriendType()) { + if (Visit(TI->getTypeLoc())) + return true; + } + return false; +} + bool CursorVisitor::VisitDeclarationNameInfo(DeclarationNameInfo Name) { switch (Name.getName().getNameKind()) { case clang::DeclarationName::Identifier: @@ -4923,6 +4934,8 @@ CXString clang_getCursorKindSpelling(enum CXCursorKind Kind) { return cxstring::createRef("TypeAliasTemplateDecl"); case CXCursor_StaticAssert: return cxstring::createRef("StaticAssert"); + case CXCursor_FriendDecl: + return cxstring::createRef("FriendDecl"); } llvm_unreachable("Unhandled CXCursorKind"); diff --git a/tools/libclang/CursorVisitor.h b/tools/libclang/CursorVisitor.h index a2dfaeedcc..82f251a348 100644 --- a/tools/libclang/CursorVisitor.h +++ b/tools/libclang/CursorVisitor.h @@ -239,7 +239,8 @@ public: bool VisitUnresolvedUsingValueDecl(UnresolvedUsingValueDecl *D); bool VisitUnresolvedUsingTypenameDecl(UnresolvedUsingTypenameDecl *D); bool VisitStaticAssertDecl(StaticAssertDecl *D); - + bool VisitFriendDecl(FriendDecl *D); + // Name visitor bool VisitDeclarationNameInfo(DeclarationNameInfo Name); bool VisitNestedNameSpecifier(NestedNameSpecifier *NNS, SourceRange Range); |