summaryrefslogtreecommitdiffstats
path: root/clang/lib/Index/IndexDecl.cpp
diff options
context:
space:
mode:
authorKadir Cetinkaya <kadircet@google.com>2019-03-08 08:30:20 +0000
committerKadir Cetinkaya <kadircet@google.com>2019-03-08 08:30:20 +0000
commite7eb27a9a0edd859de49bcc9af7ca27dbb435886 (patch)
tree9f7395d0d0530d77a8a2887c81e4e7565f275dc3 /clang/lib/Index/IndexDecl.cpp
parent4505c99e7222885ecb746a913fc33aa9098cf098 (diff)
downloadbcm5719-llvm-e7eb27a9a0edd859de49bcc9af7ca27dbb435886.tar.gz
bcm5719-llvm-e7eb27a9a0edd859de49bcc9af7ca27dbb435886.zip
[clang][Index] Mark references from Constructors and Destructors to class as NameReference
Summary: In current indexing logic we get references to class itself when we see a constructor/destructor which is only syntactically true. Semantically this information is not correct. This patch marks that reference as NameReference to let clients deal with it. Reviewers: akyrtzi, gribozavr, nathawes, benlangmuir Reviewed By: gribozavr, nathawes Subscribers: nathawes, arphaman, cfe-commits Tags: #clang Differential Revision: https://reviews.llvm.org/D58814 llvm-svn: 355668
Diffstat (limited to 'clang/lib/Index/IndexDecl.cpp')
-rw-r--r--clang/lib/Index/IndexDecl.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/clang/lib/Index/IndexDecl.cpp b/clang/lib/Index/IndexDecl.cpp
index d7835c51d06..7e6be5d7f68 100644
--- a/clang/lib/Index/IndexDecl.cpp
+++ b/clang/lib/Index/IndexDecl.cpp
@@ -247,7 +247,8 @@ public:
if (const CXXConstructorDecl *Ctor = dyn_cast<CXXConstructorDecl>(D)) {
IndexCtx.handleReference(Ctor->getParent(), Ctor->getLocation(),
- Ctor->getParent(), Ctor->getDeclContext());
+ Ctor->getParent(), Ctor->getDeclContext(),
+ (unsigned)SymbolRole::NameReference);
// Constructor initializers.
for (const auto *Init : Ctor->inits()) {
@@ -263,7 +264,8 @@ public:
if (auto TypeNameInfo = Dtor->getNameInfo().getNamedTypeInfo()) {
IndexCtx.handleReference(Dtor->getParent(),
TypeNameInfo->getTypeLoc().getBeginLoc(),
- Dtor->getParent(), Dtor->getDeclContext());
+ Dtor->getParent(), Dtor->getDeclContext(),
+ (unsigned)SymbolRole::NameReference);
}
} else if (const auto *Guide = dyn_cast<CXXDeductionGuideDecl>(D)) {
IndexCtx.handleReference(Guide->getDeducedTemplate()->getTemplatedDecl(),
OpenPOWER on IntegriCloud