r232511 - Comment parsing: move a diagnostic to the correct group.
Dmitri Gribenko
gribozavr at gmail.com
Tue Mar 17 11:03:42 PDT 2015
Author: gribozavr
Date: Tue Mar 17 13:03:42 2015
New Revision: 232511
URL: http://llvm.org/viewvc/llvm-project?rev=232511&view=rev
Log:
Comment parsing: move a diagnostic to the correct group.
Based on a patch by LE GARREC Vincent.
Added:
cfe/trunk/test/Sema/warn-documentation-unknown-command.cpp
Modified:
cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td
cfe/trunk/lib/Sema/SemaDecl.cpp
cfe/trunk/test/Sema/warn-documentation-fixits.cpp
Modified: cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td?rev=232511&r1=232510&r2=232511&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td (original)
+++ cfe/trunk/include/clang/Basic/DiagnosticCommentKinds.td Tue Mar 17 13:03:42 2015
@@ -166,7 +166,7 @@ def warn_unknown_comment_command_name :
def warn_correct_comment_command_name : Warning<
"unknown command tag name '%0'; did you mean '%1'?">,
- InGroup<Documentation>, DefaultIgnore;
+ InGroup<DocumentationUnknownCommand>, DefaultIgnore;
} // end of documentation issue category
} // end of AST component
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=232511&r1=232510&r2=232511&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Mar 17 13:03:42 2015
@@ -9827,9 +9827,12 @@ void Sema::ActOnDocumentableDecl(Decl *D
void Sema::ActOnDocumentableDecls(ArrayRef<Decl *> Group) {
// Don't parse the comment if Doxygen diagnostics are ignored.
if (Group.empty() || !Group[0])
- return;
+ return;
- if (Diags.isIgnored(diag::warn_doc_param_not_found, Group[0]->getLocation()))
+ if (Diags.isIgnored(diag::warn_doc_param_not_found,
+ Group[0]->getLocation()) &&
+ Diags.isIgnored(diag::warn_unknown_comment_command_name,
+ Group[0]->getLocation()))
return;
if (Group.size() >= 2) {
Modified: cfe/trunk/test/Sema/warn-documentation-fixits.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation-fixits.cpp?rev=232511&r1=232510&r2=232511&view=diff
==============================================================================
--- cfe/trunk/test/Sema/warn-documentation-fixits.cpp (original)
+++ cfe/trunk/test/Sema/warn-documentation-fixits.cpp Tue Mar 17 13:03:42 2015
@@ -1,5 +1,5 @@
-// RUN: %clang_cc1 -fsyntax-only -Wdocumentation -fcomment-block-commands=foobar -verify %s
-// RUN: %clang_cc1 -fsyntax-only -Wdocumentation -fcomment-block-commands=foobar -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
+// RUN: %clang_cc1 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -fcomment-block-commands=foobar -verify %s
+// RUN: %clang_cc1 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -fcomment-block-commands=foobar -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
// expected-warning at +1 {{parameter 'ZZZZZZZZZZ' not found in the function declaration}} expected-note at +1 {{did you mean 'a'?}}
/// \param ZZZZZZZZZZ Blah blah.
@@ -67,6 +67,7 @@ int FooBar();
/// \fooba bbb IS_DOXYGEN_END
int gorf();
+// expected-warning at +1 {{unknown command tag name}}
/// \t bbb IS_DOXYGEN_END
int Bar();
@@ -88,4 +89,4 @@ int PR18051();
// CHECK: fix-it:"{{.*}}":{58:30-58:30}:" MY_ATTR_DEPRECATED"
// CHECK: fix-it:"{{.*}}":{63:6-63:11}:"return"
// CHECK: fix-it:"{{.*}}":{67:6-67:11}:"foobar"
-// CHECK: fix-it:"{{.*}}":{75:6-75:12}:"endcode"
+// CHECK: fix-it:"{{.*}}":{76:6-76:12}:"endcode"
Added: cfe/trunk/test/Sema/warn-documentation-unknown-command.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/warn-documentation-unknown-command.cpp?rev=232511&view=auto
==============================================================================
--- cfe/trunk/test/Sema/warn-documentation-unknown-command.cpp (added)
+++ cfe/trunk/test/Sema/warn-documentation-unknown-command.cpp Tue Mar 17 13:03:42 2015
@@ -0,0 +1,11 @@
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wdocumentation-unknown-command -verify %s
+// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Werror -Wno-documentation-unknown-command %s
+
+// expected-warning at +1 {{unknown command tag name}}
+/// aaa \unknown
+int test_unknown_comand_1;
+
+// expected-warning at +1 {{unknown command tag name 'retur'; did you mean 'return'?}}
+/// \retur aaa
+int test_unknown_comand_2();
+
More information about the cfe-commits
mailing list