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

73 lines
2.1 KiB
Objective-C

// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
// CHECK: @"_OBJC_$_PROTOCOL_METHOD_TYPES_P1" = internal global
// CHECK: @[[PROTO_P1:"_OBJC_PROTOCOL_\$_P1"]] = weak hidden
// CHECK: @[[LABEL_PROTO_P1:"_OBJC_LABEL_PROTOCOL_\$_P1"]] = weak hidden global ptr @[[PROTO_P1]]
// CHECK: @[[PROTO_P2:"_OBJC_PROTOCOL_\$_P2"]] = weak hidden
// CHECK: @[[LABEL_PROTO_P2:"_OBJC_LABEL_PROTOCOL_\$_P2"]] = weak hidden global ptr @[[PROTO_P2]]
// CHECK: @"_OBJC_$_PROTOCOL_REFS_P3" = internal global { i64, [3 x ptr] } { i64 2, [3 x ptr] [ptr @[[PROTO_P1]], ptr @[[PROTO_P2]], ptr null] }
// CHECK: @[[PROTO_P3:"_OBJC_PROTOCOL_\$_P3"]] = weak hidden
// CHECK: @[[LABEL_PROTO_P3:"_OBJC_LABEL_PROTOCOL_\$_P3"]] = weak hidden global ptr @[[PROTO_P3]]
// CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P3" = weak hidden global ptr @[[PROTO_P3]]
// CHECK: @[[PROTO_P0:"_OBJC_PROTOCOL_\$_P0"]] = weak hidden
// CHECK: @[[LABEL_PROTO_P0:"_OBJC_LABEL_PROTOCOL_\$_P0"]] = weak hidden global ptr @[[PROTO_P0]]
// CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P0" = weak hidden global ptr @[[PROTO_P0]]
// CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P1" = weak hidden global ptr @[[PROTO_P1]]
// CHECK: "_OBJC_PROTOCOL_REFERENCE_$_P2" = weak hidden global ptr @[[PROTO_P2]]
void p(const char*, ...);
@interface Root
+(int) maxValue;
-(int) conformsTo: (id) x;
@end
@protocol P0
@end
@protocol P1
+(void) classMethodReq0;
-(void) methodReq0;
@optional
+(void) classMethodOpt1;
-(void) methodOpt1;
@required
+(void) classMethodReq2;
-(void) methodReq2;
@end
@protocol P2
//@property(readwrite) int x;
@end
@protocol P3<P1, P2>
-(id <P1>) print0;
-(void) print1;
@end
void foo(const id a) {
void *p = @protocol(P3);
}
int main(void) {
Protocol *P0 = @protocol(P0);
Protocol *P1 = @protocol(P1);
Protocol *P2 = @protocol(P2);
Protocol *P3 = @protocol(P3);
#define Pbool(X) p(#X ": %s\n", X ? "yes" : "no");
Pbool([P0 conformsTo: P1]);
Pbool([P1 conformsTo: P0]);
Pbool([P1 conformsTo: P2]);
Pbool([P2 conformsTo: P1]);
Pbool([P3 conformsTo: P1]);
Pbool([P1 conformsTo: P3]);
return 0;
}
typedef Root<P1> P1Object;
int test10(void) {
return [P1Object maxValue];
}