brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.0 KiB · 122707e Raw
45 lines · c
1// Test without serialization:2// RUN: %clang_cc1 -triple wasm32-unknown-unknown -ast-dump %s \3// RUN: | FileCheck --strict-whitespace %s4 5// Test with serialization:6// RUN: %clang_cc1 -triple wasm32-unknown-unknown -emit-pch -o %t %s7// 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 %s10//11// Test that functions can be redeclared and they retain their attributes.12 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);16 17void red(void);18void orange(void);19void yellow(void);20 21void calls(void) {22    red();23    orange();24    yellow();25}26 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"45