Comment parsing: move a diagnostic to the correct group.

Based on a patch by LE GARREC Vincent.

llvm-svn: 232511
This commit is contained in:
Dmitri Gribenko 2015-03-17 18:03:42 +00:00
parent 24fcae8fa0
commit 7fe22f66d0
4 changed files with 21 additions and 6 deletions

View File

@ -166,7 +166,7 @@ def warn_unknown_comment_command_name : Warning<
def warn_correct_comment_command_name : Warning< def warn_correct_comment_command_name : Warning<
"unknown command tag name '%0'; did you mean '%1'?">, "unknown command tag name '%0'; did you mean '%1'?">,
InGroup<Documentation>, DefaultIgnore; InGroup<DocumentationUnknownCommand>, DefaultIgnore;
} // end of documentation issue category } // end of documentation issue category
} // end of AST component } // end of AST component

View File

@ -9827,9 +9827,12 @@ void Sema::ActOnDocumentableDecl(Decl *D) {
void Sema::ActOnDocumentableDecls(ArrayRef<Decl *> Group) { void Sema::ActOnDocumentableDecls(ArrayRef<Decl *> Group) {
// Don't parse the comment if Doxygen diagnostics are ignored. // Don't parse the comment if Doxygen diagnostics are ignored.
if (Group.empty() || !Group[0]) 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; return;
if (Group.size() >= 2) { if (Group.size() >= 2) {

View File

@ -1,5 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -Wdocumentation -fcomment-block-commands=foobar -verify %s // RUN: %clang_cc1 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -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 -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
// expected-warning@+1 {{parameter 'ZZZZZZZZZZ' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}} // expected-warning@+1 {{parameter 'ZZZZZZZZZZ' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}}
/// \param ZZZZZZZZZZ Blah blah. /// \param ZZZZZZZZZZ Blah blah.
@ -67,6 +67,7 @@ int FooBar();
/// \fooba bbb IS_DOXYGEN_END /// \fooba bbb IS_DOXYGEN_END
int gorf(); int gorf();
// expected-warning@+1 {{unknown command tag name}}
/// \t bbb IS_DOXYGEN_END /// \t bbb IS_DOXYGEN_END
int Bar(); int Bar();
@ -88,4 +89,4 @@ int PR18051();
// CHECK: fix-it:"{{.*}}":{58:30-58:30}:" MY_ATTR_DEPRECATED" // CHECK: fix-it:"{{.*}}":{58:30-58:30}:" MY_ATTR_DEPRECATED"
// CHECK: fix-it:"{{.*}}":{63:6-63:11}:"return" // CHECK: fix-it:"{{.*}}":{63:6-63:11}:"return"
// CHECK: fix-it:"{{.*}}":{67:6-67:11}:"foobar" // CHECK: fix-it:"{{.*}}":{67:6-67:11}:"foobar"
// CHECK: fix-it:"{{.*}}":{75:6-75:12}:"endcode" // CHECK: fix-it:"{{.*}}":{76:6-76:12}:"endcode"

View File

@ -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@+1 {{unknown command tag name}}
/// aaa \unknown
int test_unknown_comand_1;
// expected-warning@+1 {{unknown command tag name 'retur'; did you mean 'return'?}}
/// \retur aaa
int test_unknown_comand_2();