Author: Mark de Wever Date: 2019-12-10T21:16:07+01:00 New Revision: 85fff898bb3175693e12536a837c8ad0ec8b2cdd
URL: https://github.com/llvm/llvm-project/commit/85fff898bb3175693e12536a837c8ad0ec8b2cdd DIFF: https://github.com/llvm/llvm-project/commit/85fff898bb3175693e12536a837c8ad0ec8b2cdd.diff LOG: [Wdocumentation] Use the command marker. Use the proper marker for -Wdocumentation-deprecated-sync instead of hard-coded the backslash. Discovered while looking at https://bugs.llvm.org/show_bug.cgi?id=43753 Differential Revision: https://reviews.llvm.org/D71139 Added: Modified: clang/include/clang/Basic/DiagnosticCommentKinds.td clang/lib/AST/CommentSema.cpp clang/test/Sema/warn-documentation.cpp Removed: ################################################################################ diff --git a/clang/include/clang/Basic/DiagnosticCommentKinds.td b/clang/include/clang/Basic/DiagnosticCommentKinds.td index c577ac408539..ae63bb623ed3 100644 --- a/clang/include/clang/Basic/DiagnosticCommentKinds.td +++ b/clang/include/clang/Basic/DiagnosticCommentKinds.td @@ -146,8 +146,8 @@ def warn_doc_returns_attached_to_a_void_function : Warning< // \deprecated command def warn_doc_deprecated_not_sync : Warning< - "declaration is marked with '\\deprecated' command but does not have " - "a deprecation attribute">, + "declaration is marked with '%select{\\|@}0deprecated' command but does " + "not have a deprecation attribute">, InGroup<DocumentationDeprecatedSync>, DefaultIgnore; def note_add_deprecation_attr : Note< diff --git a/clang/lib/AST/CommentSema.cpp b/clang/lib/AST/CommentSema.cpp index 69d61dc55162..bef555d3ebe7 100644 --- a/clang/lib/AST/CommentSema.cpp +++ b/clang/lib/AST/CommentSema.cpp @@ -676,9 +676,8 @@ void Sema::checkDeprecatedCommand(const BlockCommandComment *Command) { D->hasAttr<UnavailableAttr>()) return; - Diag(Command->getLocation(), - diag::warn_doc_deprecated_not_sync) - << Command->getSourceRange(); + Diag(Command->getLocation(), diag::warn_doc_deprecated_not_sync) + << Command->getSourceRange() << Command->getCommandMarker(); // Try to emit a fixit with a deprecation attribute. if (const FunctionDecl *FD = dyn_cast<FunctionDecl>(D)) { diff --git a/clang/test/Sema/warn-documentation.cpp b/clang/test/Sema/warn-documentation.cpp index 93273559a905..3d23acc1bebf 100644 --- a/clang/test/Sema/warn-documentation.cpp +++ b/clang/test/Sema/warn-documentation.cpp @@ -631,9 +631,9 @@ void test_deprecated_4(int a) __attribute__((unavailable)); /// \deprecated void test_deprecated_5(int a); -// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+3 {{add a deprecation attribute to the declaration to silence this warning}} +// expected-warning@+2 {{declaration is marked with '@deprecated' command but does not have a deprecation attribute}} expected-note@+3 {{add a deprecation attribute to the declaration to silence this warning}} /// Aaa -/// \deprecated +/// @deprecated void test_deprecated_6(int a) { } _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits