143 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -Wdocumentation -Wdocumentation-pedantic -fcomment-block-commands=foobar -verify %s2// 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))" %s3// 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]]" %s4 5// expected-warning@+1 {{parameter 'ZZZZZZZZZZ' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}}6/// \param ZZZZZZZZZZ Blah blah.7int 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.11int 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 Aaa15template<typename T>16void 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 Aaa20/// \tparam OtherTy Bbb21template<typename SomeTy, typename OtherTy>22void 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/// \deprecated26void 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/// \deprecated30void test_deprecated_2(int a);31 32struct 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 /// \deprecated35 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 /// \deprecated39 void test_deprecated_5() {40 }41};42 43template<typename T>44struct 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 /// \deprecated47 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 /// \deprecated51 void test_deprecated_8() {52 }53};54 55class 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 /// \deprecated59 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 /// \deprecated64 static auto test_deprecated_static_trailing_return() -> int;65 66#if __cplusplus >= 201402L67 // 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 /// \deprecated70 static decltype(auto) test_deprecated_static_decltype_auto() { return 1; }71#endif72 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 /// \deprecated76 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 /// \deprecated81 auto test_deprecated_trailing_return() -> int;82 83#if __cplusplus >= 201402L84 // 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 /// \deprecated87 decltype(auto) test_deprecated_decltype_auto() const { return a; }88 89private:90 int a{0};91#endif92};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/// \deprecated97void test_deprecated_9(int a);98 99#if __cplusplus >= 201402L100#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/// \deprecated104void test_deprecated_10(int a);105#endif106 107// expected-warning@+2 {{unknown command tag name 'retur'; did you mean 'return'?}}108/// \brief testing fixit109/// \retur int in FooBar110int FooBar();111 112// expected-warning@+1 {{unknown command tag name 'fooba'; did you mean 'foobar'?}}113/// \fooba bbb IS_DOXYGEN_END114int gorf();115 116// expected-warning@+1 {{unknown command tag name}}117/// \t bbb IS_DOXYGEN_END118int 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 PR18051123int 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"143