Files
RedBear-OS/local/recipes/dev/libclc/source/clang/test/CodeGenObjC/dot-syntax-1.m
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

265 lines
3.8 KiB
Objective-C

// RUN: %clang_cc1 -emit-llvm -o %t %s
int printf(const char *, ...);
@interface Root
-(id) alloc;
-(id) init;
@end
// Property above methods...
@interface Top0 : Root
@property(getter=_getX,setter=_setX:) int x;
@end
@interface Bot0 : Top0
-(int) x;
-(void) setX: (int) arg;
@end
@implementation Top0
-(int) _getX {
printf("-[ Top0 _getX ]\n");
return 0;
}
-(void) _setX: (int) arg {
printf("-[ Top0 _setX: %d ]\n", arg);
}
@end
@implementation Bot0
-(int) x {
printf("-[ Bot0 _getX ]\n");
return 0;
}
-(void) setX: (int) arg {
printf("-[ Bot0 _setX: %d ]\n", arg);
}
@end
// Methods above property...
@interface Top1 : Root
-(int) x;
-(void) setX: (int) arg;
@end
@interface Bot1 : Top1
@property(getter=_getX,setter=_setX:) int x;
@end
@implementation Top1
-(int) x {
printf("-[ Top1 x ]\n");
return 0;
}
-(void) setX: (int) arg {
printf("-[ Top1 setX: %d ]\n", arg);
}
@end
@implementation Bot1
-(int) _getX {
printf("-[ Bot1 _getX ]\n");
return 0;
}
-(void) _setX: (int) arg {
printf("-[ Bot1 _setX: %d ]\n", arg);
}
@end
// Mixed setter & getter (variant 1)
@interface Top2 : Root
-(int) x;
-(void) _setX: (int) arg;
@end
@interface Bot2 : Top2
@property(getter=_getX,setter=_setX:) int x;
@end
@implementation Top2
-(int) x {
printf("-[ Top2 x ]\n");
return 0;
}
-(void) _setX: (int) arg {
printf("-[ Top2 _setX: %d ]\n", arg);
}
@end
@implementation Bot2
-(int) _getX {
printf("-[ Bot2 _getX ]\n");
return 0;
}
-(void) setX: (int) arg {
printf("-[ Bot2 setX: %d ]\n", arg);
}
@end
// Mixed setter & getter (variant 2)
@interface Top3 : Root
-(int) _getX;
-(void) setX: (int) arg;
@end
@interface Bot3 : Top3
@property(getter=_getX,setter=_setX:) int x;
@end
@implementation Top3
-(int) _getX {
printf("-[ Top3 _getX ]\n");
return 0;
}
-(void) setX: (int) arg {
printf("-[ Top3 setX: %d ]\n", arg);
}
@end
@implementation Bot3
-(int) x {
printf("-[ Bot3 x ]\n");
return 0;
}
-(void) _setX: (int) arg {
printf("-[ Bot3 _setX: %d ]\n", arg);
}
@end
// Mixed setter & getter (variant 3)
@interface Top4 : Root
@property(getter=_getX,setter=_setX:) int x;
@end
@interface Bot4 : Top4
-(int) _getX;
-(void) setX: (int) arg;
@end
@implementation Top4
-(int) x {
printf("-[ Top4 x ]\n");
return 0;
}
-(void) _setX: (int) arg {
printf("-[ Top4 _setX: %d ]\n", arg);
}
@end
@implementation Bot4
-(int) _getX {
printf("-[ Bot4 _getX ]\n");
return 0;
}
-(void) setX: (int) arg {
printf("-[ Bot4 setX: %d ]\n", arg);
}
@end
// Mixed setter & getter (variant 4)
@interface Top5 : Root
@property(getter=_getX,setter=_setX:) int x;
@end
@interface Bot5 : Top5
-(int) x;
-(void) _setX: (int) arg;
@end
@implementation Top5
-(int) _getX {
printf("-[ Top5 _getX ]\n");
return 0;
}
-(void) setX: (int) arg {
printf("-[ Top5 setX: %d ]\n", arg);
}
@end
@implementation Bot5
-(int) x {
printf("-[ Bot5 x ]\n");
return 0;
}
-(void) _setX: (int) arg {
printf("-[ Bot5 _setX: %d ]\n", arg);
}
@end
// Mixed level calls (variant 1)
@interface Top6 : Root
-(int) x;
@end
@interface Bot6 : Top6
-(void) setX: (int) arg;
@end
@implementation Top6
-(int) x {
printf("-[ Top6 x ]\n");
return 0;
}
@end
@implementation Bot6
-(void) setX: (int) arg {
printf("-[ Bot5 setX: %d ]\n", arg);
}
@end
// Mixed level calls (variant 1)
@interface Top7 : Root
-(void) setX: (int) arg;
@end
@interface Bot7 : Top7
-(int) x;
@end
@implementation Top7
-(void) setX: (int) arg {
printf("-[ Top7 setX: %d ]\n", arg);
}
@end
@implementation Bot7
-(int) x {
printf("-[ Bot7 x ]\n");
return 0;
}
@end
//
// FIXME: Two more (thats it?) interesting cases. Method access on
// getter w/o setter and method access on setter w/o getter.
int main(void) {
#define test(N) { \
Bot##N *ob = [[Bot##N alloc] init]; \
int x = ob.x; \
ob.x = 10; }
test(0);
test(1);
test(2);
test(3);
test(4);
test(5);
// test(6);
// test(7);
return 0;
}