xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGenObjC/arc-linetable-autorelease.m (revision 0a6a1f1d05b60e214de2f05a7310ddd1f0e590e7)
1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -emit-llvm -fobjc-arc -g -triple x86_64-apple-darwin10 %s -o - | FileCheck %s
2f4a2713aSLionel Sambuc// Ensure that the line info is making sense:
3f4a2713aSLionel Sambuc// ARC cleanups should be at the closing '}'.
4f4a2713aSLionel Sambuc@protocol NSObject
5f4a2713aSLionel Sambuc@end
6f4a2713aSLionel Sambuc
7f4a2713aSLionel Sambuc@interface NSObject <NSObject> {}
8f4a2713aSLionel Sambuc@end
9f4a2713aSLionel Sambuc
10f4a2713aSLionel Sambuc@protocol NSCopying
11f4a2713aSLionel Sambuc@end
12f4a2713aSLionel Sambuc
13f4a2713aSLionel Sambuc@protocol NSCoding
14f4a2713aSLionel Sambuc@end
15f4a2713aSLionel Sambuc
16f4a2713aSLionel Sambuctypedef double CGFloat;
17f4a2713aSLionel Sambucstruct CGRect {};
18f4a2713aSLionel Sambuctypedef struct CGRect CGRect;
19f4a2713aSLionel Sambuctypedef CGRect NSRect;
20f4a2713aSLionel SambucNSRect NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h);
21f4a2713aSLionel Sambuc@interface NSBezierPath : NSObject <NSCopying, NSCoding>
22f4a2713aSLionel Sambuc+ (NSBezierPath *)bezierPathWithRoundedRect:(NSRect)rect xRadius:(CGFloat)xRadius yRadius:(CGFloat)yRadius;
23f4a2713aSLionel Sambuc@end
24f4a2713aSLionel Sambuc@implementation AppDelegate : NSObject {}
25f4a2713aSLionel Sambuc- (NSBezierPath *)_createBezierPathWithWidth:(CGFloat)width height:(CGFloat)height radius:(CGFloat)radius lineWidth:(CGFloat)lineWidth
26f4a2713aSLionel Sambuc{
27f4a2713aSLionel Sambuc  NSRect rect = NSMakeRect(0, 0, width, height);
28f4a2713aSLionel Sambuc  NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:radius yRadius:radius];
29f4a2713aSLionel Sambuc  CGFloat pattern[2];
30f4a2713aSLionel Sambuc  // CHECK: define {{.*}}_createBezierPathWithWidth
31f4a2713aSLionel Sambuc  // CHECK: load {{.*}} %path, align {{.*}}, !dbg ![[RET:[0-9]+]]
32*0a6a1f1dSLionel Sambuc  // CHECK: call void @objc_storeStrong{{.*}} !dbg ![[ARC:[0-9]+]]
33*0a6a1f1dSLionel Sambuc  // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg ![[ARC]]
34*0a6a1f1dSLionel Sambuc  // CHECK: ret {{.*}} !dbg ![[ARC]]
35*0a6a1f1dSLionel Sambuc  // CHECK: ![[RET]] = !MDLocation(line: [[@LINE+1]], scope: !{{.*}})
36f4a2713aSLionel Sambuc  return path;
37*0a6a1f1dSLionel Sambuc  // CHECK: ![[ARC]] = !MDLocation(line: [[@LINE+1]], scope: !{{.*}})
38f4a2713aSLionel Sambuc}
39f4a2713aSLionel Sambuc@end
40