<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><div>For the record, Doxygen comments can also start with '@', probably for javadoc compatibility. Maybe HasAt?</div><div><br></div><br><div><div>On Mar 1, 2013, at 14:51 , Fariborz Jahanian <<a href="mailto:fjahanian@apple.com">fjahanian@apple.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px;">Author: fjahanian<br>Date: Fri Mar  1 16:51:30 2013<br>New Revision: 176387<br><br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project?rev=176387&view=rev">http://llvm.org/viewvc/llvm-project?rev=176387&view=rev</a><br>Log:<br>comment parsing. Keep the original command format<span class="Apple-converted-space"> </span><br>in AST for source fidelity and use it in diagnostics<span class="Apple-converted-space"> </span><br>to refer to the original format. //<span class="Apple-converted-space"> </span><a href="rdar://13066276">rdar://13066276</a><br><br>Modified:<br>   cfe/trunk/include/clang/AST/Comment.h<br>   cfe/trunk/include/clang/AST/CommentLexer.h<br>   cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td<br>   cfe/trunk/lib/AST/CommentLexer.cpp<br>   cfe/trunk/lib/AST/CommentParser.cpp<br>   cfe/trunk/lib/AST/CommentSema.cpp<br>   cfe/trunk/test/Sema/warn-documentation.cpp<br><br>Modified: cfe/trunk/include/clang/AST/Comment.h<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Comment.h?rev=176387&r1=176386&r2=176387&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/Comment.h?rev=176387&r1=176386&r2=176387&view=diff</a><br>==============================================================================<br>--- cfe/trunk/include/clang/AST/Comment.h (original)<br>+++ cfe/trunk/include/clang/AST/Comment.h Fri Mar  1 16:51:30 2013<br>@@ -570,13 +570,16 @@ protected:<br><br>  /// Paragraph argument.<br>  ParagraphComment *Paragraph;<br>-<br>+  <br>+  /// Header Doc command, if true<br>+  bool HDCommand;<br>+  <br>  BlockCommandComment(CommentKind K,<br>                      SourceLocation LocBegin,<br>                      SourceLocation LocEnd,<br>                      unsigned CommandID) :<br>      BlockContentComment(K, LocBegin, LocEnd),<br>-      Paragraph(NULL) {<br>+      Paragraph(NULL), HDCommand(false) {<br>    setLocation(getCommandNameBeginLoc());<br>    BlockCommandCommentBits.CommandID = CommandID;<br>  }<br>@@ -586,7 +589,7 @@ public:<br>                      SourceLocation LocEnd,<br>                      unsigned CommandID) :<br>      BlockContentComment(BlockCommandCommentKind, LocBegin, LocEnd),<br>-      Paragraph(NULL) {<br>+      Paragraph(NULL), HDCommand(false) {<br>    setLocation(getCommandNameBeginLoc());<br>    BlockCommandCommentBits.CommandID = CommandID;<br>  }<br>@@ -657,6 +660,14 @@ public:<br>    if (NewLocEnd.isValid())<br>      setSourceRange(SourceRange(getLocStart(), NewLocEnd));<br>  }<br>+  <br>+  bool getHDCommand() const LLVM_READONLY {<br>+    return HDCommand;<br>+  }<br>+  <br>+  void setHDCommand(bool HDC) {<br>+    HDCommand = HDC;<br>+  }<br>};<br><br>/// Doxygen<span class="Apple-converted-space"> </span><a href="smb://param">\\param</a><span class="Apple-converted-space"> </span>command.<br><br>Modified: cfe/trunk/include/clang/AST/CommentLexer.h<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentLexer.h?rev=176387&r1=176386&r2=176387&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentLexer.h?rev=176387&r1=176386&r2=176387&view=diff</a><br>==============================================================================<br>--- cfe/trunk/include/clang/AST/CommentLexer.h (original)<br>+++ cfe/trunk/include/clang/AST/CommentLexer.h Fri Mar  1 16:51:30 2013<br>@@ -75,6 +75,9 @@ class Token {<br>  /// unused (command spelling can be found with CommandTraits).  Otherwise,<br>  /// contains the length of the string that starts at TextPtr.<br>  unsigned IntVal;<br>+  <br>+  /// This command is a Header Doc command (command starts with '@').<br>+  bool     HDCommand;<br><br>public:<br>  SourceLocation getLocation() const LLVM_READONLY { return Loc; }<br>@@ -122,6 +125,10 @@ public:<br>    return IntVal;<br>  }<br><br>+  bool getHDCommand() const LLVM_READONLY {<br>+    return HDCommand;<br>+  }<br>+  <br>  void setCommandID(unsigned ID) {<br>    assert(is(tok::command));<br>    IntVal = ID;<br><br>Modified: cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td?rev=176387&r1=176386&r2=176387&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td?rev=176387&r1=176386&r2=176387&view=diff</a><br>==============================================================================<br>--- cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td (original)<br>+++ cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td Fri Mar  1 16:51:30 2013<br>@@ -44,18 +44,18 @@ def note_doc_html_end_tag : Note<<br>// Commands<br><br>def warn_doc_block_command_empty_paragraph : Warning<<br>-  "empty paragraph passed to '\\%0' command">,<br>+  "empty paragraph passed to '%select{\\|@}0%1' command">,<br>  InGroup<Documentation>, DefaultIgnore;<br><br>def warn_doc_block_command_duplicate : Warning<<br>-  "duplicated command '\\%0'">,<br>+  "duplicated command '%select{\\|@}0%1'">,<br>  InGroup<Documentation>, DefaultIgnore;<br><br>def note_doc_block_command_previous : Note<<br>-  "previous command '\\%0' here">;<br>+  "previous command '%select{\\|@}0%1' here">;<br><br>def note_doc_block_command_previous_alias : Note<<br>-  "previous command '\\%0' (an alias of '\\%1') here">;<br>+  "previous command '%select{\\|@}0%1' (an alias of '\\%2') here">;<br><br>// \param command<br><br>@@ -111,14 +111,14 @@ def note_doc_tparam_name_suggestion : No<br>// \returns command<br><br>def warn_doc_returns_not_attached_to_a_function_decl : Warning<<br>-  "'\\%0' command used in a comment that is not attached to "<br>+  "'%select{\\|@}0%1' command used in a comment that is not attached to "<br>  "a function or method declaration">,<br>  InGroup<Documentation>, DefaultIgnore;<br><br>def warn_doc_returns_attached_to_a_void_function : Warning<<br>-  "'\\%0' command used in a comment that is attached to a "<br>+  "'%select{\\|@}0%1' command used in a comment that is attached to a "<br>  "%select{function returning void|constructor|destructor|"<br>-  "method returning void}1">,<br>+  "method returning void}2">,<br>  InGroup<Documentation>, DefaultIgnore;<br><br>// \deprecated command<br>@@ -134,7 +134,7 @@ def note_add_deprecation_attr : Note<<br>// verbatim block commands<br><br>def warn_verbatim_block_end_without_start : Warning<<br>-  "'\\%0' command does not terminate a verbatim text block">,<br>+  "'%select{\\|@}0%1' command does not terminate a verbatim text block">,<br>  InGroup<Documentation>, DefaultIgnore;<br><br>} // end of documentation issue category<br><br>Modified: cfe/trunk/lib/AST/CommentLexer.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentLexer.cpp?rev=176387&r1=176386&r2=176387&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentLexer.cpp?rev=176387&r1=176386&r2=176387&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/AST/CommentLexer.cpp (original)<br>+++ cfe/trunk/lib/AST/CommentLexer.cpp Fri Mar  1 16:51:30 2013<br>@@ -298,6 +298,7 @@ void Lexer::lexCommentText(Token &T) {<br>    switch(*TokenPtr) {<br>      case '\\':<br>      case '@': {<br>+        T.HDCommand = (*TokenPtr == '@');<br>        TokenPtr++;<br>        if (TokenPtr == CommentEnd) {<br>          formTextToken(T, TokenPtr);<br><br>Modified: cfe/trunk/lib/AST/CommentParser.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentParser.cpp?rev=176387&r1=176386&r2=176387&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentParser.cpp?rev=176387&r1=176386&r2=176387&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/AST/CommentParser.cpp (original)<br>+++ cfe/trunk/lib/AST/CommentParser.cpp Fri Mar  1 16:51:30 2013<br>@@ -313,15 +313,18 @@ BlockCommandComment *Parser::parseBlockC<br>    PC = S.actOnParamCommandStart(Tok.getLocation(),<br>                                  Tok.getEndLocation(),<br>                                  Tok.getCommandID());<br>+    PC->setHDCommand(Tok.getHDCommand());<br>  } else if (Info->IsTParamCommand) {<br>    IsTParam = true;<br>    TPC = S.actOnTParamCommandStart(Tok.getLocation(),<br>                                    Tok.getEndLocation(),<br>                                    Tok.getCommandID());<br>+    TPC->setHDCommand(Tok.getHDCommand());<br>  } else {<br>    BC = S.actOnBlockCommandStart(Tok.getLocation(),<br>                                  Tok.getEndLocation(),<br>                                  Tok.getCommandID());<br>+    BC->setHDCommand(Tok.getHDCommand());<br>  }<br>  consumeToken();<br><br>@@ -569,6 +572,7 @@ BlockContentComment *Parser::parseParagr<br>      if (Info->IsVerbatimBlockEndCommand) {<br>        Diag(Tok.getLocation(),<br>             diag::warn_verbatim_block_end_without_start)<br>+          << Tok.getHDCommand()<br>          << Info->Name<br>          << SourceRange(Tok.getLocation(), Tok.getEndLocation());<br>        consumeToken();<br><br>Modified: cfe/trunk/lib/AST/CommentSema.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentSema.cpp?rev=176387&r1=176386&r2=176387&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentSema.cpp?rev=176387&r1=176386&r2=176387&view=diff</a><br>==============================================================================<br>--- cfe/trunk/lib/AST/CommentSema.cpp (original)<br>+++ cfe/trunk/lib/AST/CommentSema.cpp Fri Mar  1 16:51:30 2013<br>@@ -432,6 +432,7 @@ void Sema::checkBlockCommandEmptyParagra<br>    if (!DiagLoc.isValid())<br>      DiagLoc = Command->getCommandNameRange(Traits).getEnd();<br>    Diag(DiagLoc, diag::warn_doc_block_command_empty_paragraph)<br>+      << Command->getHDCommand()<br>      << Command->getCommandName(Traits)<br>      << Command->getSourceRange();<br>  }<br>@@ -459,6 +460,7 @@ void Sema::checkReturnsCommand(const Blo<br>      }<br>      Diag(Command->getLocation(),<br>           diag::warn_doc_returns_attached_to_a_void_function)<br>+        << Command->getHDCommand()<br>        << Command->getCommandName(Traits)<br>        << DiagKind<br>        << Command->getSourceRange();<br>@@ -470,6 +472,7 @@ void Sema::checkReturnsCommand(const Blo<br><br>  Diag(Command->getLocation(),<br>       diag::warn_doc_returns_not_attached_to_a_function_decl)<br>+    << Command->getHDCommand()<br>    << Command->getCommandName(Traits)<br>    << Command->getSourceRange();<br>}<br>@@ -502,15 +505,18 @@ void Sema::checkBlockCommandDuplicate(co<br>  StringRef CommandName = Command->getCommandName(Traits);<br>  StringRef PrevCommandName = PrevCommand->getCommandName(Traits);<br>  Diag(Command->getLocation(), diag::warn_doc_block_command_duplicate)<br>+      << Command->getHDCommand()<br>      << CommandName<br>      << Command->getSourceRange();<br>  if (CommandName == PrevCommandName)<br>    Diag(PrevCommand->getLocation(), diag::note_doc_block_command_previous)<br>+        << PrevCommand->getHDCommand()<br>        << PrevCommandName<br>        << PrevCommand->getSourceRange();<br>  else<br>    Diag(PrevCommand->getLocation(),<br>         diag::note_doc_block_command_previous_alias)<br>+        << PrevCommand->getHDCommand()<br>        << PrevCommandName<br>        << CommandName;<br>}<br><br>Modified: cfe/trunk/test/Sema/warn-documentation.cpp<br>URL:<span class="Apple-converted-space"> </span><a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation.cpp?rev=176387&r1=176386&r2=176387&view=diff">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation.cpp?rev=176387&r1=176386&r2=176387&view=diff</a><br>==============================================================================<br>--- cfe/trunk/test/Sema/warn-documentation.cpp (original)<br>+++ cfe/trunk/test/Sema/warn-documentation.cpp Fri Mar  1 16:51:30 2013<br>@@ -862,28 +862,28 @@ int test_nocrash9;<br><br>// We used to crash on this.  PR15068<br><br>-// expected-warning@+2 {{empty paragraph passed to '\param' command}}<br>-// expected-warning@+2 {{empty paragraph passed to '\param' command}}<br>+// expected-warning@+2 {{empty paragraph passed to '@param' command}}<br>+// expected-warning@+2 {{empty paragraph passed to '@param' command}}<br>///@param x<br>///@param y<br>int test_nocrash10(int x, int y);<br><br>-// expected-warning@+2 {{empty paragraph passed to '\param' command}} expected-warning@+2 {{parameter 'x' not found in the function declaration}}<br>-// expected-warning@+2 {{empty paragraph passed to '\param' command}} expected-warning@+2 {{parameter 'y' not found in the function declaration}}<br>+// expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'x' not found in the function declaration}}<br>+// expected-warning@+2 {{empty paragraph passed to '@param' command}} expected-warning@+2 {{parameter 'y' not found in the function declaration}}<br>///@param x<br>///@param y<br>int test_nocrash11();<br><br>-// expected-warning@+3 {{empty paragraph passed to '\param' command}} expected-warning@+3 {{parameter 'x' not found in the function declaration}}<br>-// expected-warning@+3 {{empty paragraph passed to '\param' command}} expected-warning@+3 {{parameter 'y' not found in the function declaration}}<br>+// expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'x' not found in the function declaration}}<br>+// expected-warning@+3 {{empty paragraph passed to '@param' command}} expected-warning@+3 {{parameter 'y' not found in the function declaration}}<br>/**<br>@param x<br>@param y<br>**/<br>int test_nocrash12();<br><br>-// expected-warning@+2 {{empty paragraph passed to '\param' command}}<br>-// expected-warning@+1 {{empty paragraph passed to '\param' command}}<br>+// expected-warning@+2 {{empty paragraph passed to '@param' command}}<br>+// expected-warning@+1 {{empty paragraph passed to '@param' command}}<br>///@param x@param y<br>int test_nocrash13(int x, int y);<br><br>@@ -895,3 +895,15 @@ int test_nocrash13(int x, int y);<br>/// \headerfile foo.h<span class="Apple-converted-space"> </span><br>int test_duplicate_headerfile1(int);<br><br>+<br>+//<span class="Apple-converted-space"> </span><a href="rdar://13066276">rdar://13066276</a><br>+// expected-warning@+1 {{'@return' command used in a comment that is not attached to a function or method declaration}}<br>+/** @return s */<br>+struct s* f(void);<br>+struct s;<br>+<br>+// expected-warning@+1 {{'\return' command used in a comment that is not attached to a function or method declaration}}<br>+/** \return s */<br>+struct q* g(void);<br>+struct q;<br>+<br><br><br>_______________________________________________<br>cfe-commits mailing list<br><a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br><a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a></div></blockquote></div><br></body></html>