diff options
author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2017-01-11 20:51:10 +0000 |
---|---|---|
committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2017-01-11 20:51:10 +0000 |
commit | df60aa83a32a6f837a19fa8283435f328bbaf171 (patch) | |
tree | 27fbed8c8cb7cae1ea15a95726dc8e94afa24d43 /clang/lib/Index/IndexingContext.cpp | |
parent | 6bca5a0d82945fd2f9e84ecde848b0475e22ad26 (diff) | |
download | bcm5719-llvm-df60aa83a32a6f837a19fa8283435f328bbaf171.tar.gz bcm5719-llvm-df60aa83a32a6f837a19fa8283435f328bbaf171.zip |
[index] Add 'contained-by' relation between references and their lexical container.
llvm-svn: 291700
Diffstat (limited to 'clang/lib/Index/IndexingContext.cpp')
-rw-r--r-- | clang/lib/Index/IndexingContext.cpp | 9 |
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())); |