67 lines · cpp
1// Test without serialization:2// RUN: %clang_cc1 -triple aarch64 -target-feature +sme -std=c++2a -ast-dump -ast-dump-filter Foo %s | FileCheck -strict-whitespace %s3 4// Test with serialization:5// RUN: %clang_cc1 -std=c++20 -triple aarch64 -target-feature +sme -emit-pch -o %t %s6// RUN: %clang_cc1 -x c++ -std=c++20 -triple aarch64 -target-feature +sme -include-pch %t -ast-dump-all -ast-dump-filter Foo /dev/null \7// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \8// RUN: | FileCheck --strict-whitespace %s9 10struct Foo {11// CHECK: |-CXXRecordDecl {{.*}} implicit struct Foo12// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_streaming 'void () __arm_streaming'13// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_streaming_compatible 'void () __arm_streaming_compatible'14// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_locally_streaming 'void ()'15// CHECK-NEXT: | `-ArmLocallyStreamingAttr16// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_shared_za 'void () __arm_inout("za")'17// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_new_za 'void ()'18// CHECK-NEXT: | `-ArmNewAttr {{.*}} za19// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_preserves_za 'void () __arm_preserves("za")'20 void f_streaming() __arm_streaming;21 void f_streaming_compatible() __arm_streaming_compatible;22 __arm_locally_streaming void f_locally_streaming();23 void f_shared_za() __arm_inout("za");24 __arm_new("za") void f_new_za();25 void f_preserves_za() __arm_preserves("za");26 27 28// CHECK: |-CXXMethodDecl {{.*}} test_lambda 'int (int)' implicit-inline29// CHECK: `-CompoundStmt30// CHECK-NEXT: |-DeclStmt31// CHECK-NEXT: | `-VarDecl32// CHECK-NEXT: | `-LambdaExpr33// CHECK-NEXT: | |-CXXRecordDecl34// CHECK: | | |-CXXMethodDecl {{.*}} used constexpr operator() 'int (int) __arm_streaming const' inline35// CHECK: | | |-CXXConversionDecl {{.*}} implicit constexpr operator int (*)(int) __arm_streaming 'int (*() const noexcept)(int) __arm_streaming' inline36// CHECK: | | |-CXXMethodDecl {{.*}} implicit __invoke 'int (int) __arm_streaming' static inline37// CHECK: `-ReturnStmt38// CHECK: `-CXXOperatorCallExpr39// CHECK-NEXT: |-ImplicitCastExpr {{.*}} 'int (*)(int) __arm_streaming const' <FunctionToPointerDecay>40// CHECK-NEXT: | `-DeclRefExpr {{.*}} 'int (int) __arm_streaming const' lvalue CXXMethod {{.*}} 'operator()' 'int (int) __arm_streaming const'41 int test_lambda(int x) {42 auto F = [](int x) __arm_streaming { return x; };43 return F(x);44 }45 46// CHECK: |-TypedefDecl {{.*}} referenced s_ptrty 'void (*)(int, int) __arm_streaming'47// CHECK-NEXT: | `-PointerType {{.*}} 'void (*)(int, int) __arm_streaming'48// CHECK-NEXT: | `-ParenType {{.*}} 'void (int, int) __arm_streaming' sugar49// CHECK-NEXT: | `-FunctionProtoType {{.*}} 'void (int, int) __arm_streaming' cdecl50 typedef void (*s_ptrty) (int, int) __arm_streaming;51 52// CHECK: `-CXXMethodDecl {{.*}} test_streaming_ptrty 'void (s_ptrty, int, int)' implicit-inline53// CHECK-NEXT: |-ParmVarDecl {{.*}} used f 's_ptrty':'void (*)(int, int) __arm_streaming'54// CHECK-NEXT: |-ParmVarDecl {{.*}} used x 'int'55// CHECK-NEXT: |-ParmVarDecl {{.*}} used y 'int'56// CHECK: `-CompoundStmt57// CHECK-NEXT: `-ReturnStmt58// CHECK-NEXT: `-CallExpr59// CHECK-NEXT: |-ImplicitCastExpr {{.*}} 's_ptrty':'void (*)(int, int) __arm_streaming' <LValueToRValue>60// CHECK-NEXT: | `-DeclRefExpr {{.*}} 's_ptrty':'void (*)(int, int) __arm_streaming' lvalue ParmVar {{.*}} 'f' 's_ptrty':'void (*)(int, int) __arm_streaming'61// CHECK-NEXT: |-ImplicitCastExpr {{.*}} 'int' <LValueToRValue>62// CHECK-NEXT: | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'x' 'int'63// CHECK-NEXT: `-ImplicitCastExpr {{.*}} 'int' <LValueToRValue>64// CHECK-NEXT: `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'y' 'int'65 void test_streaming_ptrty(s_ptrty f, int x, int y) { return f(x, y); };66};67