cb424d7448
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).
123 lines
3.4 KiB
C++
123 lines
3.4 KiB
C++
class X {
|
|
public:
|
|
int pub;
|
|
protected:
|
|
int prot;
|
|
private:
|
|
int priv;
|
|
};
|
|
|
|
class Unrelated {
|
|
public:
|
|
static int pub;
|
|
protected:
|
|
static int prot;
|
|
private:
|
|
static int priv;
|
|
};
|
|
|
|
class Y : public X {
|
|
int test() {
|
|
this->pub = 10;
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):11 %s -o - \
|
|
// RUN: | FileCheck -check-prefix=THIS %s
|
|
// THIS: priv (InBase,Inaccessible)
|
|
// THIS: prot (InBase)
|
|
// THIS: pub (InBase)
|
|
//
|
|
// Also check implicit 'this->', i.e. complete at the start of the line.
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-8):1 %s -o - \
|
|
// RUN: | FileCheck -check-prefix=THIS %s
|
|
|
|
X().pub + 10;
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):9 %s -o - \
|
|
// RUN: | FileCheck -check-prefix=X-OBJ %s
|
|
// X-OBJ: priv (Inaccessible)
|
|
// X-OBJ: prot (Inaccessible)
|
|
// X-OBJ: pub : [#int#]pub
|
|
|
|
Y().pub + 10;
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):9 %s -o - \
|
|
// RUN: | FileCheck -check-prefix=Y-OBJ %s
|
|
// Y-OBJ: priv (InBase,Inaccessible)
|
|
// Y-OBJ: prot (InBase)
|
|
// Y-OBJ: pub (InBase)
|
|
|
|
this->X::pub = 10;
|
|
X::pub = 10;
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-2):14 %s -o - \
|
|
// RUN: | FileCheck -check-prefix=THIS-BASE %s
|
|
//
|
|
// THIS-BASE: priv (Inaccessible)
|
|
// THIS-BASE: prot : [#int#]prot
|
|
// THIS-BASE: pub : [#int#]pub
|
|
//
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-8):8 %s -o - \
|
|
// RUN: | FileCheck -check-prefix=THIS-BASE %s
|
|
|
|
|
|
this->Unrelated::pub = 10; // a check we don't crash in this cases.
|
|
Y().Unrelated::pub = 10; // a check we don't crash in this cases.
|
|
Unrelated::pub = 10;
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-3):22 %s -o - \
|
|
// RUN: | FileCheck -check-prefix=UNRELATED %s
|
|
// UNRELATED: priv (Inaccessible)
|
|
// UNRELATED: prot (Inaccessible)
|
|
// UNRELATED: pub : [#int#]pub
|
|
//
|
|
// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-8):20 %s -o - \
|
|
// RUN: | FileCheck -check-prefix=UNRELATED %s
|
|
// RUN: not %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-9):16 %s -o - \
|
|
// RUN: | FileCheck -check-prefix=UNRELATED %s
|
|
}
|
|
};
|
|
|
|
class Outer {
|
|
public:
|
|
static int pub;
|
|
protected:
|
|
static int prot;
|
|
private:
|
|
static int priv;
|
|
|
|
class Inner {
|
|
int test() {
|
|
Outer::pub = 10;
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):14 %s -o - \
|
|
// RUN: | FileCheck -check-prefix=OUTER %s
|
|
// OUTER: priv : [#int#]priv
|
|
// OUTER: prot : [#int#]prot
|
|
// OUTER: pub : [#int#]pub
|
|
|
|
// Also check the unqualified case.
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-8):1 %s -o - \
|
|
// RUN: | FileCheck -check-prefix=OUTER %s
|
|
}
|
|
};
|
|
};
|
|
|
|
class Base {
|
|
public:
|
|
int pub;
|
|
};
|
|
|
|
class Accessible : public Base {
|
|
};
|
|
|
|
class Inaccessible : private Base {
|
|
};
|
|
|
|
class Test : public Accessible, public Inaccessible {
|
|
int test() {
|
|
this->Accessible::pub = 10;
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):23 %s -o - \
|
|
// RUN: | FileCheck -check-prefix=ACCESSIBLE %s
|
|
// ACCESSIBLE: pub (InBase)
|
|
|
|
this->Inaccessible::pub = 10;
|
|
// RUN: %clang_cc1 -fsyntax-only -code-completion-at=%s:%(line-1):25 %s -o - \
|
|
// RUN: | FileCheck -check-prefix=INACCESSIBLE %s
|
|
// INACCESSIBLE: pub (InBase,Inaccessible)
|
|
}
|
|
};
|