diff options
| author | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2017-03-17 23:41:59 +0000 |
|---|---|---|
| committer | Argyrios Kyrtzidis <akyrtzi@gmail.com> | 2017-03-17 23:41:59 +0000 |
| commit | 573624a9c22395b5bfd89e6fd84e0bbe0e0a7104 (patch) | |
| tree | 932d3ca67f26dd6c21d1d1b684be6e6256177b53 /clang/lib | |
| parent | 9424af1b30b03e7c84d55cdf11f68b0c21e89a69 (diff) | |
| download | bcm5719-llvm-573624a9c22395b5bfd89e6fd84e0bbe0e0a7104.tar.gz bcm5719-llvm-573624a9c22395b5bfd89e6fd84e0bbe0e0a7104.zip | |
[index] For C++ constructors/destructors, add references to the parent type where its name appears in definitions and declarations
Patch by Nathan Hawes!
https://reviews.llvm.org/D30730
llvm-svn: 298170
Diffstat (limited to 'clang/lib')
| -rw-r--r-- | clang/lib/Index/IndexDecl.cpp | 9 | ||||
| -rw-r--r-- | clang/lib/Index/IndexingContext.h | 2 |
2 files changed, 10 insertions, 1 deletions
diff --git a/clang/lib/Index/IndexDecl.cpp b/clang/lib/Index/IndexDecl.cpp index 581e3a27404..f9710236c9e 100644 --- a/clang/lib/Index/IndexDecl.cpp +++ b/clang/lib/Index/IndexDecl.cpp @@ -158,6 +158,9 @@ public: handleDeclarator(D); if (const CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(D)) { + IndexCtx.handleReference(Ctor->getParent(), Ctor->getLocation(), + Ctor->getParent(), Ctor->getDeclContext()); + // Constructor initializers. for (const auto *Init : Ctor->inits()) { if (Init->isWritten()) { @@ -168,6 +171,12 @@ public: IndexCtx.indexBody(Init->getInit(), D, D); } } + } else if (const CXXDestructorDecl *Dtor = dyn_cast<CXXDestructorDecl>(D)) { + if (auto TypeNameInfo = Dtor->getNameInfo().getNamedTypeInfo()) { + IndexCtx.handleReference(Dtor->getParent(), + TypeNameInfo->getTypeLoc().getLocStart(), + Dtor->getParent(), Dtor->getDeclContext()); + } } if (D->isThisDeclarationADefinition()) { diff --git a/clang/lib/Index/IndexingContext.h b/clang/lib/Index/IndexingContext.h index 5f4215858cc..933b0a2cda0 100644 --- a/clang/lib/Index/IndexingContext.h +++ b/clang/lib/Index/IndexingContext.h @@ -71,7 +71,7 @@ public: bool handleReference(const NamedDecl *D, SourceLocation Loc, const NamedDecl *Parent, const DeclContext *DC, - SymbolRoleSet Roles, + SymbolRoleSet Roles = SymbolRoleSet(), ArrayRef<SymbolRelation> Relations = None, const Expr *RefE = nullptr, const Decl *RefD = nullptr); |

