diff options
Diffstat (limited to 'lib/Index/IndexingContext.cpp')
-rw-r--r-- | lib/Index/IndexingContext.cpp | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/lib/Index/IndexingContext.cpp b/lib/Index/IndexingContext.cpp index e623a495b47b..6dd6c0cfb28e 100644 --- a/lib/Index/IndexingContext.cpp +++ b/lib/Index/IndexingContext.cpp @@ -312,9 +312,20 @@ bool IndexingContext::handleDeclOccurrence(const Decl *D, SourceLocation Loc, Roles |= Rel.Roles; }; - if (!IsRef && Parent && !cast<DeclContext>(Parent)->isFunctionOrMethod()) { - addRelation(SymbolRelation{(unsigned)SymbolRole::RelationChildOf, Parent}); + if (Parent) { + if (IsRef) { + addRelation(SymbolRelation{ + (unsigned)SymbolRole::RelationContainedBy, + Parent + }); + } else if (!cast<DeclContext>(Parent)->isFunctionOrMethod()) { + addRelation(SymbolRelation{ + (unsigned)SymbolRole::RelationChildOf, + Parent + }); + } } + for (auto &Rel : Relations) { addRelation(SymbolRelation(Rel.Roles, Rel.RelatedSymbol->getCanonicalDecl())); |