aboutsummaryrefslogtreecommitdiff
path: root/test/SemaObjCXX
diff options
context:
space:
mode:
Diffstat (limited to 'test/SemaObjCXX')
-rw-r--r--test/SemaObjCXX/abstract-class-type-ivar.mm2
-rw-r--r--test/SemaObjCXX/arc-0x.mm12
-rw-r--r--test/SemaObjCXX/arc-bool-conversion.mm1
-rw-r--r--test/SemaObjCXX/arc-libstdcxx.mm1
-rw-r--r--test/SemaObjCXX/arc-memfunc.mm1
-rw-r--r--test/SemaObjCXX/arc-non-pod.mm116
-rw-r--r--test/SemaObjCXX/arc-objc-lifetime.mm68
-rw-r--r--test/SemaObjCXX/arc-object-init-destroy.mm52
-rw-r--r--test/SemaObjCXX/arc-type-traits.mm1
-rw-r--r--test/SemaObjCXX/argument-dependent-lookup.mm1
-rw-r--r--test/SemaObjCXX/category-lookup.mm2
-rw-r--r--test/SemaObjCXX/composite-objc-pointertype.mm1
-rw-r--r--test/SemaObjCXX/conversion-ranking.mm1
-rw-r--r--test/SemaObjCXX/conversion-to-objc-pointer-2.mm1
-rw-r--r--test/SemaObjCXX/conversion-to-objc-pointer.mm1
-rw-r--r--test/SemaObjCXX/debugger-support.mm8
-rw-r--r--test/SemaObjCXX/decltype.mm25
-rw-r--r--test/SemaObjCXX/delay-parsing-cfunctions.mm1
-rw-r--r--test/SemaObjCXX/delay-parsing-cplusfuncs.mm1
-rw-r--r--test/SemaObjCXX/delay-parsing-func-tryblock.mm1
-rw-r--r--test/SemaObjCXX/expr-objcxx.mm1
-rw-r--r--test/SemaObjCXX/format-strings.mm81
-rw-r--r--test/SemaObjCXX/function-pointer-void-star.mm1
-rw-r--r--test/SemaObjCXX/instantiate-method-return.mm1
-rw-r--r--test/SemaObjCXX/ivar-lookup.mm1
-rw-r--r--test/SemaObjCXX/ivar-struct.mm1
-rw-r--r--test/SemaObjCXX/linkage-spec.mm1
-rw-r--r--test/SemaObjCXX/namespace-lookup.mm1
-rw-r--r--test/SemaObjCXX/null_objc_pointer.mm1
-rw-r--r--test/SemaObjCXX/nullptr.mm1
-rw-r--r--test/SemaObjCXX/overload-gc.mm1
-rw-r--r--test/SemaObjCXX/pointer-to-objc-pointer-conv.mm3
-rw-r--r--test/SemaObjCXX/propert-dot-error.mm2
-rw-r--r--test/SemaObjCXX/properties.mm23
-rw-r--r--test/SemaObjCXX/property-synthesis-error.mm23
-rw-r--r--test/SemaObjCXX/property-type-mismatch.mm1
-rw-r--r--test/SemaObjCXX/references.mm1
-rw-r--r--test/SemaObjCXX/reinterpret-cast-objc-pointertype.mm1
-rw-r--r--test/SemaObjCXX/reserved-keyword-methods.mm1
-rw-r--r--test/SemaObjCXX/standard-conversion-to-bool.mm1
-rw-r--r--test/SemaObjCXX/static-cast.mm1
-rw-r--r--test/SemaObjCXX/vla.mm1
42 files changed, 274 insertions, 172 deletions
diff --git a/test/SemaObjCXX/abstract-class-type-ivar.mm b/test/SemaObjCXX/abstract-class-type-ivar.mm
index 823e9c197d35..990ba1c2abd5 100644
--- a/test/SemaObjCXX/abstract-class-type-ivar.mm
+++ b/test/SemaObjCXX/abstract-class-type-ivar.mm
@@ -13,7 +13,7 @@ class CppConcreteSub : public CppAbstractBase {
};
@interface Objc {
- CppConcreteSub _concrete; // expected-error{{ivar type 'CppConcreteSub' is an abstract class}}
+ CppConcreteSub _concrete; // expected-error{{instance variable type 'CppConcreteSub' is an abstract class}}
}
- (CppAbstractBase*)abstract;
@end
diff --git a/test/SemaObjCXX/arc-0x.mm b/test/SemaObjCXX/arc-0x.mm
index e24b9602fb7f..43f6671ac241 100644
--- a/test/SemaObjCXX/arc-0x.mm
+++ b/test/SemaObjCXX/arc-0x.mm
@@ -80,4 +80,16 @@ void testAutoIdTemplate(id obj) {
autoTemplateFunction<id, 2>(obj, obj, [Array new]); // no-warning
}
+// rdar://12229679
+@interface NSObject @end
+typedef __builtin_va_list va_list;
+@interface MyClass : NSObject
+@end
+
+@implementation MyClass
++ (void)fooMethod:(id)firstArg, ... {
+ va_list args;
+ __builtin_va_arg(args, id);
+}
+@end
diff --git a/test/SemaObjCXX/arc-bool-conversion.mm b/test/SemaObjCXX/arc-bool-conversion.mm
index d8f840e871e5..12a3be3022bb 100644
--- a/test/SemaObjCXX/arc-bool-conversion.mm
+++ b/test/SemaObjCXX/arc-bool-conversion.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s
+// expected-no-diagnostics
// rdar://9310049
bool fn(id obj) {
diff --git a/test/SemaObjCXX/arc-libstdcxx.mm b/test/SemaObjCXX/arc-libstdcxx.mm
index 71771b4b1375..537e6b427970 100644
--- a/test/SemaObjCXX/arc-libstdcxx.mm
+++ b/test/SemaObjCXX/arc-libstdcxx.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-arc-cxxlib=libstdc++ -fobjc-runtime-has-weak -verify %s
+// expected-no-diagnostics
@interface A @end
diff --git a/test/SemaObjCXX/arc-memfunc.mm b/test/SemaObjCXX/arc-memfunc.mm
index 274f873fd48a..09556e396cdd 100644
--- a/test/SemaObjCXX/arc-memfunc.mm
+++ b/test/SemaObjCXX/arc-memfunc.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -verify -fblocks %s
+// expected-no-diagnostics
struct X0 {
static id makeObject1() __attribute__((ns_returns_retained));
diff --git a/test/SemaObjCXX/arc-non-pod.mm b/test/SemaObjCXX/arc-non-pod.mm
deleted file mode 100644
index 1c5cf7af3a18..000000000000
--- a/test/SemaObjCXX/arc-non-pod.mm
+++ /dev/null
@@ -1,116 +0,0 @@
-// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -Warc-abi -verify -fblocks -triple x86_64-apple-darwin10.0.0 %s
-
-// Classes that have an Objective-C object pointer.
-struct HasObjectMember0 { // expected-warning{{'HasObjectMember0' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}
- id x;
-};
-
-struct HasObjectMember1 { // expected-warning{{'HasObjectMember1' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}
- id x[3];
-};
-
-struct HasObjectMember2 { // expected-warning{{'HasObjectMember2' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}
- id x[3][2];
-};
-
-// Don't complain if the type has non-external linkage
-namespace {
- struct HasObjectMember3 {
- id x[3][2];
- };
-}
-
-// Don't complain if the Objective-C pointer type was explicitly given
-// no ownership.
-struct HasObjectMember3 {
- __unsafe_unretained id x[3][2];
-};
-
-struct HasBlockPointerMember0 { // expected-warning{{'HasBlockPointerMember0' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}
- int (^bp)(int);
-};
-
-struct HasBlockPointerMember1 { // expected-warning{{'HasBlockPointerMember1' cannot be shared between ARC and non-ARC code; add a copy constructor, a copy assignment operator, and a destructor to make it ABI-compatible}}
- int (^bp[2][3])(int);
-};
-
-struct NonPOD {
- NonPOD(const NonPOD&);
-};
-
-struct HasObjectMemberAndNonPOD0 { // expected-warning{{'HasObjectMemberAndNonPOD0' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \
- // expected-warning{{'HasObjectMemberAndNonPOD0' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}}
- id x;
- NonPOD np;
-};
-
-struct HasObjectMemberAndNonPOD1 { // expected-warning{{'HasObjectMemberAndNonPOD1' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \
- // expected-warning{{'HasObjectMemberAndNonPOD1' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}}
- NonPOD np;
- id x[3];
-};
-
-struct HasObjectMemberAndNonPOD2 { // expected-warning{{'HasObjectMemberAndNonPOD2' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \
- // expected-warning{{'HasObjectMemberAndNonPOD2' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}}
- NonPOD np;
- id x[3][2];
-};
-
-struct HasObjectMemberAndNonPOD3 {
- HasObjectMemberAndNonPOD3 &operator=(const HasObjectMemberAndNonPOD3&);
- ~HasObjectMemberAndNonPOD3();
- NonPOD np;
- id x[3][2];
-};
-
-struct HasBlockPointerMemberAndNonPOD0 { // expected-warning{{'HasBlockPointerMemberAndNonPOD0' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \
-// expected-warning{{'HasBlockPointerMemberAndNonPOD0' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}}
- NonPOD np;
- int (^bp)(int);
-};
-
-struct HasBlockPointerMemberAndNonPOD1 { // expected-warning{{'HasBlockPointerMemberAndNonPOD1' cannot be shared between ARC and non-ARC code; add a non-trivial copy assignment operator to make it ABI-compatible}} \
-// expected-warning{{'HasBlockPointerMemberAndNonPOD1' cannot be shared between ARC and non-ARC code; add a non-trivial destructor to make it ABI-compatible}}
- NonPOD np;
- int (^bp[2][3])(int);
-};
-
-int check_non_pod_objc_pointer0[__is_pod(id)? 1 : -1];
-int check_non_pod_objc_pointer1[__is_pod(__strong id)? -1 : 1];
-int check_non_pod_objc_pointer2[__is_pod(__unsafe_unretained id)? 1 : -1];
-int check_non_pod_objc_pointer3[__is_pod(id[2][3])? 1 : -1];
-int check_non_pod_objc_pointer4[__is_pod(__unsafe_unretained id[2][3])? 1 : -1];
-int check_non_pod_block0[__is_pod(int (^)(int))? 1 : -1];
-int check_non_pod_block1[__is_pod(int (^ __unsafe_unretained)(int))? 1 : -1];
-int check_non_pod_block2[__is_pod(int (^ __strong)(int))? -1 : 1];
-
-struct FlexibleArrayMember0 {
- int length;
- id array[]; // expected-error{{flexible array member 'array' of non-POD element type 'id __strong[]'}}
-};
-
-struct FlexibleArrayMember1 {
- int length;
- __unsafe_unretained id array[];
-};
-
-// It's okay to pass a retainable type through an ellipsis.
-void variadic(...);
-void test_variadic() {
- variadic(1, 17, @"Foo");
-}
-
-// It's okay to create a VLA of retainable types.
-void vla(int n) {
- id vla[n];
-}
-
-@interface Crufty {
- union {
- struct {
- id object; // expected-note{{has __strong ownership}}
- } an_object; // expected-error{{union member 'an_object' has a non-trivial copy constructor}}
- void *ptr;
- } storage;
-}
-@end
diff --git a/test/SemaObjCXX/arc-objc-lifetime.mm b/test/SemaObjCXX/arc-objc-lifetime.mm
new file mode 100644
index 000000000000..1e4df741422a
--- /dev/null
+++ b/test/SemaObjCXX/arc-objc-lifetime.mm
@@ -0,0 +1,68 @@
+// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin11 -fsyntax-only -fobjc-arc -fblocks -Wexplicit-ownership-type -verify -Wno-objc-root-class %s
+// rdar://10244607
+
+typedef const struct __CFString * CFStringRef;
+@class NSString;
+
+NSString *CFBridgingRelease();
+
+typedef NSString * PNSString;
+
+typedef __autoreleasing NSString * AUTORELEASEPNSString;
+
+@interface I @end
+
+@implementation I
+- (CFStringRef)myString
+{
+ CFStringRef myString =
+ (__bridge CFStringRef) (__strong NSString *)CFBridgingRelease(); // expected-error {{explicit ownership qualifier on cast result has no effect}}
+
+ myString =
+ (__bridge CFStringRef) (__autoreleasing PNSString) CFBridgingRelease(); // expected-error {{explicit ownership qualifier on cast result has no effect}}
+ myString =
+ (__bridge CFStringRef) (AUTORELEASEPNSString) CFBridgingRelease(); // OK
+ myString =
+ (__bridge CFStringRef) (typeof(__strong NSString *)) CFBridgingRelease(); // expected-error {{explicit ownership qualifier on cast result has no effect}}
+ return myString;
+}
+
+- (void)decodeValueOfObjCType:(const char *)type at:(void *)addr {
+ __autoreleasing id *stuff = (__autoreleasing id *)addr;
+}
+@end
+
+// rdar://problem/10711456
+__strong I *__strong test1; // expected-error {{the type 'I *__strong' is already explicitly ownership-qualified}}
+__strong I *(__strong test2); // expected-error {{the type 'I *__strong' is already explicitly ownership-qualified}}
+__strong I *(__strong (test3)); // expected-error {{the type 'I *__strong' is already explicitly ownership-qualified}}
+__unsafe_unretained __typeof__(test3) test4;
+typedef __strong I *strong_I;
+__unsafe_unretained strong_I test5;
+
+// rdar://10907090
+typedef void (^T) ();
+@interface NSObject @end
+@protocol P;
+@interface Radar10907090 @end
+
+@implementation Radar10907090
+- (void) MMM : (NSObject*) arg0 : (NSObject<P>*&)arg : (id) arg1 : (id<P>&) arg2 {} // expected-warning {{method parameter of type 'NSObject<P> *__autoreleasing &' with no explicit ownership}} \
+ // expected-warning {{method parameter of type '__autoreleasing id<P> &' with no explicit ownership}}
+- (void) MM : (NSObject*) arg0 : (__strong NSObject**)arg : (id) arg1 : (__strong id*) arg2 {}
+- (void) M : (NSObject**)arg0 : (id*)arg {} // expected-warning {{method parameter of type 'NSObject *__autoreleasing *' with no explicit ownership}} \
+ // expected-warning {{method parameter of type '__autoreleasing id *' with no explicit ownership}}
+- (void) N : (__strong NSObject***) arg0 : (__strong NSObject<P>***)arg : (float**) arg1 : (double) arg2 {}
+- (void) BLOCK : (T&) arg0 : (T)arg : (__strong T*) arg1 {} // expected-warning {{method parameter of type '__autoreleasing T &' (aka 'void (^__autoreleasing &)()') with no explicit ownership}}
+@end
+
+// rdar://12280826
+@class NSMutableDictionary, NSError;
+@interface Radar12280826
+- (void)createInferiorTransportAndSetEnvironment:(NSMutableDictionary*)environment error:(__autoreleasing NSError*&)error;
+@end
+
+@implementation Radar12280826
+- (void)createInferiorTransportAndSetEnvironment:(NSMutableDictionary*)environment error:(__autoreleasing NSError*&)error {}
+@end
+
diff --git a/test/SemaObjCXX/arc-object-init-destroy.mm b/test/SemaObjCXX/arc-object-init-destroy.mm
deleted file mode 100644
index e10e3eac9fc7..000000000000
--- a/test/SemaObjCXX/arc-object-init-destroy.mm
+++ /dev/null
@@ -1,52 +0,0 @@
-// RUN: %clang_cc1 -fobjc-runtime-has-weak -fsyntax-only -fobjc-arc -verify -Warc-abi -fblocks -triple x86_64-apple-darwin10.0.0 %s
-
-typedef __strong id strong_id;
-typedef __weak id weak_id;
-void test_pseudo_destructors(__strong id *sptr, __weak id *wptr) {
- sptr->~id(); // okay
- wptr->~id(); // okay
- sptr->~strong_id(); // okay
- wptr->~weak_id();
- sptr->~weak_id(); // expected-error{{pseudo-destructor destroys object of type '__strong id' with inconsistently-qualified type 'weak_id' (aka '__weak id')}}
- wptr->strong_id::~strong_id(); // expected-error{{pseudo-destructor destroys object of type '__weak id' with inconsistently-qualified type 'strong_id' (aka '__strong id')}}
-
- sptr->id::~id(); // okay
- wptr->id::~id(); // okay
-}
-
-void test_delete(__strong id *sptr, __weak id *wptr) {
- delete sptr;
- delete wptr;
- delete [] sptr; // expected-warning{{destroying an array of '__strong id'; this array must not have been allocated from non-ARC code}}
- delete [] wptr; // expected-warning{{destroying an array of '__weak id'; this array must not have been allocated from non-ARC code}}
-}
-
-void test_new(int n) {
- (void)new strong_id;
- (void)new weak_id;
- (void)new strong_id [n]; // expected-warning{{allocating an array of 'strong_id' (aka '__strong id'); this array must not be deleted in non-ARC code}}
- (void)new weak_id [n]; // expected-warning{{allocating an array of 'weak_id' (aka '__weak id'); this array must not be deleted in non-ARC code}}
-
- (void)new __strong id;
- (void)new __weak id;
- (void)new __strong id [n]; // expected-warning{{allocating an array of '__strong id'; this array must not be deleted in non-ARC code}}
-
- // Infer '__strong'.
- __strong id *idptr = new id;
- __strong id *idptr2 = new id [n]; // expected-warning{{allocating an array of '__strong id'; this array must not be deleted in non-ARC code}}
-
- // ... but not for arrays.
- typedef id id_array[2][3];
- (void)new id_array; // expected-error{{'new' cannot allocate an array of 'id' with no explicit ownership}}
-
- typedef __strong id strong_id_array[2][3];
- typedef __strong id strong_id_3[3];
- strong_id_3 *idptr3 = new strong_id_array; // expected-warning{{allocating an array of '__strong id'; this array must not be deleted in non-ARC code}}
-}
-
-void test_jump_scope() {
- goto done; // expected-error{{goto into protected scope}}
- __strong id x; // expected-note{{jump bypasses initialization of retaining variable}}
- done:
- return;
-}
diff --git a/test/SemaObjCXX/arc-type-traits.mm b/test/SemaObjCXX/arc-type-traits.mm
index 67bab00cf978..12993a910e54 100644
--- a/test/SemaObjCXX/arc-type-traits.mm
+++ b/test/SemaObjCXX/arc-type-traits.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -fobjc-arc -fobjc-runtime-has-weak -verify -std=c++11 %s
+// expected-no-diagnostics
// Check the results of the various type-trait query functions on
// lifetime-qualified types in ARC.
diff --git a/test/SemaObjCXX/argument-dependent-lookup.mm b/test/SemaObjCXX/argument-dependent-lookup.mm
index a25cc68888d7..244c3f7d0193 100644
--- a/test/SemaObjCXX/argument-dependent-lookup.mm
+++ b/test/SemaObjCXX/argument-dependent-lookup.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
// <rdar://problem/9142559>: For the purposes of Argument-Dependent
// Lookup, Objective-C classes are considered to be in the global
diff --git a/test/SemaObjCXX/category-lookup.mm b/test/SemaObjCXX/category-lookup.mm
index 0e870259b735..7ac4d1c5009e 100644
--- a/test/SemaObjCXX/category-lookup.mm
+++ b/test/SemaObjCXX/category-lookup.mm
@@ -6,5 +6,5 @@
@end
void f() {
- NSScriptClassDescription *f; // expected-error {{use of undeclared identifier 'NSScriptClassDescription'}}
+ NSScriptClassDescription *f; // expected-error {{unknown type name 'NSScriptClassDescription'}}
}
diff --git a/test/SemaObjCXX/composite-objc-pointertype.mm b/test/SemaObjCXX/composite-objc-pointertype.mm
index 684f633f71cc..35739a893624 100644
--- a/test/SemaObjCXX/composite-objc-pointertype.mm
+++ b/test/SemaObjCXX/composite-objc-pointertype.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
@interface Foo
@end
diff --git a/test/SemaObjCXX/conversion-ranking.mm b/test/SemaObjCXX/conversion-ranking.mm
index 6c1408bf21f6..b34c9a24ed5a 100644
--- a/test/SemaObjCXX/conversion-ranking.mm
+++ b/test/SemaObjCXX/conversion-ranking.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@protocol P1
@end
diff --git a/test/SemaObjCXX/conversion-to-objc-pointer-2.mm b/test/SemaObjCXX/conversion-to-objc-pointer-2.mm
index b03d4d89e920..063ce3275913 100644
--- a/test/SemaObjCXX/conversion-to-objc-pointer-2.mm
+++ b/test/SemaObjCXX/conversion-to-objc-pointer-2.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
// rdar: // 7963410
@protocol NSObject @end
diff --git a/test/SemaObjCXX/conversion-to-objc-pointer.mm b/test/SemaObjCXX/conversion-to-objc-pointer.mm
index 235aaac8d09c..41bb4ff37a0a 100644
--- a/test/SemaObjCXX/conversion-to-objc-pointer.mm
+++ b/test/SemaObjCXX/conversion-to-objc-pointer.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
// rdar: // 7963410
template<class T>
diff --git a/test/SemaObjCXX/debugger-support.mm b/test/SemaObjCXX/debugger-support.mm
new file mode 100644
index 000000000000..e8e382a1b3b2
--- /dev/null
+++ b/test/SemaObjCXX/debugger-support.mm
@@ -0,0 +1,8 @@
+// RUN: %clang_cc1 -fdebugger-support -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+@class NSString;
+void testCompareAgainstPtr(int *ptr, NSString *ns) {
+ if (ptr == 17) {}
+ if (ns != 42) {}
+}
diff --git a/test/SemaObjCXX/decltype.mm b/test/SemaObjCXX/decltype.mm
new file mode 100644
index 000000000000..9c4ac16c93f0
--- /dev/null
+++ b/test/SemaObjCXX/decltype.mm
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -std=c++11 %s
+// expected-no-diagnostics
+struct HasValueType {
+ typedef int value_type;
+};
+
+__attribute__((objc_root_class))
+@interface Foo
+{
+@protected
+ HasValueType foo;
+}
+
+@property (nonatomic) HasValueType bar;
+@end
+
+@implementation Foo
+@synthesize bar;
+
+- (void)test {
+ decltype(foo)::value_type vt1;
+ decltype(self->foo)::value_type vt2;
+ decltype(self.bar)::value_type vt3;
+}
+@end
diff --git a/test/SemaObjCXX/delay-parsing-cfunctions.mm b/test/SemaObjCXX/delay-parsing-cfunctions.mm
index fa65dbea9ece..4035d00b8a45 100644
--- a/test/SemaObjCXX/delay-parsing-cfunctions.mm
+++ b/test/SemaObjCXX/delay-parsing-cfunctions.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -x objective-c++ -std=c++11 -fsyntax-only -Werror -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar://10387088
struct X {
diff --git a/test/SemaObjCXX/delay-parsing-cplusfuncs.mm b/test/SemaObjCXX/delay-parsing-cplusfuncs.mm
index b0227099c1e2..d0d7922252e6 100644
--- a/test/SemaObjCXX/delay-parsing-cplusfuncs.mm
+++ b/test/SemaObjCXX/delay-parsing-cplusfuncs.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -x objective-c++ -fsyntax-only -Werror -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar://10387088
@interface MyClass
diff --git a/test/SemaObjCXX/delay-parsing-func-tryblock.mm b/test/SemaObjCXX/delay-parsing-func-tryblock.mm
index 8cf615ec3264..ecee7be629c3 100644
--- a/test/SemaObjCXX/delay-parsing-func-tryblock.mm
+++ b/test/SemaObjCXX/delay-parsing-func-tryblock.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -x objective-c++ -fcxx-exceptions -fsyntax-only -Werror -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// rdar://10387088
@interface MyClass
diff --git a/test/SemaObjCXX/expr-objcxx.mm b/test/SemaObjCXX/expr-objcxx.mm
index e70a001b7041..8ea4dabe16dd 100644
--- a/test/SemaObjCXX/expr-objcxx.mm
+++ b/test/SemaObjCXX/expr-objcxx.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 %s -verify -pedantic -fsyntax-only
+// expected-no-diagnostics
// rdar://8366474
void *P = @selector(foo::bar::);
diff --git a/test/SemaObjCXX/format-strings.mm b/test/SemaObjCXX/format-strings.mm
new file mode 100644
index 000000000000..2fb92e27560a
--- /dev/null
+++ b/test/SemaObjCXX/format-strings.mm
@@ -0,0 +1,81 @@
+// RUN: %clang_cc1 -fsyntax-only -verify -Wformat-nonliteral -pedantic %s
+
+#include <stdarg.h>
+
+extern "C" {
+extern int scanf(const char *restrict, ...);
+extern int printf(const char *restrict, ...);
+extern int vprintf(const char *restrict, va_list);
+}
+
+@class NSString;
+
+@interface Format
++ (void)print:(NSString *)format, ... __attribute__((format(NSString, 1, 2)));
+@end
+
+
+namespace Templates {
+ template<typename T>
+ void my_uninstantiated_print(const T &arg) {
+ [Format print:@"%d", arg];
+ }
+
+ template<typename T>
+ void my_print(const T &arg) {
+ [Format print:@"%d", arg]; // expected-warning {{format specifies type 'int' but the argument has type 'const char *'}}
+ }
+
+ void use_my_print() {
+ my_print("abc"); // expected-note {{requested here}}
+ }
+
+
+ template<typename T>
+ class UninstantiatedPrinter {
+ public:
+ static void print(const T &arg) {
+ [Format print:@"%d", arg]; // no-warning
+ }
+ };
+
+ template<typename T>
+ class Printer {
+ public:
+ void print(const T &arg) {
+ [Format print:@"%d", arg]; // expected-warning {{format specifies type 'int' but the argument has type 'const char *'}}
+ }
+ };
+
+ void use_class(Printer<const char *> &p) {
+ p.print("abc"); // expected-note {{requested here}}
+ }
+
+
+ template<typename T>
+ class UninstantiatedWrapper {
+ public:
+ class Printer {
+ public:
+ void print(const T &arg) {
+ [Format print:@"%d", arg]; // no-warning
+ }
+ };
+ };
+
+ template<typename T>
+ class Wrapper {
+ public:
+ class Printer {
+ public:
+ void print(const T &arg) {
+ [Format print:@"%d", arg]; // expected-warning {{format specifies type 'int' but the argument has type 'const char *'}}
+ }
+ };
+ };
+
+ void use_class(Wrapper<const char *>::Printer &p) {
+ p.print("abc"); // expected-note {{requested here}}
+ }
+}
+
diff --git a/test/SemaObjCXX/function-pointer-void-star.mm b/test/SemaObjCXX/function-pointer-void-star.mm
index 8d3d6251734f..7c8321538d62 100644
--- a/test/SemaObjCXX/function-pointer-void-star.mm
+++ b/test/SemaObjCXX/function-pointer-void-star.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
extern "C" id (*_dealloc)(id) ;
diff --git a/test/SemaObjCXX/instantiate-method-return.mm b/test/SemaObjCXX/instantiate-method-return.mm
index 2a3ae3231280..9fad82feaeb7 100644
--- a/test/SemaObjCXX/instantiate-method-return.mm
+++ b/test/SemaObjCXX/instantiate-method-return.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
// PR7386
@class NSObject;
diff --git a/test/SemaObjCXX/ivar-lookup.mm b/test/SemaObjCXX/ivar-lookup.mm
index fc99c15fd379..d99e61780281 100644
--- a/test/SemaObjCXX/ivar-lookup.mm
+++ b/test/SemaObjCXX/ivar-lookup.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
+// expected-no-diagnostics
@interface Ivar
- (float*)method;
@end
diff --git a/test/SemaObjCXX/ivar-struct.mm b/test/SemaObjCXX/ivar-struct.mm
index 3f9c7eb1a503..c8c9ca9cbbf0 100644
--- a/test/SemaObjCXX/ivar-struct.mm
+++ b/test/SemaObjCXX/ivar-struct.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@interface A {
struct X {
int x, y;
diff --git a/test/SemaObjCXX/linkage-spec.mm b/test/SemaObjCXX/linkage-spec.mm
index 584571de9636..25b57a9a5c68 100644
--- a/test/SemaObjCXX/linkage-spec.mm
+++ b/test/SemaObjCXX/linkage-spec.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
extern "C" {
@class Protocol;
}
diff --git a/test/SemaObjCXX/namespace-lookup.mm b/test/SemaObjCXX/namespace-lookup.mm
index 205b443ffcab..c5521c14353d 100644
--- a/test/SemaObjCXX/namespace-lookup.mm
+++ b/test/SemaObjCXX/namespace-lookup.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
// <rdar://problem/9388207>
@interface A
diff --git a/test/SemaObjCXX/null_objc_pointer.mm b/test/SemaObjCXX/null_objc_pointer.mm
index 0da9e50f5a1c..e0232bf3c872 100644
--- a/test/SemaObjCXX/null_objc_pointer.mm
+++ b/test/SemaObjCXX/null_objc_pointer.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify -Wnull-arithmetic %s
+// expected-no-diagnostics
#define NULL __null
@interface X
diff --git a/test/SemaObjCXX/nullptr.mm b/test/SemaObjCXX/nullptr.mm
index 2b29b043923a..73a921e8c895 100644
--- a/test/SemaObjCXX/nullptr.mm
+++ b/test/SemaObjCXX/nullptr.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -std=c++11 -fblocks -fsyntax-only -verify %s
+// expected-no-diagnostics
@interface A
@end
diff --git a/test/SemaObjCXX/overload-gc.mm b/test/SemaObjCXX/overload-gc.mm
index 5488ea56315c..ffb8680cc03b 100644
--- a/test/SemaObjCXX/overload-gc.mm
+++ b/test/SemaObjCXX/overload-gc.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -triple i386-apple-darwin9 -fobjc-gc -verify %s
+// expected-no-diagnostics
void f0(__weak id *);
diff --git a/test/SemaObjCXX/pointer-to-objc-pointer-conv.mm b/test/SemaObjCXX/pointer-to-objc-pointer-conv.mm
index d0f8404b6027..7ada2f4239a1 100644
--- a/test/SemaObjCXX/pointer-to-objc-pointer-conv.mm
+++ b/test/SemaObjCXX/pointer-to-objc-pointer-conv.mm
@@ -1,4 +1,7 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
+
+// REQUIRES: LP64
@interface G
@end
diff --git a/test/SemaObjCXX/propert-dot-error.mm b/test/SemaObjCXX/propert-dot-error.mm
index 2237411aaf0c..2a462e4ffa37 100644
--- a/test/SemaObjCXX/propert-dot-error.mm
+++ b/test/SemaObjCXX/propert-dot-error.mm
@@ -63,7 +63,7 @@ class Forward;
void testD(D *d) {
d.Forward::property = 17; // expected-error{{property access cannot be qualified with 'Forward::'}}
- d->Forward::ivar = 12; // expected-error{{ivar access cannot be qualified with 'Forward::'}}
+ d->Forward::ivar = 12; // expected-error{{instance variable access cannot be qualified with 'Forward::'}}
d.D::property = 17; // expected-error{{expected a class or namespace}}
d->D::ivar = 12; // expected-error{{expected a class or namespace}}
}
diff --git a/test/SemaObjCXX/properties.mm b/test/SemaObjCXX/properties.mm
index 3c6b13858686..0783eebc11c5 100644
--- a/test/SemaObjCXX/properties.mm
+++ b/test/SemaObjCXX/properties.mm
@@ -106,3 +106,26 @@ void test7(Test7 *ptr) {
delete ptr.implicit_struct_property;
delete ptr.explicit_struct_property;
}
+
+// Make sure the returned value from property assignment is void,
+// because there isn't any other viable way to handle it for
+// non-trivial classes.
+class NonTrivial1 {
+public:
+ ~NonTrivial1();
+};
+class NonTrivial2 {
+public:
+ NonTrivial2();
+ NonTrivial2(const NonTrivial2&);
+};
+@interface TestNonTrivial
+@property(assign, nonatomic) NonTrivial1 p1;
+@property(assign, nonatomic) NonTrivial2 p2;
+@end
+TestNonTrivial *TestNonTrivialObj;
+
+extern void* VoidType;
+extern decltype(TestNonTrivialObj.p1 = NonTrivial1())* VoidType;
+extern decltype(TestNonTrivialObj.p2 = NonTrivial2())* VoidType;
+
diff --git a/test/SemaObjCXX/property-synthesis-error.mm b/test/SemaObjCXX/property-synthesis-error.mm
index 4f64a3a3385e..b6ab85ccab0d 100644
--- a/test/SemaObjCXX/property-synthesis-error.mm
+++ b/test/SemaObjCXX/property-synthesis-error.mm
@@ -16,7 +16,7 @@
@interface MyClass ()
-@property (readwrite) NSMutableArray * array;
+@property (readwrite, retain) NSMutableArray * array;
@end
@@ -83,3 +83,24 @@ struct ConvertToIncomplete { operator IncompleteStruct&(); };
@implementation SynthIncompleteRef // expected-error {{cannot synthesize property 'x' with incomplete type 'IncompleteStruct'}}
@synthesize y; // expected-error {{cannot synthesize property 'y' with incomplete type 'IncompleteStruct'}}
@end
+
+
+// Check error handling for instantiation during property synthesis.
+template<typename T> class TemplateClass1 {
+ T *x; // expected-error {{'x' declared as a pointer to a reference of type 'int &'}}
+};
+template<typename T> class TemplateClass2 {
+ TemplateClass2& operator=(TemplateClass1<T>);
+ TemplateClass2& operator=(TemplateClass2) { T(); } // expected-error {{reference to type 'int' requires an initializer}} \
+ // expected-note 2 {{implicitly declared private here}} \
+ // expected-note {{'operator=' declared here}}
+};
+__attribute__((objc_root_class)) @interface InterfaceWithTemplateProperties
+@property TemplateClass2<int&> intprop;
+@property TemplateClass2<int&> &floatprop;
+@end
+@implementation InterfaceWithTemplateProperties // expected-error 2 {{'operator=' is a private member of 'TemplateClass2<int &>'}} \
+ // expected-error {{atomic property of reference type 'TemplateClass2<int &> &' cannot have non-trivial assignment operator}} \
+ // expected-note {{in instantiation of template class}} \
+ // expected-note {{in instantiation of member function}}
+@end
diff --git a/test/SemaObjCXX/property-type-mismatch.mm b/test/SemaObjCXX/property-type-mismatch.mm
index 059793cf5ceb..2b267ad96eef 100644
--- a/test/SemaObjCXX/property-type-mismatch.mm
+++ b/test/SemaObjCXX/property-type-mismatch.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
// rdar://9740328
@protocol P1;
diff --git a/test/SemaObjCXX/references.mm b/test/SemaObjCXX/references.mm
index 3a522005abee..f63e17d98efc 100644
--- a/test/SemaObjCXX/references.mm
+++ b/test/SemaObjCXX/references.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -verify -emit-llvm -o - %s
+// expected-no-diagnostics
// Test reference binding.
diff --git a/test/SemaObjCXX/reinterpret-cast-objc-pointertype.mm b/test/SemaObjCXX/reinterpret-cast-objc-pointertype.mm
index fcabaded7c4d..4d7c049bbfea 100644
--- a/test/SemaObjCXX/reinterpret-cast-objc-pointertype.mm
+++ b/test/SemaObjCXX/reinterpret-cast-objc-pointertype.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@interface NSString @end
diff --git a/test/SemaObjCXX/reserved-keyword-methods.mm b/test/SemaObjCXX/reserved-keyword-methods.mm
index 1302128ac0f0..12608dea161a 100644
--- a/test/SemaObjCXX/reserved-keyword-methods.mm
+++ b/test/SemaObjCXX/reserved-keyword-methods.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
#define FOR_EACH_KEYWORD(macro) \
macro(asm) \
diff --git a/test/SemaObjCXX/standard-conversion-to-bool.mm b/test/SemaObjCXX/standard-conversion-to-bool.mm
index 2e6984872d79..c36b63bd6413 100644
--- a/test/SemaObjCXX/standard-conversion-to-bool.mm
+++ b/test/SemaObjCXX/standard-conversion-to-bool.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@class NSString;
id a;
diff --git a/test/SemaObjCXX/static-cast.mm b/test/SemaObjCXX/static-cast.mm
index e2827028de59..494ee253e252 100644
--- a/test/SemaObjCXX/static-cast.mm
+++ b/test/SemaObjCXX/static-cast.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@protocol NSTextViewDelegate;
diff --git a/test/SemaObjCXX/vla.mm b/test/SemaObjCXX/vla.mm
index d6da1c0cf40e..e1d556e9921a 100644
--- a/test/SemaObjCXX/vla.mm
+++ b/test/SemaObjCXX/vla.mm
@@ -1,4 +1,5 @@
// RUN: %clang_cc1 -fsyntax-only -verify %s
+// expected-no-diagnostics
@interface Data
- (unsigned)length;