diff options
Diffstat (limited to 'lib/Index/IndexSymbol.cpp')
-rw-r--r-- | lib/Index/IndexSymbol.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lib/Index/IndexSymbol.cpp b/lib/Index/IndexSymbol.cpp index be847e762091..84984fce4dc7 100644 --- a/lib/Index/IndexSymbol.cpp +++ b/lib/Index/IndexSymbol.cpp @@ -152,10 +152,18 @@ SymbolInfo index::getSymbolInfo(const Decl *D) { Info.Lang = SymbolLanguage::ObjC; break; case Decl::ObjCMethod: - if (cast<ObjCMethodDecl>(D)->isInstanceMethod()) + if (cast<ObjCMethodDecl>(D)->isInstanceMethod()) { + const ObjCMethodDecl *MD = cast<ObjCMethodDecl>(D); Info.Kind = SymbolKind::InstanceMethod; - else + if (MD->isPropertyAccessor()) { + if (MD->param_size()) + Info.SubKind = SymbolSubKind::AccessorSetter; + else + Info.SubKind = SymbolSubKind::AccessorGetter; + } + } else { Info.Kind = SymbolKind::ClassMethod; + } Info.Lang = SymbolLanguage::ObjC; if (isUnitTest(cast<ObjCMethodDecl>(D))) Info.Properties |= (unsigned)SymbolProperty::UnitTest; @@ -289,6 +297,8 @@ void index::applyForEachSymbolRole(SymbolRoleSet Roles, APPLY_FOR_ROLE(RelationCalledBy); APPLY_FOR_ROLE(RelationExtendedBy); APPLY_FOR_ROLE(RelationAccessorOf); + APPLY_FOR_ROLE(RelationContainedBy); + APPLY_FOR_ROLE(RelationIBTypeOf); #undef APPLY_FOR_ROLE } @@ -317,6 +327,8 @@ void index::printSymbolRoles(SymbolRoleSet Roles, raw_ostream &OS) { case SymbolRole::RelationCalledBy: OS << "RelCall"; break; case SymbolRole::RelationExtendedBy: OS << "RelExt"; break; case SymbolRole::RelationAccessorOf: OS << "RelAcc"; break; + case SymbolRole::RelationContainedBy: OS << "RelCont"; break; + case SymbolRole::RelationIBTypeOf: OS << "RelIBType"; break; } }); } @@ -375,6 +387,8 @@ StringRef index::getSymbolSubKindString(SymbolSubKind K) { case SymbolSubKind::None: return "<none>"; case SymbolSubKind::CXXCopyConstructor: return "cxx-copy-ctor"; case SymbolSubKind::CXXMoveConstructor: return "cxx-move-ctor"; + case SymbolSubKind::AccessorGetter: return "acc-get"; + case SymbolSubKind::AccessorSetter: return "acc-set"; } llvm_unreachable("invalid symbol subkind"); } |