• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 %s -verify -fsyntax-only
2 
3 // expected-no-diagnostics
4 
5 class C_in_class {
6 #include "../Sema/attr-callback.c"
7 };
8 
9 struct Base {
10 
11   void no_args_1(void (*callback)(void));
12   __attribute__((callback(1))) void no_args_2(void (*callback)(void));
no_args_3Base13   __attribute__((callback(callback))) void no_args_3(void (*callback)(void)) {}
14 
15   __attribute__((callback(1, 0))) virtual void
16   this_tr(void (*callback)(Base *));
17 
18   __attribute__((callback(1, this, __, this))) virtual void
19   this_unknown_this(void (*callback)(Base *, Base *, Base *));
20 
21   __attribute__((callback(1))) virtual void
22   virtual_1(void (*callback)(void));
23 
24   __attribute__((callback(callback))) virtual void
25   virtual_2(void (*callback)(void));
26 
27   __attribute__((callback(1))) virtual void
28   virtual_3(void (*callback)(void));
29 };
30 
31 __attribute__((callback(1))) void
no_args_1(void (* callback)(void))32 Base::no_args_1(void (*callback)(void)) {
33 }
34 
no_args_2(void (* callback)(void))35 void Base::no_args_2(void (*callback)(void)) {
36 }
37 
38 struct Derived_1 : public Base {
39 
40   __attribute__((callback(1, 0))) virtual void
41   this_tr(void (*callback)(Base *)) override;
42 
43   __attribute__((callback(1))) virtual void
virtual_1Derived_144   virtual_1(void (*callback)(void)) override {}
45 
46   virtual void
virtual_3Derived_147   virtual_3(void (*callback)(void)) override {}
48 };
49 
50 struct Derived_2 : public Base {
51 
52   __attribute__((callback(callback))) virtual void
53   virtual_1(void (*callback)(void)) override;
54 
55   virtual void
56   virtual_2(void (*callback)(void)) override;
57 
58   virtual void
59   virtual_3(void (*callback)(void)) override;
60 };
61 
virtual_1(void (* callback)(void))62 void Derived_2::virtual_1(void (*callback)(void)) {}
63 
64 __attribute__((callback(1))) void
virtual_2(void (* callback)(void))65 Derived_2::virtual_2(void (*callback)(void)) {}
66 
virtual_3(void (* callback)(void))67 void Derived_2::virtual_3(void (*callback)(void)) {}
68