From 8c9bf999aa40ab6077b958b5edcf587b9d76ce24 Mon Sep 17 00:00:00 2001 From: Jan Korous Date: Tue, 10 Oct 2017 21:09:49 +0000 Subject: [PATCH] Fix indexer crash for default template template parameter value rdar://33058798 Differential Revision: https://reviews.llvm.org/D38755 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@315367 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Index/IndexDecl.cpp | 3 +-- test/Index/index-template-template-param.cpp | 7 +++++++ 2 files changed, 8 insertions(+), 2 deletions(-) create mode 100644 test/Index/index-template-template-param.cpp diff --git a/lib/Index/IndexDecl.cpp b/lib/Index/IndexDecl.cpp index ee28ef737d..2704e6da95 100644 --- a/lib/Index/IndexDecl.cpp +++ b/lib/Index/IndexDecl.cpp @@ -666,7 +666,6 @@ public: } bool VisitTemplateDecl(const TemplateDecl *D) { - // FIXME: Template parameters. // Index the default values for the template parameters. const NamedDecl *Parent = D->getTemplatedDecl(); @@ -683,7 +682,7 @@ public: } else if (const auto *TTPD = dyn_cast(TP)) { if (TTPD->hasDefaultArgument()) handleTemplateArgumentLoc(TTPD->getDefaultArgument(), Parent, - /*DC=*/nullptr); + TP->getLexicalDeclContext()); } } } diff --git a/test/Index/index-template-template-param.cpp b/test/Index/index-template-template-param.cpp new file mode 100644 index 0000000000..af1c4634ad --- /dev/null +++ b/test/Index/index-template-template-param.cpp @@ -0,0 +1,7 @@ +// RUN: c-index-test -index-file %s -x objective-c++ | FileCheck %s + +template class Template1 {}; + +template