| 1 |
// RUN: %clang_cc1 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -fcomment-block-commands=foobar -verify %s |
| 2 |
// RUN: %clang_cc1 -std=c++11 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -fcomment-block-commands=foobar -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck -DATTRIBUTE="__attribute__((deprecated))" %s |
| 3 |
// RUN: %clang_cc1 -std=c++14 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -fcomment-block-commands=foobar -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck --check-prefixes=CHECK,CHECK14 -DATTRIBUTE="[[deprecated]]" %s |
| 4 |
|
| 5 |
// expected-warning@+1 {{parameter 'ZZZZZZZZZZ' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}} |
| 6 |
/// \param ZZZZZZZZZZ Blah blah. |
| 7 |
int test1(int a); |
| 8 |
|
| 9 |
// expected-warning@+1 {{parameter 'aab' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}} |
| 10 |
/// \param aab Blah blah. |
| 11 |
int test2(int aaa, int bbb); |
| 12 |
|
| 13 |
// expected-warning@+1 {{template parameter 'ZZZZZZZZZZ' not found in the template declaration}} expected-note@+1 {{did you mean 'T'?}} |
| 14 |
/// \tparam ZZZZZZZZZZ Aaa |
| 15 |
template<typename T> |
| 16 |
void test3(T aaa); |
| 17 |
|
| 18 |
// expected-warning@+1 {{template parameter 'SomTy' not found in the template declaration}} expected-note@+1 {{did you mean 'SomeTy'?}} |
| 19 |
/// \tparam SomTy Aaa |
| 20 |
/// \tparam OtherTy Bbb |
| 21 |
template<typename SomeTy, typename OtherTy> |
| 22 |
void test4(SomeTy aaa, OtherTy bbb); |
| 23 |
|
| 24 |
// expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} |
| 25 |
/// \deprecated |
| 26 |
void test_deprecated_1(); |
| 27 |
|
| 28 |
// expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} |
| 29 |
/// \deprecated |
| 30 |
void test_deprecated_2(int a); |
| 31 |
|
| 32 |
struct test_deprecated_3 { |
| 33 |
// expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} |
| 34 |
/// \deprecated |
| 35 |
void test_deprecated_4(); |
| 36 |
|
| 37 |
// expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} |
| 38 |
/// \deprecated |
| 39 |
void test_deprecated_5() { |
| 40 |
} |
| 41 |
}; |
| 42 |
|
| 43 |
template<typename T> |
| 44 |
struct test_deprecated_6 { |
| 45 |
// expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} |
| 46 |
/// \deprecated |
| 47 |
void test_deprecated_7(); |
| 48 |
|
| 49 |
// expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} |
| 50 |
/// \deprecated |
| 51 |
void test_deprecated_8() { |
| 52 |
} |
| 53 |
}; |
| 54 |
|
| 55 |
class PR43753 { |
| 56 |
// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} |
| 57 |
// expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} |
| 58 |
/// \deprecated |
| 59 |
static void test_deprecated_static(); |
| 60 |
|
| 61 |
// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} |
| 62 |
// expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} |
| 63 |
/// \deprecated |
| 64 |
static auto test_deprecated_static_trailing_return() -> int; |
| 65 |
|
| 66 |
#if __cplusplus >= 201402L |
| 67 |
// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} |
| 68 |
// expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} |
| 69 |
/// \deprecated |
| 70 |
static decltype(auto) test_deprecated_static_decltype_auto() { return 1; } |
| 71 |
#endif |
| 72 |
|
| 73 |
// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} |
| 74 |
// expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} |
| 75 |
/// \deprecated |
| 76 |
void test_deprecated_const() const; |
| 77 |
|
| 78 |
// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} |
| 79 |
// expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} |
| 80 |
/// \deprecated |
| 81 |
auto test_deprecated_trailing_return() -> int; |
| 82 |
|
| 83 |
#if __cplusplus >= 201402L |
| 84 |
// expected-warning@+2 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} |
| 85 |
// expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} |
| 86 |
/// \deprecated |
| 87 |
decltype(auto) test_deprecated_decltype_auto() const { return a; } |
| 88 |
|
| 89 |
private: |
| 90 |
int a{0}; |
| 91 |
#endif |
| 92 |
}; |
| 93 |
#define MY_ATTR_DEPRECATED __attribute__((deprecated)) |
| 94 |
|
| 95 |
// expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} |
| 96 |
/// \deprecated |
| 97 |
void test_deprecated_9(int a); |
| 98 |
|
| 99 |
#if __cplusplus >= 201402L |
| 100 |
#define ATTRIBUTE_DEPRECATED [[deprecated]] |
| 101 |
|
| 102 |
// expected-warning@+1 {{declaration is marked with '\deprecated' command but does not have a deprecation attribute}} expected-note@+2 {{add a deprecation attribute to the declaration to silence this warning}} |
| 103 |
/// \deprecated |
| 104 |
void test_deprecated_10(int a); |
| 105 |
#endif |
| 106 |
|
| 107 |
// expected-warning@+2 {{unknown command tag name 'retur'; did you mean 'return'?}} |
| 108 |
/// \brief testing fixit |
| 109 |
/// \retur int in FooBar |
| 110 |
int FooBar(); |
| 111 |
|
| 112 |
// expected-warning@+1 {{unknown command tag name 'fooba'; did you mean 'foobar'?}} |
| 113 |
/// \fooba bbb IS_DOXYGEN_END |
| 114 |
int gorf(); |
| 115 |
|
| 116 |
// expected-warning@+1 {{unknown command tag name}} |
| 117 |
/// \t bbb IS_DOXYGEN_END |
| 118 |
int Bar(); |
| 119 |
|
| 120 |
// expected-warning@+2 {{unknown command tag name 'encode'; did you mean 'endcode'?}} |
| 121 |
// expected-warning@+1 {{'\endcode' command does not terminate a verbatim text block}} |
| 122 |
/// \encode PR18051 |
| 123 |
int PR18051(); |
| 124 |
|
| 125 |
// CHECK: fix-it:"{{.*}}":{6:12-6:22}:"a" |
| 126 |
// CHECK: fix-it:"{{.*}}":{10:12-10:15}:"aaa" |
| 127 |
// CHECK: fix-it:"{{.*}}":{14:13-14:23}:"T" |
| 128 |
// CHECK: fix-it:"{{.*}}":{19:13-19:18}:"SomeTy" |
| 129 |
// CHECK: fix-it:"{{.*}}":{26:1-26:1}:"[[ATTRIBUTE]] " |
| 130 |
// CHECK: fix-it:"{{.*}}":{30:1-30:1}:"[[ATTRIBUTE]] " |
| 131 |
// CHECK: fix-it:"{{.*}}":{35:3-35:3}:"[[ATTRIBUTE]] " |
| 132 |
// CHECK: fix-it:"{{.*}}":{39:3-39:3}:"[[ATTRIBUTE]] " |
| 133 |
// CHECK: fix-it:"{{.*}}":{47:3-47:3}:"[[ATTRIBUTE]] " |
| 134 |
// CHECK: fix-it:"{{.*}}":{51:3-51:3}:"[[ATTRIBUTE]] " |
| 135 |
// CHECK: fix-it:"{{.*}}":{76:3-76:3}:"[[ATTRIBUTE]] " |
| 136 |
// CHECK: fix-it:"{{.*}}":{81:3-81:3}:"[[ATTRIBUTE]] " |
| 137 |
// CHECK14: fix-it:"{{.*}}":{87:3-87:3}:"[[ATTRIBUTE]] " |
| 138 |
// CHECK: fix-it:"{{.*}}":{97:1-97:1}:"MY_ATTR_DEPRECATED " |
| 139 |
// CHECK14: fix-it:"{{.*}}":{104:1-104:1}:"ATTRIBUTE_DEPRECATED " |
| 140 |
// CHECK: fix-it:"{{.*}}":{109:6-109:11}:"return" |
| 141 |
// CHECK: fix-it:"{{.*}}":{113:6-113:11}:"foobar" |
| 142 |
// CHECK: fix-it:"{{.*}}":{122:6-122:12}:"endcode" |