Mordante created this revision.
Mordante added a reviewer: gribozavr2.
Mordante added a project: clang.
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
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D71139
Files:
clang/include/clang/Basic/DiagnosticCommentKinds.td
clang/lib/AST/CommentSema.cpp
clang/test/Sema/warn-documentation.cpp
Index: clang/test/Sema/warn-documentation.cpp
===================================================================
--- clang/test/Sema/warn-documentation.cpp
+++ clang/test/Sema/warn-documentation.cpp
@@ -631,9 +631,9 @@
/// \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) {
}
Index: clang/lib/AST/CommentSema.cpp
===================================================================
--- clang/lib/AST/CommentSema.cpp
+++ clang/lib/AST/CommentSema.cpp
@@ -676,9 +676,8 @@
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)) {
Index: clang/include/clang/Basic/DiagnosticCommentKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticCommentKinds.td
+++ clang/include/clang/Basic/DiagnosticCommentKinds.td
@@ -146,8 +146,8 @@
// \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<
Index: clang/test/Sema/warn-documentation.cpp
===================================================================
--- clang/test/Sema/warn-documentation.cpp
+++ clang/test/Sema/warn-documentation.cpp
@@ -631,9 +631,9 @@
/// \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) {
}
Index: clang/lib/AST/CommentSema.cpp
===================================================================
--- clang/lib/AST/CommentSema.cpp
+++ clang/lib/AST/CommentSema.cpp
@@ -676,9 +676,8 @@
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)) {
Index: clang/include/clang/Basic/DiagnosticCommentKinds.td
===================================================================
--- clang/include/clang/Basic/DiagnosticCommentKinds.td
+++ clang/include/clang/Basic/DiagnosticCommentKinds.td
@@ -146,8 +146,8 @@
// \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<
_______________________________________________
cfe-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits