xref: /minix3/external/bsd/llvm/dist/clang/test/Sema/warn-documentation-fixits.cpp (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -Wdocumentation -fcomment-block-commands=foobar -verify %s
2f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -Wdocumentation -fcomment-block-commands=foobar -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
3f4a2713aSLionel Sambuc 
4f4a2713aSLionel Sambuc // expected-warning@+1 {{parameter 'ZZZZZZZZZZ' not found in the function declaration}} expected-note@+1 {{did you mean 'a'?}}
5f4a2713aSLionel Sambuc /// \param ZZZZZZZZZZ Blah blah.
6f4a2713aSLionel Sambuc int test1(int a);
7f4a2713aSLionel Sambuc 
8f4a2713aSLionel Sambuc // expected-warning@+1 {{parameter 'aab' not found in the function declaration}} expected-note@+1 {{did you mean 'aaa'?}}
9f4a2713aSLionel Sambuc /// \param aab Blah blah.
10f4a2713aSLionel Sambuc int test2(int aaa, int bbb);
11f4a2713aSLionel Sambuc 
12f4a2713aSLionel Sambuc // expected-warning@+1 {{template parameter 'ZZZZZZZZZZ' not found in the template declaration}} expected-note@+1 {{did you mean 'T'?}}
13f4a2713aSLionel Sambuc /// \tparam ZZZZZZZZZZ Aaa
14f4a2713aSLionel Sambuc template<typename T>
15f4a2713aSLionel Sambuc void test3(T aaa);
16f4a2713aSLionel Sambuc 
17f4a2713aSLionel Sambuc // expected-warning@+1 {{template parameter 'SomTy' not found in the template declaration}} expected-note@+1 {{did you mean 'SomeTy'?}}
18f4a2713aSLionel Sambuc /// \tparam SomTy Aaa
19f4a2713aSLionel Sambuc /// \tparam OtherTy Bbb
20f4a2713aSLionel Sambuc template<typename SomeTy, typename OtherTy>
21f4a2713aSLionel Sambuc void test4(SomeTy aaa, OtherTy bbb);
22f4a2713aSLionel Sambuc 
23f4a2713aSLionel Sambuc // 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}}
24f4a2713aSLionel Sambuc /// \deprecated
25f4a2713aSLionel Sambuc void test_deprecated_1();
26f4a2713aSLionel Sambuc 
27f4a2713aSLionel Sambuc // 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}}
28f4a2713aSLionel Sambuc /// \deprecated
29f4a2713aSLionel Sambuc void test_deprecated_2(int a);
30f4a2713aSLionel Sambuc 
31f4a2713aSLionel Sambuc struct test_deprecated_3 {
32f4a2713aSLionel Sambuc   // 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}}
33f4a2713aSLionel Sambuc   /// \deprecated
34f4a2713aSLionel Sambuc   void test_deprecated_4();
35f4a2713aSLionel Sambuc 
36f4a2713aSLionel Sambuc   // 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}}
37f4a2713aSLionel Sambuc   /// \deprecated
test_deprecated_5test_deprecated_338f4a2713aSLionel Sambuc   void test_deprecated_5() {
39f4a2713aSLionel Sambuc   }
40f4a2713aSLionel Sambuc };
41f4a2713aSLionel Sambuc 
42f4a2713aSLionel Sambuc template<typename T>
43f4a2713aSLionel Sambuc struct test_deprecated_6 {
44f4a2713aSLionel Sambuc   // 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}}
45f4a2713aSLionel Sambuc   /// \deprecated
46f4a2713aSLionel Sambuc   void test_deprecated_7();
47f4a2713aSLionel Sambuc 
48f4a2713aSLionel Sambuc   // 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}}
49f4a2713aSLionel Sambuc   /// \deprecated
test_deprecated_8test_deprecated_650f4a2713aSLionel Sambuc   void test_deprecated_8() {
51f4a2713aSLionel Sambuc   }
52f4a2713aSLionel Sambuc };
53f4a2713aSLionel Sambuc 
54f4a2713aSLionel Sambuc #define MY_ATTR_DEPRECATED __attribute__((deprecated))
55f4a2713aSLionel Sambuc 
56f4a2713aSLionel Sambuc // 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}}
57f4a2713aSLionel Sambuc /// \deprecated
58f4a2713aSLionel Sambuc void test_deprecated_9(int a);
59f4a2713aSLionel Sambuc 
60f4a2713aSLionel Sambuc // rdar://12381408
61f4a2713aSLionel Sambuc // expected-warning@+2  {{unknown command tag name 'retur'; did you mean 'return'?}}
62f4a2713aSLionel Sambuc /// \brief testing fixit
63f4a2713aSLionel Sambuc /// \retur int in FooBar
64f4a2713aSLionel Sambuc int FooBar();
65f4a2713aSLionel Sambuc 
66f4a2713aSLionel Sambuc // expected-warning@+1  {{unknown command tag name 'fooba'; did you mean 'foobar'?}}
67f4a2713aSLionel Sambuc /// \fooba bbb IS_DOXYGEN_END
68f4a2713aSLionel Sambuc int gorf();
69f4a2713aSLionel Sambuc 
70f4a2713aSLionel Sambuc /// \t bbb IS_DOXYGEN_END
71f4a2713aSLionel Sambuc int Bar();
72f4a2713aSLionel Sambuc 
73*0a6a1f1dSLionel Sambuc // expected-warning@+2  {{unknown command tag name 'encode'; did you mean 'endcode'?}}
74*0a6a1f1dSLionel Sambuc // expected-warning@+1  {{'\endcode' command does not terminate a verbatim text block}}
75*0a6a1f1dSLionel Sambuc /// \encode PR18051
76*0a6a1f1dSLionel Sambuc int PR18051();
77*0a6a1f1dSLionel Sambuc 
78f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{5:12-5:22}:"a"
79f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{9:12-9:15}:"aaa"
80f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{13:13-13:23}:"T"
81f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{18:13-18:18}:"SomeTy"
82f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{25:25-25:25}:" __attribute__((deprecated))"
83f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{29:30-29:30}:" __attribute__((deprecated))"
84f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{34:27-34:27}:" __attribute__((deprecated))"
85f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{38:27-38:27}:" __attribute__((deprecated))"
86f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{46:27-46:27}:" __attribute__((deprecated))"
87f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{50:27-50:27}:" __attribute__((deprecated))"
88f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{58:30-58:30}:" MY_ATTR_DEPRECATED"
89f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{63:6-63:11}:"return"
90f4a2713aSLionel Sambuc // CHECK: fix-it:"{{.*}}":{67:6-67:11}:"foobar"
91*0a6a1f1dSLionel Sambuc // CHECK: fix-it:"{{.*}}":{75:6-75:12}:"endcode"
92