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