[clang] Handle __declspec() attributes in using
[llvm-project.git] / clang / test / AST / ast-dump-wasm-attr-import.c
blob122707e851b76cd73b117cc1938774d193e8da20
1 // Test without serialization:
2 // RUN: %clang_cc1 -triple wasm32-unknown-unknown -ast-dump %s \
3 // RUN: | FileCheck --strict-whitespace %s
5 // Test with serialization:
6 // RUN: %clang_cc1 -triple wasm32-unknown-unknown -emit-pch -o %t %s
7 // RUN: %clang_cc1 -triple wasm32-unknown-unknown -x c -include-pch %t -ast-dump-all /dev/null \
8 // RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
9 // RUN: | FileCheck --strict-whitespace %s
11 // Test that functions can be redeclared and they retain their attributes.
13 __attribute__((import_name("import_red"), import_module("mod"))) void red(void);
14 __attribute__((import_name("import_orange"), import_module("mod"))) void orange(void);
15 __attribute__((import_name("import_yellow"), import_module("mod"))) void yellow(void);
17 void red(void);
18 void orange(void);
19 void yellow(void);
21 void calls(void) {
22 red();
23 orange();
24 yellow();
27 // CHECK: |-FunctionDecl {{.+}} used red 'void (void)'
28 // CHECK: | |-WebAssemblyImportNameAttr {{.+}} "import_red"
29 // CHECK: | `-WebAssemblyImportModuleAttr {{.+}} "mod"
30 // CHECK: |-FunctionDecl {{.+}} used orange 'void (void)'
31 // CHECK: | |-WebAssemblyImportNameAttr {{.+}} "import_orange"
32 // CHECK: | `-WebAssemblyImportModuleAttr {{.+}} "mod"
33 // CHECK: |-FunctionDecl {{.+}} used yellow 'void (void)'
34 // CHECK: | |-WebAssemblyImportNameAttr {{.+}} "import_yellow"
35 // CHECK: | `-WebAssemblyImportModuleAttr {{.+}} "mod"
36 // CHECK: |-FunctionDecl {{.+}} used red 'void (void)'
37 // CHECK: | |-WebAssemblyImportNameAttr {{.+}} Inherited "import_red"
38 // CHECK: | `-WebAssemblyImportModuleAttr {{.+}} Inherited "mod"
39 // CHECK: |-FunctionDecl {{.+}} used orange 'void (void)'
40 // CHECK: | |-WebAssemblyImportNameAttr {{.+}} Inherited "import_orange"
41 // CHECK: | `-WebAssemblyImportModuleAttr {{.+}} Inherited "mod"
42 // CHECK: |-FunctionDecl {{.+}} used yellow 'void (void)'
43 // CHECK: | |-WebAssemblyImportNameAttr {{.+}} Inherited "import_yellow"
44 // CHECK: | `-WebAssemblyImportModuleAttr {{.+}} Inherited "mod"