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

jahanian fjahanian at apple.com
Mon Mar 4 17:26:42 PST 2013


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
> ==============================================================================
> --- cfe/trunk/include/clang/AST/CommentSema.h (original)
> +++ cfe/trunk/include/clang/AST/CommentSema.h Mon Mar  4 19:05:07 2013
> @@ -198,6 +198,8 @@ public:
>    void checkBlockCommandDuplicate(const BlockCommandComment *Command);
> 
>    void checkDeprecatedCommand(const BlockCommandComment *Comment);
> +
> +  void checkFunctionDeclVerbatimLine(const BlockCommandComment *Comment);
> 
>    /// Resolve parameter names to parameter indexes in function declaration.
>    /// Emit diagnostics about unknown parametrs.
> 
> Modified: cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td?rev=176468&r1=176467&r2=176468&view=diff
> ==============================================================================
> --- cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td (original)
> +++ cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td Mon Mar  4 19:05:07 2013
> @@ -73,6 +73,11 @@ def warn_doc_param_not_attached_to_a_fun
>    "a function declaration">,
>    InGroup<Documentation>, DefaultIgnore;
> 
> +def warn_doc_function_not_attached_to_a_function_decl : Warning<
> +  "'@function' command used in a comment that is attached to "
> 
> This diagnostic has an issue of backslash versus at, similar to what you were fixing recently.

There is no \function AFAIK.
- fj


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20130304/cda97900/attachment.html>


More information about the cfe-commits mailing list