diff options
| author | Dmitri Gribenko <gribozavr@gmail.com> | 2012-09-13 20:36:01 +0000 |
|---|---|---|
| committer | Dmitri Gribenko <gribozavr@gmail.com> | 2012-09-13 20:36:01 +0000 |
| commit | b37d5e8a953d34e956625e6feb20f6c64b1691e7 (patch) | |
| tree | 4b4f287d1f3878efbb1c77c3bd741be59e51418f | |
| parent | 8b48bf27b0fcce0892d2768a0202fde9a1d14de5 (diff) | |
| download | bcm5719-llvm-b37d5e8a953d34e956625e6feb20f6c64b1691e7.tar.gz bcm5719-llvm-b37d5e8a953d34e956625e6feb20f6c64b1691e7.zip | |
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.
llvm-svn: 163836
| -rw-r--r-- | clang/include/clang/AST/CommentCommandTraits.h | 4 | ||||
| -rw-r--r-- | clang/include/clang/AST/CommentCommands.td | 4 | ||||
| -rw-r--r-- | clang/lib/AST/CommentSema.cpp | 3 | ||||
| -rw-r--r-- | clang/test/Sema/warn-documentation.cpp | 13 | ||||
| -rw-r--r-- | clang/utils/TableGen/ClangCommentCommandInfoEmitter.cpp | 1 |
5 files changed, 25 insertions, 0 deletions
diff --git a/clang/include/clang/AST/CommentCommandTraits.h b/clang/include/clang/AST/CommentCommandTraits.h index 07d9a489e32..73ded54a31b 100644 --- a/clang/include/clang/AST/CommentCommandTraits.h +++ b/clang/include/clang/AST/CommentCommandTraits.h @@ -66,6 +66,10 @@ struct CommandInfo { /// 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 diff --git a/clang/include/clang/AST/CommentCommands.td b/clang/include/clang/AST/CommentCommands.td index 7238b535b3e..787a0161abf 100644 --- a/clang/include/clang/AST/CommentCommands.td +++ b/clang/include/clang/AST/CommentCommands.td @@ -12,6 +12,8 @@ class Command<string name> { bit IsParamCommand = 0; bit IsTParamCommand = 0; + bit IsEmptyParagraphAllowed = 0; + bit IsVerbatimBlockCommand = 0; bit IsVerbatimBlockEndCommand = 0; bit IsVerbatimLineCommand = 0; @@ -73,6 +75,8 @@ def Tparam : BlockCommand<"tparam"> { let IsTParamCommand = 1; } // 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">; diff --git a/clang/lib/AST/CommentSema.cpp b/clang/lib/AST/CommentSema.cpp index 477717f735e..6d84a2a4b91 100644 --- a/clang/lib/AST/CommentSema.cpp +++ b/clang/lib/AST/CommentSema.cpp @@ -415,6 +415,9 @@ FullComment *Sema::actOnFullComment( } void Sema::checkBlockCommandEmptyParagraph(BlockCommandComment *Command) { + if (Traits.getCommandInfo(Command->getCommandID())->IsEmptyParagraphAllowed) + return; + ParagraphComment *Paragraph = Command->getParagraph(); if (Paragraph->isWhitespace()) { SourceLocation DiagLoc; diff --git a/clang/test/Sema/warn-documentation.cpp b/clang/test/Sema/warn-documentation.cpp index 28544e0a81b..a18a0a44a4e 100644 --- a/clang/test/Sema/warn-documentation.cpp +++ b/clang/test/Sema/warn-documentation.cpp @@ -371,6 +371,19 @@ using test_tparam14 = test_tparam13<T, int>; 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); diff --git a/clang/utils/TableGen/ClangCommentCommandInfoEmitter.cpp b/clang/utils/TableGen/ClangCommentCommandInfoEmitter.cpp index 11b2f51f71b..599d1385a83 100644 --- a/clang/utils/TableGen/ClangCommentCommandInfoEmitter.cpp +++ b/clang/utils/TableGen/ClangCommentCommandInfoEmitter.cpp @@ -38,6 +38,7 @@ void EmitClangCommentCommandInfo(RecordKeeper &Records, raw_ostream &OS) { << Tag.getValueAsBit("IsReturnsCommand") << ", " << Tag.getValueAsBit("IsParamCommand") << ", " << Tag.getValueAsBit("IsTParamCommand") << ", " + << Tag.getValueAsBit("IsEmptyParagraphAllowed") << ", " << Tag.getValueAsBit("IsVerbatimBlockCommand") << ", " << Tag.getValueAsBit("IsVerbatimBlockEndCommand") << ", " << Tag.getValueAsBit("IsVerbatimLineCommand") << ", " |

