2009-11-19 08:01:57 +08:00
|
|
|
// Note: the run lines follow their respective tests, since line/column
|
|
|
|
// matter in this test.
|
|
|
|
|
|
|
|
@interface Foo {
|
|
|
|
void *isa;
|
|
|
|
}
|
|
|
|
@property(copy) Foo *myprop;
|
|
|
|
@property(retain, nonatomic) id xx;
|
2012-08-21 04:01:13 +08:00
|
|
|
|
Define weak and __weak to mean ARC-style weak references, even in MRC.
Previously, __weak was silently accepted and ignored in MRC mode.
That makes this a potentially source-breaking change that we have to
roll out cautiously. Accordingly, for the time being, actual support
for __weak references in MRC is experimental, and the compiler will
reject attempts to actually form such references. The intent is to
eventually enable the feature by default in all non-GC modes.
(It is, of course, incompatible with ObjC GC's interpretation of
__weak.)
If you like, you can enable this feature with
-Xclang -fobjc-weak
but like any -Xclang option, this option may be removed at any point,
e.g. if/when it is eventually enabled by default.
This patch also enables the use of the ARC __unsafe_unretained qualifier
in MRC. Unlike __weak, this is being enabled immediately. Since
variables are essentially __unsafe_unretained by default in MRC,
the only practical uses are (1) communication and (2) changing the
default behavior of by-value block capture.
As an implementation matter, this means that the ObjC ownership
qualifiers may appear in any ObjC language mode, and so this patch
removes a number of checks for getLangOpts().ObjCAutoRefCount
that were guarding the processing of these qualifiers. I don't
expect this to be a significant drain on performance; it may even
be faster to just check for these qualifiers directly on a type
(since it's probably in a register anyway) than to do N dependent
loads to grab the LangOptions.
rdar://9674298
llvm-svn: 251041
2015-10-23 02:38:17 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:7:11 %s -fobjc-runtime=macosx-10.4 -fno-objc-arc | FileCheck -check-prefix=CHECK-CC1 -check-prefix=CHECK-CC1-NOWEAK %s
|
|
|
|
// RUN: c-index-test -code-completion-at=%s:7:11 %s -fobjc-runtime=macosx-10.8 -Xclang -fobjc-weak -fno-objc-arc | FileCheck -check-prefix=CHECK-CC1 -check-prefix=CHECK-CC1-WEAK %s
|
2009-11-19 08:01:57 +08:00
|
|
|
// CHECK-CC1: {TypedText assign}
|
2011-06-12 01:14:27 +08:00
|
|
|
// CHECK-CC1-NEXT: {TypedText atomic}
|
2009-11-19 08:01:57 +08:00
|
|
|
// CHECK-CC1-NEXT: {TypedText copy}
|
2014-02-20 15:55:15 +08:00
|
|
|
// CHECK-CC1-NEXT: {TypedText getter}{Text =}{Placeholder method}
|
2009-11-19 08:01:57 +08:00
|
|
|
// CHECK-CC1-NEXT: {TypedText nonatomic}
|
2015-06-20 02:27:52 +08:00
|
|
|
// CHECK-CC1: {TypedText nonnull}
|
|
|
|
// CHECK-CC1-NEXT: {TypedText null_resettable}
|
|
|
|
// CHECK-CC1-NEXT: {TypedText null_unspecified}
|
|
|
|
// CHECK-CC1-NEXT: {TypedText nullable}
|
2009-11-19 08:01:57 +08:00
|
|
|
// CHECK-CC1-NEXT: {TypedText readonly}
|
|
|
|
// CHECK-CC1-NEXT: {TypedText readwrite}
|
|
|
|
// CHECK-CC1-NEXT: {TypedText retain}
|
2014-02-20 15:55:15 +08:00
|
|
|
// CHECK-CC1-NEXT: {TypedText setter}{Text =}{Placeholder method}
|
2011-06-16 07:02:42 +08:00
|
|
|
// CHECK-CC1-NEXT: {TypedText strong}
|
|
|
|
// CHECK-CC1-NEXT: {TypedText unsafe_unretained}
|
Define weak and __weak to mean ARC-style weak references, even in MRC.
Previously, __weak was silently accepted and ignored in MRC mode.
That makes this a potentially source-breaking change that we have to
roll out cautiously. Accordingly, for the time being, actual support
for __weak references in MRC is experimental, and the compiler will
reject attempts to actually form such references. The intent is to
eventually enable the feature by default in all non-GC modes.
(It is, of course, incompatible with ObjC GC's interpretation of
__weak.)
If you like, you can enable this feature with
-Xclang -fobjc-weak
but like any -Xclang option, this option may be removed at any point,
e.g. if/when it is eventually enabled by default.
This patch also enables the use of the ARC __unsafe_unretained qualifier
in MRC. Unlike __weak, this is being enabled immediately. Since
variables are essentially __unsafe_unretained by default in MRC,
the only practical uses are (1) communication and (2) changing the
default behavior of by-value block capture.
As an implementation matter, this means that the ObjC ownership
qualifiers may appear in any ObjC language mode, and so this patch
removes a number of checks for getLangOpts().ObjCAutoRefCount
that were guarding the processing of these qualifiers. I don't
expect this to be a significant drain on performance; it may even
be faster to just check for these qualifiers directly on a type
(since it's probably in a register anyway) than to do N dependent
loads to grab the LangOptions.
rdar://9674298
llvm-svn: 251041
2015-10-23 02:38:17 +08:00
|
|
|
// CHECK-CC1-NOWEAK-NOT: {TypedText weak}
|
|
|
|
// CHECK-CC1-WEAK-NEXT: {TypedText weak}
|
2012-08-21 04:01:13 +08:00
|
|
|
|
2012-08-21 05:55:33 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:7:11 %s -fobjc-arc -fobjc-runtime=macosx-10.7 | FileCheck -check-prefix=CHECK-CC1-ARC %s
|
2012-08-21 04:01:13 +08:00
|
|
|
// CHECK-CC1-ARC: {TypedText assign}
|
|
|
|
// CHECK-CC1-ARC-NEXT: {TypedText atomic}
|
|
|
|
// CHECK-CC1-ARC-NEXT: {TypedText copy}
|
2014-02-20 15:55:15 +08:00
|
|
|
// CHECK-CC1-ARC-NEXT: {TypedText getter}{Text =}{Placeholder method}
|
2012-08-21 04:01:13 +08:00
|
|
|
// CHECK-CC1-ARC-NEXT: {TypedText nonatomic}
|
2015-06-20 02:27:52 +08:00
|
|
|
// CHECK-CC1-ARC-NEXT: {TypedText nonnull}
|
|
|
|
// CHECK-CC1-ARC-NEXT: {TypedText null_resettable}
|
|
|
|
// CHECK-CC1-ARC-NEXT: {TypedText null_unspecified}
|
|
|
|
// CHECK-CC1-ARC-NEXT: {TypedText nullable}
|
2012-08-21 04:01:13 +08:00
|
|
|
// CHECK-CC1-ARC-NEXT: {TypedText readonly}
|
|
|
|
// CHECK-CC1-ARC-NEXT: {TypedText readwrite}
|
|
|
|
// CHECK-CC1-ARC-NEXT: {TypedText retain}
|
2014-02-20 15:55:15 +08:00
|
|
|
// CHECK-CC1-ARC-NEXT: {TypedText setter}{Text =}{Placeholder method}
|
2012-08-21 04:01:13 +08:00
|
|
|
// CHECK-CC1-ARC-NEXT: {TypedText strong}
|
|
|
|
// CHECK-CC1-ARC-NEXT: {TypedText unsafe_unretained}
|
|
|
|
// CHECK-CC1-ARC-NEXT: {TypedText weak}
|
|
|
|
|
2009-11-19 08:01:57 +08:00
|
|
|
// RUN: c-index-test -code-completion-at=%s:8:18 %s | FileCheck -check-prefix=CHECK-CC2 %s
|
2014-02-20 15:55:15 +08:00
|
|
|
// CHECK-CC2: {TypedText getter}{Text =}{Placeholder method}
|
2009-11-19 08:01:57 +08:00
|
|
|
// CHECK-CC2-NEXT: {TypedText nonatomic}
|
2015-06-20 02:27:52 +08:00
|
|
|
// CHECK-CC2-NEXT: {TypedText nonnull}
|
|
|
|
// CHECK-CC2-NEXT: {TypedText null_resettable}
|
|
|
|
// CHECK-CC2-NEXT: {TypedText null_unspecified}
|
|
|
|
// CHECK-CC2-NEXT: {TypedText nullable}
|
2012-08-21 04:01:13 +08:00
|
|
|
// CHECK-CC2-NEXT: {TypedText readonly}
|
2009-11-19 08:01:57 +08:00
|
|
|
// CHECK-CC2-NEXT: {TypedText readwrite}
|
2014-02-20 15:55:15 +08:00
|
|
|
// CHECK-CC2-NEXT: {TypedText setter}{Text =}{Placeholder method}
|
2009-11-19 08:01:57 +08:00
|
|
|
@end
|