summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDmitri Gribenko <gribozavr@gmail.com>2015-03-17 18:03:42 +0000
committerDmitri Gribenko <gribozavr@gmail.com>2015-03-17 18:03:42 +0000
commit7fe22f66d073d30de7be26b91bc4d64deaa46ec9 (patch)
treea145c7d759cc854398e3eefc1e995b75611ed980
parent24fcae8fa03ee609d2f8e65b028a6198ba2a2411 (diff)
downloadbcm5719-llvm-7fe22f66d073d30de7be26b91bc4d64deaa46ec9.tar.gz
bcm5719-llvm-7fe22f66d073d30de7be26b91bc4d64deaa46ec9.zip
Comment parsing: move a diagnostic to the correct group.
Based on a patch by LE GARREC Vincent. llvm-svn: 232511
-rw-r--r--clang/include/clang/Basic/DiagnosticCommentKinds.td2
-rw-r--r--clang/lib/Sema/SemaDecl.cpp7
-rw-r--r--clang/test/Sema/warn-documentation-fixits.cpp7
-rw-r--r--clang/test/Sema/warn-documentation-unknown-command.cpp11
4 files changed, 21 insertions, 6 deletions
diff --git a/clang/include/clang/Basic/DiagnosticCommentKinds.td b/clang/include/clang/Basic/DiagnosticCommentKinds.td
index 6dc8b27a2ac..ab24582c118 100644
--- a/clang/include/clang/Basic/DiagnosticCommentKinds.td
+++ b/clang/include/clang/Basic/DiagnosticCommentKinds.td
@@ -166,7 +166,7 @@ def warn_unknown_comment_command_name : Warning<
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
diff --git a/clang/lib/Sema/SemaDecl.cpp b/clang/lib/Sema/SemaDecl.cpp
index 7a70cddf9d0..01bd42ce80c 100644
--- a/clang/lib/Sema/SemaDecl.cpp
+++ b/clang/lib/Sema/SemaDecl.cpp
@@ -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) {
diff --git a/clang/test/Sema/warn-documentation-fixits.cpp b/clang/test/Sema/warn-documentation-fixits.cpp
index 675d86c366d..95c0e935075 100644
--- a/clang/test/Sema/warn-documentation-fixits.cpp
+++ b/clang/test/Sema/warn-documentation-fixits.cpp
@@ -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@+1 {{parameter 'ZZZZZZZZZZ' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}}
/// \param ZZZZZZZZZZ Blah blah.
@@ -67,6 +67,7 @@ int FooBar();
/// \fooba bbb IS_DOXYGEN_END
int gorf();
+// expected-warning@+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"
diff --git a/clang/test/Sema/warn-documentation-unknown-command.cpp b/clang/test/Sema/warn-documentation-unknown-command.cpp
new file mode 100644
index 00000000000..3674a9c6801
--- /dev/null
+++ b/clang/test/Sema/warn-documentation-unknown-command.cpp
@@ -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();
+
OpenPOWER on IntegriCloud