Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/InterfaceStubs/virtual.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

41 lines
1.4 KiB
C++

// REQUIRES: x86-registered-target
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs %s | \
// RUN: FileCheck -check-prefix=CHECK-TAPI %s
// RUN: %clang_cc1 -triple x86_64-unknown-linux-gnu -o - -emit-interface-stubs %s | \
// RUN: FileCheck -check-prefix=CHECK-TAPI2 %s
// RUN: %clang -target x86_64-unknown-linux-gnu -o - -c %s | \
// RUN: llvm-readelf -s - 2>&1 | FileCheck -check-prefix=CHECK-SYMBOLS %s
#define HIDDEN __attribute__((__visibility__(("hidden"))))
#define DEFAULT __attribute__((__visibility__(("default"))))
// CHECK-TAPI-NOT: _ZNK1Q5func1Ev
// CHECK-TAPI-NOT: _ZNK1Q5func2Ev
// CHECK-SYMBOLS-DAG: NOTYPE GLOBAL HIDDEN {{.*}} _ZNK1Q5func1Ev
// CHECK-SYMBOLS-DAG: NOTYPE GLOBAL DEFAULT {{.*}} _ZNK1Q5func2Ev
struct Q {
virtual HIDDEN int func1() const;
virtual DEFAULT int func2() const;
} q;
// CHECK-TAPI-NOT: _ZNK1S5func1Ev
// CHECK-TAPI2-DAG: _ZNK1S5func2Ev
// CHECK-SYMBOLS-DAG: FUNC WEAK HIDDEN {{.*}} _ZNK1S5func1Ev
// CHECK-SYMBOLS-DAG: FUNC WEAK DEFAULT {{.*}} _ZNK1S5func2Ev
struct S {
virtual HIDDEN int func1() const { return 42; }
virtual DEFAULT int func2() const { return 42; }
} s;
// CHECK-TAPI-NOT: _ZNK1R5func1Ev
// CHECK-TAPI-NOT: _ZNK1R5func2Ev
// CHECK-SYMBOLS-NOT: _ZNK1R5func1Ev
// CHECK-SYMBOLS-NOT: _ZNK1R5func2Ev
struct R {
virtual HIDDEN int func1() const = 0;
virtual DEFAULT int func2() const = 0;
};
int a = q.func1() + q.func2();