summaryrefslogtreecommitdiffstats
path: root/clang/lib/Index/IndexingContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Index/IndexingContext.cpp')
-rw-r--r--clang/lib/Index/IndexingContext.cpp9
1 files changed, 7 insertions, 2 deletions
diff --git a/clang/lib/Index/IndexingContext.cpp b/clang/lib/Index/IndexingContext.cpp
index e623a495b47..2d5fc0df3a0 100644
--- a/clang/lib/Index/IndexingContext.cpp
+++ b/clang/lib/Index/IndexingContext.cpp
@@ -312,9 +312,14 @@ 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()));
OpenPOWER on IntegriCloud