r176468 - doc parsing. We want to issue a strong warning when

Dmitri Gribenko gribozavr at gmail.com
Mon Mar 4 17:29:41 PST 2013


On Tuesday, March 5, 2013, jahanian wrote:

>
> On Mar 4, 2013, at 5:25 PM, Dmitri Gribenko <gribozavr at gmail.com> wrote:
>
>
>
> On Tuesday, March 5, 2013, Fariborz Jahanian wrote:
>
> Author: fjahanian
> Date: Mon Mar  4 19:05:07 2013
> New Revision: 176468
>
> URL: http://llvm.org/viewvc/llvm-project?rev=176468&view=rev
> Log:
> doc parsing. We want to issue a strong warning when
> an @function comment is not followed by a function decl.
> // rdar://13094352
>
> Modified:
>     cfe/trunk/include/clang/AST/CommentCommandTraits.h
>     cfe/trunk/include/clang/AST/CommentCommands.td
>     cfe/trunk/include/clang/AST/CommentSema.h
>     cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td
>     cfe/trunk/lib/AST/CommentParser.cpp
>     cfe/trunk/lib/AST/CommentSema.cpp
>     cfe/trunk/test/Sema/warn-documentation.cpp
>     cfe/trunk/utils/TableGen/ClangCommentCommandInfoEmitter.cpp
>
> Modified: cfe/trunk/include/clang/AST/CommentCommandTraits.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentCommandTraits.h?rev=176468&r1=176467&r2=176468&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/AST/CommentCommandTraits.h (original)
> +++ cfe/trunk/include/clang/AST/CommentCommandTraits.h Mon Mar  4 19:05:07
> 2013
> @@ -100,7 +100,10 @@ struct CommandInfo {
>    ///   \fn void f(int a);
>    /// \endcode
>    unsigned IsDeclarationCommand : 1;
> -
> +
> +  /// \brief True if verbatim-like line command is a function declaraton.
> +  unsigned IsFunctionDeclarationCommand : 1;
> +
>    /// \brief True if this command is unknown.  This \c CommandInfo object
> was
>    /// created during parsing.
>    unsigned IsUnknownCommand : 1;
>
> Modified: cfe/trunk/include/clang/AST/CommentCommands.td
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentCommands.td?rev=176468&r1=176467&r2=176468&view=diff
>
> ==============================================================================
> --- cfe/trunk/include/clang/AST/CommentCommands.td (original)
> +++ cfe/trunk/include/clang/AST/CommentCommands.td Mon Mar  4 19:05:07 2013
> @@ -24,6 +24,7 @@ class Command<string name> {
>    bit IsVerbatimBlockEndCommand = 0;
>    bit IsVerbatimLineCommand = 0;
>    bit IsDeclarationCommand = 0;
> +  bit IsFunctionDeclarationCommand = 0;
>  }
>
>  class InlineCommand<string name> : Command<name> {
> @@ -59,6 +60,12 @@ class DeclarationVerbatimLineCommand<str
>    let IsDeclarationCommand = 1;
>  }
>
> +class FunctionDeclarationVerbatimLineCommand<string name> :
> +      VerbatimLineCommand<name> {
> +  let IsDeclarationCommand = 1;
> +  let IsFunctionDeclarationCommand = 1;
> +}
> +
>
>  //===----------------------------------------------------------------------===//
>  // InlineCommand
>
>  //===----------------------------------------------------------------------===//
> @@ -179,7 +186,7 @@ def Interface : DeclarationVerbatimLineC
>  def Protocol  : DeclarationVerbatimLineCommand<"protocol">;
>  def Category  : DeclarationVerbatimLineCommand<"category">;
>  def Template  : DeclarationVerbatimLineCommand<"template">;
> -def Function  : DeclarationVerbatimLineCommand<"function">;
> +def Function  : FunctionDeclarationVerbatimLineCommand<"function">;
>  def Method    : DeclarationVerbatimLineCommand<"method">;
>  def Callback  : DeclarationVerbatimLineCommand<"callback">;
>  def Const     : DeclarationVerbatimLineCommand<"const">;
>
> Modified: cfe/trunk/include/clang/AST/CommentSema.h
> URL:
> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentSema.h?rev=176468&r1=176467&r2=176468&view=diff
> =============================================================
>
> There is no \function AFAIK.
>

While this might be the case for HeaderDoc, there is \function in Doxygen,
and we handle both of these in an identical way.

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


More information about the cfe-commits mailing list