aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2012-06-22 15:37:00 +0000
committerFariborz Jahanian <fjahanian@apple.com>2012-06-22 15:37:00 +0000
commit67e8a8b00b67a903ab4916947712963942f1ef40 (patch)
treeb383a2b75bded248b4df883f8ba8fdd5cf67c5d3
parentf7a4c35c945dcbe8bfedae1cd6ea31d8e80ef4d6 (diff)
objective-c: improve diagnostic when collection expression is
not a pointer to a fast-enumerable object. // rdar://11488666 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@158998 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Basic/DiagnosticSemaKinds.td2
-rw-r--r--test/Parser/objc-forcollection-neg.m4
-rw-r--r--test/SemaObjCXX/instantiate-stmt.mm8
3 files changed, 7 insertions, 7 deletions
diff --git a/include/clang/Basic/DiagnosticSemaKinds.td b/include/clang/Basic/DiagnosticSemaKinds.td
index a7582a0d28..43ef9aca58 100644
--- a/include/clang/Basic/DiagnosticSemaKinds.td
+++ b/include/clang/Basic/DiagnosticSemaKinds.td
@@ -5485,7 +5485,7 @@ def err_selector_element_not_lvalue : Error<
def err_selector_element_type : Error<
"selector element type %0 is not a valid object">;
def err_collection_expr_type : Error<
- "collection expression type %0 is not a valid object">;
+ "the type %0 is not a pointer to a fast-enumerable object">;
def warn_collection_expr_type : Warning<
"collection expression type %0 may not respond to %1">;
diff --git a/test/Parser/objc-forcollection-neg.m b/test/Parser/objc-forcollection-neg.m
index 1a989a1446..9e5400c5f2 100644
--- a/test/Parser/objc-forcollection-neg.m
+++ b/test/Parser/objc-forcollection-neg.m
@@ -26,12 +26,12 @@ typedef struct objc_object {
int i=0;
for (int * elem in elem) // expected-error {{selector element type 'int *' is not a valid object}} \
- expected-error {{collection expression type 'int *' is not a valid object}}
+ expected-error {{the type 'int *' is not a pointer to a fast-enumerable object}}
++i;
for (i in elem) // expected-error {{use of undeclared identifier 'elem'}} \
expected-error {{selector element type 'int' is not a valid object}}
++i;
- for (id se in i) // expected-error {{collection expression type 'int' is not a valid object}}
+ for (id se in i) // expected-error {{the type 'int' is not a pointer to a fast-enumerable object}}
++i;
}
@end
diff --git a/test/SemaObjCXX/instantiate-stmt.mm b/test/SemaObjCXX/instantiate-stmt.mm
index ff72858afd..7575f7ad1a 100644
--- a/test/SemaObjCXX/instantiate-stmt.mm
+++ b/test/SemaObjCXX/instantiate-stmt.mm
@@ -38,20 +38,20 @@ template<typename T> void eat(T);
template<typename E, typename T>
void fast_enumeration_test(T collection) {
for (E element in collection) { // expected-error{{selector element type 'int' is not a valid object}} \
- // expected-error{{collection expression type 'vector' is not a valid object}}
+ // expected-error{{the type 'vector' is not a pointer to a fast-enumerable object}}
eat(element);
}
E element;
for (element in collection) // expected-error{{selector element type 'int' is not a valid object}} \
- // expected-error{{collection expression type 'vector' is not a valid object}}
+ // expected-error{{the type 'vector' is not a pointer to a fast-enumerable object}}
eat(element);
- for (NSString *str in collection) // expected-error{{collection expression type 'vector' is not a valid object}}
+ for (NSString *str in collection) // expected-error{{the type 'vector' is not a pointer to a fast-enumerable object}}
eat(str);
NSString *str;
- for (str in collection) // expected-error{{collection expression type 'vector' is not a valid object}}
+ for (str in collection) // expected-error{{the type 'vector' is not a pointer to a fast-enumerable object}}
eat(str);
}