]> granicus.if.org Git - clang/commitdiff
Comment parsing: move a diagnostic to the correct group.
authorDmitri Gribenko <gribozavr@gmail.com>
Tue, 17 Mar 2015 18:03:42 +0000 (18:03 +0000)
committerDmitri Gribenko <gribozavr@gmail.com>
Tue, 17 Mar 2015 18:03:42 +0000 (18:03 +0000)
Based on a patch by LE GARREC Vincent.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@232511 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Basic/DiagnosticCommentKinds.td
lib/Sema/SemaDecl.cpp
test/Sema/warn-documentation-fixits.cpp
test/Sema/warn-documentation-unknown-command.cpp [new file with mode: 0644]

index 6dc8b27a2ac91448b05cb25129e914f2d499c430..ab24582c1180e464c24c43c7f7d20c29e3d1c15b 100644 (file)
@@ -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
index 7a70cddf9d0afc14eb532f784296c0f3e3bc255f..01bd42ce80cf0ea1bc2553b921bb16a4c9c1d49c 100644 (file)
@@ -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) {
index 675d86c366db01815afeafd65bec38b06dd2ab3b..95c0e93507586634fa94cc16a8ee2f585a44ebaf 100644 (file)
@@ -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/test/Sema/warn-documentation-unknown-command.cpp b/test/Sema/warn-documentation-unknown-command.cpp
new file mode 100644 (file)
index 0000000..3674a9c
--- /dev/null
@@ -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();
+