Clang Project

clang_source_code/test/Index/index-attrs.cpp
1// RUN: c-index-test -index-file %s -target armv7-windows-gnu -fdeclspec | FileCheck %s
2
3struct __declspec(dllexport) export_s {
4  void m();
5};
6// CHECK: [indexDeclaration]: kind: struct | name: export_s | {{.*}} | lang: C++
7// CHECK: <attribute>: attribute(dllexport)
8// CHECK: [indexDeclaration]: kind: c++-instance-method | name: m | {{.*}} | lang: C++
9// CHECK: <attribute>: attribute(dllexport)
10
11struct __declspec(dllimport) import_s {
12  void m();
13};
14// CHECK: [indexDeclaration]: kind: struct | name: import_s | {{.*}} | lang: C++
15// CHECK: <attribute>: attribute(dllimport)
16// CHECK: [indexDeclaration]: kind: c++-instance-method | name: m | {{.*}} | lang: C++
17// CHECK: <attribute>: attribute(dllimport)
18
19class __attribute__((dllexport)) export_gnu_s {
20  void m();
21};
22// CHECK: [indexDeclaration]: kind: c++-class | name: export_gnu_s | {{.*}} | lang: C++
23// CHECK: <attribute>: attribute(dllexport)
24// CHECK: [indexDeclaration]: kind: c++-instance-method | name: m | {{.*}} | lang: C++
25// CHECK: <attribute>: attribute(dllexport)
26
27class __attribute__((dllimport)) import_gnu_s {
28  void m();
29};
30// CHECK: [indexDeclaration]: kind: c++-class | name: import_gnu_s | {{.*}} | lang: C++
31// CHECK: <attribute>: attribute(dllimport)
32// CHECK: [indexDeclaration]: kind: c++-instance-method | name: m | {{.*}} | lang: C++
33// CHECK: <attribute>: attribute(dllimport)
34
35extern "C" void __declspec(dllexport) export_function(void) {}
36// CHECK: [indexDeclaration]: kind: function | name: export_function | {{.*}} | lang: C
37// CHECK: <attribute>: attribute(dllexport)
38extern "C" void __attribute__((dllexport)) export_gnu_function(void) {}
39// CHECK: [indexDeclaration]: kind: function | name: export_gnu_function | {{.*}} | lang: C
40// CHECK: <attribute>: attribute(dllexport)
41
42extern "C" {
43void __declspec(dllimport) import_function(void);
44// CHECK: [indexDeclaration]: kind: function | name: import_function | {{.*}} | lang: C
45// CHECK: <attribute>: attribute(dllimport)
46void __attribute__((dllimport)) import_gnu_function(void);
47// CHECK: [indexDeclaration]: kind: function | name: import_gnu_function | {{.*}} | lang: C
48// CHECK: <attribute>: attribute(dllimport)
49}
50
51