From: Argyrios Kyrtzidis Date: Sun, 27 Apr 2014 22:53:03 +0000 (+0000) Subject: [Index/DocComments] When cloning a full comment, pick the template parameters from... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=22ede254f891d68019fddff0f8c32a20232b220b;p=clang [Index/DocComments] When cloning a full comment, pick the template parameters from the original FullComment, if the parameters are not already set (e.g. because it is a typedef). Fixes crash of rdar://16128173 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@207382 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/AST/ASTContext.cpp b/lib/AST/ASTContext.cpp index 8a60bebd57..84abda2dea 100644 --- a/lib/AST/ASTContext.cpp +++ b/lib/AST/ASTContext.cpp @@ -422,6 +422,8 @@ comments::FullComment *ASTContext::cloneFullComment(comments::FullComment *FC, ThisDeclInfo->IsFilled = false; ThisDeclInfo->fill(); ThisDeclInfo->CommentDecl = FC->getDecl(); + if (!ThisDeclInfo->TemplateParameters) + ThisDeclInfo->TemplateParameters = FC->getDeclInfo()->TemplateParameters; comments::FullComment *CFC = new (*this) comments::FullComment(FC->getBlocks(), ThisDeclInfo); diff --git a/test/Index/comment-cplus-template-decls.cpp b/test/Index/comment-cplus-template-decls.cpp index 9510c7ce15..7ef09bd691 100644 --- a/test/Index/comment-cplus-template-decls.cpp +++ b/test/Index/comment-cplus-template-decls.cpp @@ -67,3 +67,18 @@ void func_template_1(T AAA); template class DDD, class BBB> class AAA> void func_template_2(); // FIXME: There is not Declaration field in the generated output. + +namespace rdar16128173 { +// CHECK: template <class PtrTy> class OpaquePtr {} + +/// \brief Wrapper for void* pointer. +/// \tparam PtrTy Either a pointer type like 'T*' or a type that behaves like +/// a pointer. +template +class OpaquePtr {}; + +// CHECK: typedef OpaquePtr<int> DeclGroupPtrTy +typedef OpaquePtr DeclGroupPtrTy; + +DeclGroupPtrTy blah; +}