[docs] Add LICENSE.txt to the root of the mono-repo
[llvm-project.git] / clang / test / AST / ast-dump-wasm-attr-export.c
blobd01c4816d65b057f3822c6226628bab30afd06a2
1 // Test without serialization:
2 // RUN: %clang_cc1 -triple wasm32-unknown-unknown -ast-dump %s \
3 // RUN: | FileCheck --strict-whitespace %s
4 //
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__((export_name("export_red"))) void red(void) {}
14 __attribute__((export_name("export_orange"))) void orange(void) {}
15 __attribute__((export_name("export_yellow"))) void yellow(void) {}
17 void red(void);
18 void orange(void);
19 void yellow(void);
21 // CHECK: |-FunctionDecl {{.+}} used red 'void (void)'
22 // CHECK: | |-CompoundStmt {{.+}}
23 // CHECK: | |-WebAssemblyExportNameAttr {{.+}} "export_red"
24 // CHECK: | `-UsedAttr {{.+}} Implicit
25 // CHECK: |-FunctionDecl {{.+}} used orange 'void (void)'
26 // CHECK: | |-CompoundStmt {{.+}}
27 // CHECK: | |-WebAssemblyExportNameAttr {{.+}} "export_orange"
28 // CHECK: | `-UsedAttr {{.+}} Implicit
29 // CHECK: |-FunctionDecl {{.+}} used yellow 'void (void)'
30 // CHECK: | |-CompoundStmt {{.+}}
31 // CHECK: | |-WebAssemblyExportNameAttr {{.+}} "export_yellow"
32 // CHECK: | `-UsedAttr {{.+}} Implicit
33 // CHECK: |-FunctionDecl {{.+}} used red 'void (void)'
34 // CHECK: | |-UsedAttr {{.+}} Inherited Implicit
35 // CHECK: | `-WebAssemblyExportNameAttr {{.+}} Inherited "export_red"
36 // CHECK: |-FunctionDecl {{.+}} used orange 'void (void)'
37 // CHECK: | |-UsedAttr {{.+}} Inherited Implicit
38 // CHECK: | `-WebAssemblyExportNameAttr {{.+}} Inherited "export_orange"
39 // CHECK: `-FunctionDecl {{.+}} used yellow 'void (void)'
40 // CHECK: |-UsedAttr {{.+}} Inherited Implicit
41 // CHECK: `-WebAssemblyExportNameAttr {{.+}} Inherited "export_yellow"