r176387 - comment parsing. Keep the original command format

Dmitri Gribenko gribozavr at gmail.com
Fri Mar 1 16:21:53 PST 2013


On Saturday, March 2, 2013, Jordan Rose wrote:

> For the record, Doxygen comments can also start with '@', probably for
> javadoc compatibility. Maybe HasAt?
>

I agree -- headerdoc is not special here.

I think I used the term "command marker" in lexer somewhere.  No need to
rush with the change, tomorrow I'll review the terms I used.

By the way, this is a nice change.  I think there's a PR in the bugzilla
about this.

Dmitri


>
>
> On Mar 1, 2013, at 14:51 , Fariborz Jahanian <fjahanian at apple.com> wrote:
>
> Author: fjahanian
> Date: Fri Mar  1 16:51:30 2013
> New Revision: 176387
>
> URL: http://llvm.org/viewvc/llvm-project?rev=176387&view=rev
> Log:
> comment parsing. Keep the original command format
> in AST for source fidelity and use it in diagnostics
> to refer to the original format. // rdar://13066276
>
> Modified:
>    cfe/trunk/include/clang/AST/Comment.h
>    cfe/trunk/include/clang/AST/CommentLexer.h
>    cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td
>    cfe/trunk/lib/AST/CommentLexer.cpp
>    cfe/trunk/lib/AST/CommentParser.cpp
>    cfe/trunk/lib/AST/CommentSema.cpp
>    cfe/trunk/test/Sema/warn-documentation.cpp
>
> Modified: cfe/trunk/include/clang/AST/Comment.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Comment.h?rev=176387&r1=176386&r2=176387&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/AST/Comment.h (original)
> +++ cfe/trunk/include/clang/AST/Comment.h Fri Mar  1 16:51:30 2013
> @@ -570,13 +570,16 @@ protected:
>
>   /// Paragraph argument.
>   ParagraphComment *Paragraph;
> -
> +
> +  /// Header Doc command, if true
> +  bool HDCommand;
> +
>   BlockCommandComment(CommentKind K,
>                       SourceLocation LocBegin,
>                       SourceLocation LocEnd,
>                       unsigned CommandID) :
>       BlockContentComment(K, LocBegin, LocEnd),
> -      Paragraph(NULL) {
> +      Paragraph(NULL), HDCommand(false) {
>     setLocation(getCommandNameBeginLoc());
>     BlockCommandCommentBits.CommandID = CommandID;
>   }
> @@ -586,7 +589,7 @@ public:
>                       SourceLocation LocEnd,
>                       unsigned CommandID) :
>       BlockContentComment(BlockCommandCommentKind, LocBegin, LocEnd),
> -      Paragraph(NULL) {
> +      Paragraph(NULL), HDCommand(false) {
>     setLocation(getCommandNameBeginLoc());
>     BlockCommandCommentBits.CommandID = CommandID;
>   }
> @@ -657,6 +660,14 @@ public:
>     if (NewLocEnd.isValid())
>       setSourceRange(SourceRange(getLocStart(), NewLocEnd));
>   }
> +
> +  bool getHDCommand() const LLVM_READONLY {
> +    return HDCommand;
> +  }
> +
> +  void setHDCommand(bool HDC) {
> +    HDCommand = HDC;
> +  }
> };
>
> /// Doxygen \\param command.
>
> Modified: cfe/trunk/include/clang/AST/CommentLexer.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentLexer.h?rev=176387&r1=176386&r2=176387&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/AST/CommentLexer.h (original)
> +++ cfe/trunk/include/clang/AST/CommentLexer.h Fri Mar  1 16:51:30 2013
> @@ -75,6 +75,9 @@ class Token {
>   /// unused (command spelling can be found with CommandTraits).
>  Otherwise,
>   /// contains the length of the string that starts at TextPtr.
>   unsigned IntVal;
> +
> +  /// This command is a Header Doc command (command starts with '@').
> +  bool     HDCommand;
>
> public:
>   SourceLocation getLocation() const LLVM_READONLY { return Loc; }
> @@ -122,6 +125,10 @@ public:
>     return IntVal;
>   }
>
> +  bool getHDCommand() const LLVM_READONLY {
> +    return HDCommand;
> +  }
> +
>   void setCommandID(unsigned ID) {
>     assert(is(tok::command));
>     IntVal = ID;
>
> Modified: cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td?rev=176387&r1=176386&r2=176387&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticC
>
>

-- 
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>*/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130302/096edad6/attachment.html>


More information about the cfe-commits mailing list