Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/CodeGenCXX/apple-kext-indirect-call.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

43 lines
1.4 KiB
C++

// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fapple-kext -emit-llvm -o - %s | FileCheck %s
// CHECK: @_ZTV5TemplIiE = internal unnamed_addr constant { [5 x ptr] } { [5 x ptr] [ptr null, ptr @_ZTI5TemplIiE, ptr @_ZN5TemplIiE1fEv, ptr @_ZN5TemplIiE1gEv, ptr null] }
struct Base {
virtual void abc(void) const;
};
void Base::abc(void) const {}
void FUNC(Base* p) {
p->Base::abc();
}
// CHECK: getelementptr inbounds (ptr, ptr @_ZTV4Base, i64 2)
// CHECK-NOT: call void @_ZNK4Base3abcEv
template<class T>
struct Templ {
virtual void f() {}
virtual void g() {}
};
template<class T>
struct SubTempl : public Templ<T> {
virtual void f() {} // override
virtual void g() {} // override
};
void f(SubTempl<int>* t) {
// Qualified calls go through the (qualified) vtable in apple-kext mode.
// Since t's this pointer points to SubTempl's vtable, the call needs
// to load Templ<int>'s vtable. Hence, Templ<int>::g needs to be
// instantiated in this TU, for it's referenced by the vtable.
// (This happens only in apple-kext mode; elsewhere virtual calls can always
// use the vtable pointer off this instead of having to load the vtable
// symbol.)
t->Templ::f();
}
// CHECK: getelementptr inbounds (ptr, ptr @_ZTV5TemplIiE, i64 2)
// CHECK: define internal void @_ZN5TemplIiE1fEv(ptr {{[^,]*}} %this)
// CHECK: define internal void @_ZN5TemplIiE1gEv(ptr {{[^,]*}} %this)