From 486754660bb926339aefcf012a3f848592babb8b Mon Sep 17 00:00:00 2001 From: Dimitry Andric Date: Sat, 28 Jul 2018 11:06:01 +0000 Subject: Vendor import of clang trunk r338150: https://llvm.org/svn/llvm-project/cfe/trunk@338150 --- lib/Index/IndexDecl.cpp | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) (limited to 'lib/Index/IndexDecl.cpp') diff --git a/lib/Index/IndexDecl.cpp b/lib/Index/IndexDecl.cpp index e14750e046eb..01ad3a277216 100644 --- a/lib/Index/IndexDecl.cpp +++ b/lib/Index/IndexDecl.cpp @@ -43,7 +43,7 @@ public: return true; } - /// \brief Returns true if the given method has been defined explicitly by the + /// Returns true if the given method has been defined explicitly by the /// user. static bool hasUserDefined(const ObjCMethodDecl *D, const ObjCImplDecl *Container) { @@ -664,8 +664,11 @@ public: bool VisitTemplateDecl(const TemplateDecl *D) { - // Index the default values for the template parameters. const NamedDecl *Parent = D->getTemplatedDecl(); + if (!Parent) + return true; + + // Index the default values for the template parameters. if (D->getTemplateParameters() && shouldIndexTemplateParameterDefaultValue(Parent)) { const TemplateParameterList *Params = D->getTemplateParameters(); @@ -684,7 +687,7 @@ public: } } - return Visit(D->getTemplatedDecl()); + return Visit(Parent); } bool VisitFriendDecl(const FriendDecl *D) { @@ -723,7 +726,7 @@ bool IndexingContext::indexDecl(const Decl *D) { if (D->isImplicit() && shouldIgnoreIfImplicit(D)) return true; - if (isTemplateImplicitInstantiation(D)) + if (isTemplateImplicitInstantiation(D) && !shouldIndexImplicitInstantiation()) return true; IndexingDeclVisitor Visitor(*this); -- cgit v1.3