]> granicus.if.org Git - clang/commitdiff
[Index/DocComments] When cloning a full comment, pick the template parameters from...
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 27 Apr 2014 22:53:03 +0000 (22:53 +0000)
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>
Sun, 27 Apr 2014 22:53:03 +0000 (22:53 +0000)
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

lib/AST/ASTContext.cpp
test/Index/comment-cplus-template-decls.cpp

index 8a60bebd57a1c0bfc45b283803481f8eabda1452..84abda2dea6c042b96dcb224e7fc91b150440d43 100644 (file)
@@ -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);
index 9510c7ce15c05a2663e67c51c8d489029ab2192b..7ef09bd691b12fa609fea7c90d0b551049fdb018 100644 (file)
@@ -67,3 +67,18 @@ void func_template_1(T AAA);
 template<template<template<typename CCC> class DDD, class BBB> class AAA>
 void func_template_2();
 // FIXME: There is not Declaration field in the generated output.
+
+namespace rdar16128173 {
+// CHECK: <Declaration>template &lt;class PtrTy&gt; class OpaquePtr {}</Declaration>
+
+/// \brief Wrapper for void* pointer.
+/// \tparam PtrTy Either a pointer type like 'T*' or a type that behaves like
+///               a pointer.
+template <class PtrTy>
+class OpaquePtr {};
+
+// CHECK: <Declaration>typedef OpaquePtr&lt;int&gt; DeclGroupPtrTy</Declaration>
+typedef OpaquePtr<int> DeclGroupPtrTy;
+
+DeclGroupPtrTy blah;
+}