summaryrefslogtreecommitdiffstats
path: root/clang/test/Index/index-attrs.cpp
diff options
context:
space:
mode:
authorSaleem Abdulrasool <compnerd@compnerd.org>2015-12-10 18:45:18 +0000
committerSaleem Abdulrasool <compnerd@compnerd.org>2015-12-10 18:45:18 +0000
commit8aa0b80ec71e839c236f83e8943cf87264d97fb1 (patch)
treeeb3975f13b26994c1db8df28ac125fd3c3fdd489 /clang/test/Index/index-attrs.cpp
parenta8547d35e95a73a66ad718d9f76034b2c878e6ca (diff)
downloadbcm5719-llvm-8aa0b80ec71e839c236f83e8943cf87264d97fb1.tar.gz
bcm5719-llvm-8aa0b80ec71e839c236f83e8943cf87264d97fb1.zip
libclang: expose dllexport, dllimport attributes
These attributes were previously unexposed. Expose them through the libclang interfaces. Add tests that cover both the MSVC spelling and the GNU spelling. llvm-svn: 255273
Diffstat (limited to 'clang/test/Index/index-attrs.cpp')
-rw-r--r--clang/test/Index/index-attrs.cpp50
1 files changed, 50 insertions, 0 deletions
diff --git a/clang/test/Index/index-attrs.cpp b/clang/test/Index/index-attrs.cpp
new file mode 100644
index 00000000000..b6100acf880
--- /dev/null
+++ b/clang/test/Index/index-attrs.cpp
@@ -0,0 +1,50 @@
+// RUN: c-index-test -index-file -check-prefix CHECK %s -target armv7-windows-gnu -fdeclspec
+
+struct __declspec(dllexport) export_s {
+ void m();
+};
+// CHECK: [indexDeclaration]: kind: struct | name: export_s | {{.*}} | lang: C++
+// CHECK: <attribute>: attribute(dllexport)
+// CHECK: [indexDeclaration]: kind: c++-instance-method | name: m | {{.*}} | lang: C++
+// CHECK: <attribute>: attribute(dllexport)
+
+struct __declspec(dllimport) import_s {
+ void m();
+};
+// CHECK: [indexDeclaration]: kind: struct | name: import_s | {{.*}} | lang: C++
+// CHECK: <attribute>: attribute(dllimport)
+// CHECK: [indexDeclaration]: kind: c++-instance-method | name: m | {{.*}} | lang: C++
+// CHECK: <attribute>: attribute(dllimport)
+
+class __attribute__((dllexport)) export_gnu_s {
+ void m();
+};
+// CHECK: [indexDeclaration]: kind: struct | name: export_gnu_s | {{.*}} | lang: C++
+// CHECK: <attribute>: attribute(dllexport)
+// CHECK: [indexDeclaration]: kind: c++-instance-method | name: m | {{.*}} | lang: C++
+// CHECK: <attribute>: attribute(dllexport)
+
+class __attribute__((dllimport)) import_gnu_s {
+ void m();
+};
+// CHECK: [indexDeclaration]: kind: struct | name: import_gnu_s | {{.*}} | lang: C++
+// CHECK: <attribute>: attribute(dllimport)
+// CHECK: [indexDeclaration]: kind: c++-instance-method | name: m | {{.*}} | lang: C++
+// CHECK: <attribute>: attribute(dllimport)
+
+extern "C" void __declspec(dllexport) export_function(void) {}
+// CHECK: [indexDeclaraton]: kind: function | name: export_function | {{.*}} | lang: C
+// CHECK: <attribute>: attribute(dllexport)
+extern "C" void __attribute__((dllexport)) export_gnu_function(void) {}
+// CHECK: [indexDeclaraton]: kind: function | name: export_gnu_function | {{.*}} | lang: C
+// CHECK: <attribute>: attribute(dllexport)
+
+extern "C" {
+void __declspec(dllimport) import_function(void);
+// CHECK: [indexDeclaration] kind: function | name: import_function | {{.*}} | lang: C
+// CHECK: <attribute>: attribute(dllimport)
+void __attribute__((dllimport)) import_gnu_function(void);
+// CHECK: [indexDeclaration] kind: function | name: import_gnu_function | {{.*}} | lang: C
+// CHECK: <attribute>: attribute(dllimport)
+}
+
OpenPOWER on IntegriCloud