YouCompleteMe/cpp/llvm/tools/clang/test/SemaObjC/nsobject-attribute-1.m
Strahinja Val Markovic 1f51a89d39 Adding more llvm/clang files
These were ignored by git accidentally. We want ALL OF THEM since they all came
in the llvm/clang source distribution.
2012-07-05 17:55:45 -07:00

49 lines
914 B
Objective-C

// RUN: %clang_cc1 -fblocks -fsyntax-only -verify -Wno-objc-root-class %s
@interface NSObject
- (id)self;
- (id)copy;
@end
typedef struct _foo *__attribute__((NSObject)) Foo_ref;
@interface TestObject {
Foo_ref dict;
}
@property(retain) Foo_ref dict;
@end
@implementation TestObject
@synthesize dict;
@end
@interface NSDictionary
- (int)retainCount;
@end
int main(int argc, char *argv[]) {
NSDictionary *dictRef;
Foo_ref foo = (Foo_ref)dictRef;
// do Properties retain?
int before = [dictRef retainCount];
int after = [dictRef retainCount];
if ([foo retainCount] != [dictRef retainCount]) {
}
// do Blocks retain?
{
void (^block)(void) = ^{
[foo self];
};
before = [foo retainCount];
id save = [block copy];
after = [foo retainCount];
if (after <= before) {
;
}
}
return 0;
}