[cfe-commits] [PATCH] Comment parsing: add support for template parameter documentation

Dmitri Gribenko gribozavr at gmail.com
Tue Jul 31 15:38:01 PDT 2012


Hi Doug,

Thank you for the review!

On Tue, Jul 31, 2012 at 10:39 AM, Douglas Gregor <dgregor at apple.com> wrote:
> Index: include/clang/AST/Comment.h
> ===================================================================
> --- include/clang/AST/Comment.h (revision 160979)
> +++ include/clang/AST/Comment.h (working copy)
> @@ -723,6 +723,73 @@
>    }
>  };
>
> +/// Doxygen \\tparam command, describes a template parameter.
> +class TParamCommandComment : public BlockCommandComment {
> +private:
> +  /// If this template parameter name was resolved (found in template parameter
> +  /// list), then this stores a list of position indexes in all template
> +  /// parameter lists.
> +  ///
> +  /// For example:
> +  /// \verbatim
> +  ///     template<typename C, template<typename T> class TT>
> +  ///     void test(TT<int> aaa);
> +  /// \endverbatim
> +  /// For C:  Position = { 0 }
> +  /// For TT: Position = { 1 }
> +  /// For T:  Position = { 1, 0 }
> +  llvm::SmallVector<unsigned, 2> Position;
>
> The SmallVector here won't ever get destroyed, right? We'll need CommentSema to build up this vector itself and then provide a pointer to a BumpPtrAllocate'd array.

I should have thought about that.  Done.

> +  StringRef getParamName() const {
> +    return Args[0].Text;
> +  }
> +
> +  SourceRange getParamNameRange() const {
> +    return Args[0].Range;
> +  }
>
> assert(hasParamName())?

Args is an ArrayRef and it asserts on its own.

> Also need to handle class template (partial) specializations here?

Thank you for noticing!  Yes, I need to handle class specializations
here and in other places.

Committed r161087 with fixes.

Dmitri

-- 
main(i,j){for(i=2;;i++){for(j=2;j<i;j++){if(!(i%j)){j=0;break;}}if
(j){printf("%d\n",i);}}} /*Dmitri Gribenko <gribozavr at gmail.com>*/



More information about the cfe-commits mailing list