[cfe-commits] r159309 - in /cfe/trunk: lib/AST/CommentBriefParser.cpp test/Index/annotate-comments.cpp

Douglas Gregor dgregor at apple.com
Fri Jun 29 10:53:30 PDT 2012


On Jun 27, 2012, at 5:01 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:

> Author: gribozavr
> Date: Wed Jun 27 19:01:41 2012
> New Revision: 159309
> 
> URL: http://llvm.org/viewvc/llvm-project?rev=159309&view=rev
> Log:
> Teach \brief parser about commands that start a new paragraph implicitly
> 
> Modified:
>    cfe/trunk/lib/AST/CommentBriefParser.cpp
>    cfe/trunk/test/Index/annotate-comments.cpp
> 
> Modified: cfe/trunk/lib/AST/CommentBriefParser.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentBriefParser.cpp?rev=159309&r1=159308&r2=159309&view=diff
> ==============================================================================
> --- cfe/trunk/lib/AST/CommentBriefParser.cpp (original)
> +++ cfe/trunk/lib/AST/CommentBriefParser.cpp Wed Jun 27 19:01:41 2012
> @@ -16,7 +16,6 @@
>   std::string Paragraph;
>   bool InFirstParagraph = true;
>   bool InBrief = false;
> -  bool BriefDone = false;
> 
>   while (Tok.isNot(tok::eof)) {
>     if (Tok.is(tok::text)) {
> @@ -26,11 +25,24 @@
>       continue;
>     }
> 
> -    if (!BriefDone && Tok.is(tok::command) && Tok.getCommandName() == "brief") {
> -      Paragraph.clear();
> -      InBrief = true;
> -      ConsumeToken();
> -      continue;
> +    if (Tok.is(tok::command)) {
> +      StringRef Name = Tok.getCommandName();
> +      if (Name == "brief") {
> +        Paragraph.clear();
> +        InBrief = true;
> +        ConsumeToken();
> +        continue;
> +      }
> +      // Check if this command implicitly starts a new paragraph.
> +      if (Name == "param" || Name == "result" || Name == "return" ||
> +          Name == "returns") {

Please pull this name check out into a separate function "commandImplictlyStartsParagraph(StringRef)" or similar. This seems like another thing we'd want to TableGen.

	- Doug




More information about the cfe-commits mailing list