42 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__((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) {}16 17void red(void);18void orange(void);19void yellow(void);20 21// CHECK: |-FunctionDecl {{.+}} used red 'void (void)'22// CHECK: | |-CompoundStmt {{.+}}23// CHECK: | |-WebAssemblyExportNameAttr {{.+}} "export_red"24// CHECK: | `-UsedAttr {{.+}} Implicit25// CHECK: |-FunctionDecl {{.+}} used orange 'void (void)'26// CHECK: | |-CompoundStmt {{.+}}27// CHECK: | |-WebAssemblyExportNameAttr {{.+}} "export_orange"28// CHECK: | `-UsedAttr {{.+}} Implicit29// CHECK: |-FunctionDecl {{.+}} used yellow 'void (void)'30// CHECK: | |-CompoundStmt {{.+}}31// CHECK: | |-WebAssemblyExportNameAttr {{.+}} "export_yellow"32// CHECK: | `-UsedAttr {{.+}} Implicit33// CHECK: |-FunctionDecl {{.+}} used red 'void (void)'34// CHECK: | |-UsedAttr {{.+}} Inherited Implicit35// CHECK: | `-WebAssemblyExportNameAttr {{.+}} Inherited "export_red"36// CHECK: |-FunctionDecl {{.+}} used orange 'void (void)'37// CHECK: | |-UsedAttr {{.+}} Inherited Implicit38// CHECK: | `-WebAssemblyExportNameAttr {{.+}} Inherited "export_orange"39// CHECK: `-FunctionDecl {{.+}} used yellow 'void (void)'40// CHECK: |-UsedAttr {{.+}} Inherited Implicit41// CHECK: `-WebAssemblyExportNameAttr {{.+}} Inherited "export_yellow"42