[cfe-commits] r163836 - in /cfe/trunk: include/clang/AST/CommentCommandTraits.h include/clang/AST/CommentCommands.td lib/AST/CommentSema.cpp test/Sema/warn-documentation.cpp utils/TableGen/ClangCommentCommandInfoEmitter.cpp

Dmitri Gribenko gribozavr at gmail.com
Thu Sep 13 13:36:01 PDT 2012


Author: gribozavr
Date: Thu Sep 13 15:36:01 2012
New Revision: 163836

URL: http://llvm.org/viewvc/llvm-project?rev=163836&view=rev
Log:
Comment parsing: handle \deprecated command.  It is a block command, but it
should be fine to use it without further explanations in the attached
paragraph, so the warning about empty paragraph was turned off for it.

Modified:
    cfe/trunk/include/clang/AST/CommentCommandTraits.h
    cfe/trunk/include/clang/AST/CommentCommands.td
    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=163836&r1=163835&r2=163836&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/CommentCommandTraits.h (original)
+++ cfe/trunk/include/clang/AST/CommentCommandTraits.h Thu Sep 13 15:36:01 2012
@@ -66,6 +66,10 @@
   /// a template parameter (\\tparam or an alias).
   unsigned IsTParamCommand : 1;
 
+  /// True if we don't want to warn about this command being passed an empty
+  /// paragraph.  Meaningful only for block commands.
+  unsigned IsEmptyParagraphAllowed : 1;
+
   /// \brief True if this command is a verbatim-like block command.
   ///
   /// A verbatim-like block command eats every character (except line starting

Modified: cfe/trunk/include/clang/AST/CommentCommands.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CommentCommands.td?rev=163836&r1=163835&r2=163836&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/CommentCommands.td (original)
+++ cfe/trunk/include/clang/AST/CommentCommands.td Thu Sep 13 15:36:01 2012
@@ -12,6 +12,8 @@
   bit IsParamCommand = 0;
   bit IsTParamCommand = 0;
 
+  bit IsEmptyParagraphAllowed = 0;
+
   bit IsVerbatimBlockCommand = 0;
   bit IsVerbatimBlockEndCommand = 0;
   bit IsVerbatimLineCommand = 0;
@@ -73,6 +75,8 @@
 // HeaderDoc
 def Templatefield : BlockCommand<"templatefield"> { let IsTParamCommand = 1; }
 
+def Deprecated : BlockCommand<"deprecated"> { let IsEmptyParagraphAllowed = 1; }
+
 def Author     : BlockCommand<"author">;
 def Authors    : BlockCommand<"authors">;
 def Bug        : BlockCommand<"bug">;

Modified: cfe/trunk/lib/AST/CommentSema.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/AST/CommentSema.cpp?rev=163836&r1=163835&r2=163836&view=diff
==============================================================================
--- cfe/trunk/lib/AST/CommentSema.cpp (original)
+++ cfe/trunk/lib/AST/CommentSema.cpp Thu Sep 13 15:36:01 2012
@@ -415,6 +415,9 @@
 }
 
 void Sema::checkBlockCommandEmptyParagraph(BlockCommandComment *Command) {
+  if (Traits.getCommandInfo(Command->getCommandID())->IsEmptyParagraphAllowed)
+    return;
+
   ParagraphComment *Paragraph = Command->getParagraph();
   if (Paragraph->isWhitespace()) {
     SourceLocation DiagLoc;

Modified: cfe/trunk/test/Sema/warn-documentation.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation.cpp?rev=163836&r1=163835&r2=163836&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-documentation.cpp (original)
+++ cfe/trunk/test/Sema/warn-documentation.cpp Thu Sep 13 15:36:01 2012
@@ -371,6 +371,19 @@
 template<typename T>
 using test_tparam15 = test_tparam13<T, int>;
 
+
+/// Aaa
+/// \deprecated Bbb
+void test_deprecated_1(int a);
+
+// We don't want \deprecated to warn about empty paragraph.  It is fine to use
+// \deprecated by itself without explanations.
+
+/// Aaa
+/// \deprecated
+void test_deprecated_2(int a);
+
+
 // no-warning
 /// \returns Aaa
 int test_returns_right_decl_1(int);

Modified: cfe/trunk/utils/TableGen/ClangCommentCommandInfoEmitter.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/utils/TableGen/ClangCommentCommandInfoEmitter.cpp?rev=163836&r1=163835&r2=163836&view=diff
==============================================================================
--- cfe/trunk/utils/TableGen/ClangCommentCommandInfoEmitter.cpp (original)
+++ cfe/trunk/utils/TableGen/ClangCommentCommandInfoEmitter.cpp Thu Sep 13 15:36:01 2012
@@ -38,6 +38,7 @@
        << Tag.getValueAsBit("IsReturnsCommand") << ", "
        << Tag.getValueAsBit("IsParamCommand") << ", "
        << Tag.getValueAsBit("IsTParamCommand") << ", "
+       << Tag.getValueAsBit("IsEmptyParagraphAllowed") << ", "
        << Tag.getValueAsBit("IsVerbatimBlockCommand") << ", "
        << Tag.getValueAsBit("IsVerbatimBlockEndCommand") << ", "
        << Tag.getValueAsBit("IsVerbatimLineCommand") << ", "





More information about the cfe-commits mailing list