r207382 - [Index/DocComments] When cloning a full comment, pick the template parameters from the original FullComment,

Argyrios Kyrtzidis akyrtzi at gmail.com
Sun Apr 27 15:53:05 PDT 2014


Author: akirtzidis
Date: Sun Apr 27 17:53:03 2014
New Revision: 207382

URL: http://llvm.org/viewvc/llvm-project?rev=207382&view=rev
Log:
[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

Modified:
    cfe/trunk/lib/AST/ASTContext.cpp
    cfe/trunk/test/Index/comment-cplus-template-decls.cpp

Modified: cfe/trunk/lib/AST/ASTContext.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/ASTContext.cpp?rev=207382&r1=207381&r2=207382&view=diff
==============================================================================
--- cfe/trunk/lib/AST/ASTContext.cpp (original)
+++ cfe/trunk/lib/AST/ASTContext.cpp Sun Apr 27 17:53:03 2014
@@ -422,6 +422,8 @@ comments::FullComment *ASTContext::clone
   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);

Modified: cfe/trunk/test/Index/comment-cplus-template-decls.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Index/comment-cplus-template-decls.cpp?rev=207382&r1=207381&r2=207382&view=diff
==============================================================================
--- cfe/trunk/test/Index/comment-cplus-template-decls.cpp (original)
+++ cfe/trunk/test/Index/comment-cplus-template-decls.cpp Sun Apr 27 17:53:03 2014
@@ -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 <class PtrTy> 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<int> DeclGroupPtrTy</Declaration>
+typedef OpaquePtr<int> DeclGroupPtrTy;
+
+DeclGroupPtrTy blah;
+}





More information about the cfe-commits mailing list