Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/AST/ast-dump-sme-attributes.cpp
T
vasilito cb424d7448 build: static patch-sanity linter (shift-left the malformed-patch class)
verify-patch-sanity.py validates every active recipe .patch has internally-
consistent hunk line counts — catching the 'malformed patch at line N' failure
at commit/CI/preflight time instead of hours into a cook. This cycle hit that
class three times (qtwaylandscanner, sddm, xwayland), each only discovered when
cookbook tried to apply the patch.

Running it across the repo found 29 latent malformed patches (validated against
GNU patch: e.g. relibc/P3-sysv-ipc reproduces 'malformed patch at line 22').
They were harmless only because they sit in vendored recipes (baked, not re-
applied) — but would fail on any version-bump re-derivation. --fix recounts the
hunk headers (body untouched) and repaired all 29.

Wired into build-preflight.sh (Phase 1.0D) and redbear-ci.yml, with a unit test
(test-patch-sanity.sh). Skips archived/legacy trees and unvalidatable formats
(empty placeholders, bare-@@ git hunks).
2026-08-01 05:13:02 +03:00

67 lines
3.9 KiB
C++

// Test without serialization:
// RUN: %clang_cc1 -triple aarch64 -target-feature +sme -std=c++2a -ast-dump -ast-dump-filter Foo %s | FileCheck -strict-whitespace %s
// Test with serialization:
// RUN: %clang_cc1 -std=c++20 -triple aarch64 -target-feature +sme -emit-pch -o %t %s
// 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 \
// RUN: | sed -e "s/ <undeserialized declarations>//" -e "s/ imported//" \
// RUN: | FileCheck --strict-whitespace %s
struct Foo {
// CHECK: |-CXXRecordDecl {{.*}} implicit struct Foo
// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_streaming 'void () __arm_streaming'
// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_streaming_compatible 'void () __arm_streaming_compatible'
// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_locally_streaming 'void ()'
// CHECK-NEXT: | `-ArmLocallyStreamingAttr
// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_shared_za 'void () __arm_inout("za")'
// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_new_za 'void ()'
// CHECK-NEXT: | `-ArmNewAttr {{.*}} za
// CHECK-NEXT: |-CXXMethodDecl {{.*}} f_preserves_za 'void () __arm_preserves("za")'
void f_streaming() __arm_streaming;
void f_streaming_compatible() __arm_streaming_compatible;
__arm_locally_streaming void f_locally_streaming();
void f_shared_za() __arm_inout("za");
__arm_new("za") void f_new_za();
void f_preserves_za() __arm_preserves("za");
// CHECK: |-CXXMethodDecl {{.*}} test_lambda 'int (int)' implicit-inline
// CHECK: `-CompoundStmt
// CHECK-NEXT: |-DeclStmt
// CHECK-NEXT: | `-VarDecl
// CHECK-NEXT: | `-LambdaExpr
// CHECK-NEXT: | |-CXXRecordDecl
// CHECK: | | |-CXXMethodDecl {{.*}} used constexpr operator() 'int (int) __arm_streaming const' inline
// CHECK: | | |-CXXConversionDecl {{.*}} implicit constexpr operator int (*)(int) __arm_streaming 'int (*() const noexcept)(int) __arm_streaming' inline
// CHECK: | | |-CXXMethodDecl {{.*}} implicit __invoke 'int (int) __arm_streaming' static inline
// CHECK: `-ReturnStmt
// CHECK: `-CXXOperatorCallExpr
// CHECK-NEXT: |-ImplicitCastExpr {{.*}} 'int (*)(int) __arm_streaming const' <FunctionToPointerDecay>
// CHECK-NEXT: | `-DeclRefExpr {{.*}} 'int (int) __arm_streaming const' lvalue CXXMethod {{.*}} 'operator()' 'int (int) __arm_streaming const'
int test_lambda(int x) {
auto F = [](int x) __arm_streaming { return x; };
return F(x);
}
// CHECK: |-TypedefDecl {{.*}} referenced s_ptrty 'void (*)(int, int) __arm_streaming'
// CHECK-NEXT: | `-PointerType {{.*}} 'void (*)(int, int) __arm_streaming'
// CHECK-NEXT: | `-ParenType {{.*}} 'void (int, int) __arm_streaming' sugar
// CHECK-NEXT: | `-FunctionProtoType {{.*}} 'void (int, int) __arm_streaming' cdecl
typedef void (*s_ptrty) (int, int) __arm_streaming;
// CHECK: `-CXXMethodDecl {{.*}} test_streaming_ptrty 'void (s_ptrty, int, int)' implicit-inline
// CHECK-NEXT: |-ParmVarDecl {{.*}} used f 's_ptrty':'void (*)(int, int) __arm_streaming'
// CHECK-NEXT: |-ParmVarDecl {{.*}} used x 'int'
// CHECK-NEXT: |-ParmVarDecl {{.*}} used y 'int'
// CHECK: `-CompoundStmt
// CHECK-NEXT: `-ReturnStmt
// CHECK-NEXT: `-CallExpr
// CHECK-NEXT: |-ImplicitCastExpr {{.*}} 's_ptrty':'void (*)(int, int) __arm_streaming' <LValueToRValue>
// CHECK-NEXT: | `-DeclRefExpr {{.*}} 's_ptrty':'void (*)(int, int) __arm_streaming' lvalue ParmVar {{.*}} 'f' 's_ptrty':'void (*)(int, int) __arm_streaming'
// CHECK-NEXT: |-ImplicitCastExpr {{.*}} 'int' <LValueToRValue>
// CHECK-NEXT: | `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'x' 'int'
// CHECK-NEXT: `-ImplicitCastExpr {{.*}} 'int' <LValueToRValue>
// CHECK-NEXT: `-DeclRefExpr {{.*}} 'int' lvalue ParmVar {{.*}} 'y' 'int'
void test_streaming_ptrty(s_ptrty f, int x, int y) { return f(x, y); };
};