Improve diagnostics when we fail to convert from a source type to a
destination type for initialization, assignment, parameter-passing,
etc. The main issue fixed here is that we used rather confusing
wording for diagnostics such as

t.c:2:9: warning: initializing 'char const [2]' discards qualifiers,
      expected 'char *' [-pedantic]
  char *name = __func__;
        ^      ~~~~~~~~

We're not initializing a 'char const [2]', we're initializing a 'char
*' with an expression of type 'char const [2]'. Similar problems
existed for other diagnostics in this area, so I've normalized them all
with more precise descriptive text to say what we're
initializing/converting/assigning/etc. from and to. The warning for
the code above is now:

t.c:2:9: warning: initializing 'char *' from an expression of type
      'char const [2]' discards qualifiers [-pedantic]
  char *name = __func__;
        ^      ~~~~~~~~

Fixes <rdar://problem/7447179>.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@100832 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/SemaObjC/argument-checking.m b/test/SemaObjC/argument-checking.m
index 3806a4c..19caf32 100644
--- a/test/SemaObjC/argument-checking.m
+++ b/test/SemaObjC/argument-checking.m
@@ -16,10 +16,10 @@
   id obj = [Test alloc];
   struct S sInst;
 
-  charStarFunc(1); // expected-warning {{incompatible integer to pointer conversion passing 'int', expected 'char *'}}
-  charFunc("abc"); // expected-warning {{incompatible pointer to integer conversion passing 'char [4]', expected 'char'}}
+  charStarFunc(1); // expected-warning {{incompatible integer to pointer conversion passing 'int' to parameter of type 'char *'}}
+  charFunc("abc"); // expected-warning {{incompatible pointer to integer conversion passing 'char [4]' to parameter of type 'char'}}
 
   [obj charStarMeth:1]; // expected-warning {{incompatible integer to pointer conversion sending 'int'}}
-  [obj structMeth:1]; // expected-error {{incompatible type sending 'int'}}
-  [obj structMeth:sInst :1]; // expected-error {{incompatible type sending 'int'}}
+  [obj structMeth:1]; // expected-error {{sending 'int'}}
+  [obj structMeth:sInst :1]; // expected-error {{sending 'int'}}
 }
diff --git a/test/SemaObjC/block-type-safety.m b/test/SemaObjC/block-type-safety.m
index 0df8c67..2b31cac 100644
--- a/test/SemaObjC/block-type-safety.m
+++ b/test/SemaObjC/block-type-safety.m
@@ -29,14 +29,14 @@
 }
 
 void test1() {
-    f2(^(Sub *o) { });    // expected-error {{incompatible block pointer types passing 'void (^)(Sub *)', expected 'void (^)(Super *)'}}
+    f2(^(Sub *o) { });    // expected-error {{incompatible block pointer types passing}}
     f3(^(Super *o) { });  // OK, block taking Super* may be called with a Sub*
 
     r0(^Super* () { return 0; });  // OK
     r0(^Sub* () { return 0; });    // OK, variable of type Super* gets return value of type Sub*
     r0(^id () { return 0; });
 
-    r1(^Super* () { return 0; });  // expected-error {{incompatible block pointer types passing 'Super *(^)(void)', expected 'Sub *(^)()'}}
+    r1(^Super* () { return 0; });  // expected-error {{incompatible block pointer types passing}}
     r1(^Sub* () { return 0; });    // OK
     r1(^id () { return 0; }); 
      
@@ -97,10 +97,10 @@
 @protocol P, P2;
 void f4(void (^f)(id<P> x)) {
     NSArray<P2> *b;
-    f(b);	// expected-warning {{incompatible type passing 'NSArray<P2> *', expected 'id<P>'}}
+    f(b);	// expected-warning {{passing 'NSArray<P2> *' to parameter of incompatible type 'id<P>'}}
 }
 
 void test3() {
-  f4(^(NSArray<P2>* a) { });  // expected-error {{incompatible block pointer types passing 'void (^)(NSArray<P2> *)', expected 'void (^)(id<P>)'}}
+  f4(^(NSArray<P2>* a) { });  // expected-error {{incompatible block pointer types passing 'void (^)(NSArray<P2> *)' to parameter of type 'void (^)(id<P>)'}}
 }
 
diff --git a/test/SemaObjC/blocks.m b/test/SemaObjC/blocks.m
index afa3bdf..10239e5 100644
--- a/test/SemaObjC/blocks.m
+++ b/test/SemaObjC/blocks.m
@@ -23,7 +23,7 @@
 
 void bar5(id(^)(void));
 void foo5(id (^objectCreationBlock)(int)) {
-    return bar5(objectCreationBlock); // expected-error {{incompatible block pointer types passing 'id (^)(int)', expected 'id (^)(void)'}}
+    return bar5(objectCreationBlock); // expected-error {{incompatible block pointer types passing 'id (^)(int)' to parameter of type 'id (^)(void)'}}
 }
 
 void bar6(id(^)(int));
diff --git a/test/SemaObjC/class-method-self.m b/test/SemaObjC/class-method-self.m
index 6f7d1fd..ec0edf1 100644
--- a/test/SemaObjC/class-method-self.m
+++ b/test/SemaObjC/class-method-self.m
@@ -18,9 +18,9 @@
 static XX *obj;
 
 + (void)classMethod {
-  [obj addObserver:self];     // expected-warning {{incompatible pointer types sending 'Class', expected 'XX *'}}
+  [obj addObserver:self];     // expected-warning {{incompatible pointer types sending 'Class' to parameter of type 'XX *'}}
   Class whatever;
-  [obj addObserver:whatever]; // expected-warning {{incompatible pointer types sending 'Class', expected 'XX *'}} 
+  [obj addObserver:whatever]; // expected-warning {{incompatible pointer types sending 'Class' to parameter of type 'XX *'}}
 }
 @end
 
diff --git a/test/SemaObjC/compatible-protocol-qualified-types.m b/test/SemaObjC/compatible-protocol-qualified-types.m
index 0df905c..1c9cc2c 100644
--- a/test/SemaObjC/compatible-protocol-qualified-types.m
+++ b/test/SemaObjC/compatible-protocol-qualified-types.m
@@ -69,7 +69,7 @@
 
 
 - (NSTextStorage *)contents {
- [_contents setDelegate:self]; // expected-warning {{incompatible type sending 'SKTText *', expected 'id<NSTextStorageDelegate>'}}
+ [_contents setDelegate:self]; // expected-warning {{sending 'SKTText *' to parameter of incompatible type 'id<NSTextStorageDelegate>'}}
  return 0;
 }
 
diff --git a/test/SemaObjC/comptypes-1.m b/test/SemaObjC/comptypes-1.m
index 5b1891d..98107ee 100644
--- a/test/SemaObjC/comptypes-1.m
+++ b/test/SemaObjC/comptypes-1.m
@@ -34,25 +34,25 @@
   /* Assigning to a 'MyClass *' variable should always generate a
      warning, unless done from an 'id'.  */
   obj_c = obj;    /* Ok */
-  obj_c = obj_cp; // // expected-warning {{incompatible pointer types assigning 'MyOtherClass *', expected 'MyClass *'}}
-  obj_c = obj_C;  // expected-warning {{incompatible pointer types assigning 'Class', expected 'MyClass *'}}
+  obj_c = obj_cp; // // expected-warning {{incompatible pointer types assigning to 'MyClass *' from 'MyOtherClass *'}}
+  obj_c = obj_C;  // expected-warning {{incompatible pointer types assigning to 'MyClass *' from 'Class'}}
 
   /* Assigning to an 'id<MyProtocol>' variable should generate a
      warning if done from a 'MyClass *' (which doesn't implement
      MyProtocol), but not from an 'id' or from a 'MyOtherClass *'
      (which implements MyProtocol).  */
   obj_p = obj;    /* Ok */
-  obj_p = obj_c;  // expected-warning {{incompatible type assigning 'MyClass *', expected 'id<MyProtocol>'}}
+  obj_p = obj_c;  // expected-warning {{ assigning to 'id<MyProtocol>' from incompatible type 'MyClass *'}}
   obj_p = obj_cp; /* Ok  */
-  obj_p = obj_C;  // expected-warning {{incompatible pointer types assigning 'Class', expected 'id<MyProtocol>'}}
+  obj_p = obj_C;  // expected-warning {{incompatible pointer types assigning to 'id<MyProtocol>' from 'Class'}}
 
   /* Assigning to a 'MyOtherClass *' variable should always generate
      a warning, unless done from an 'id' or an 'id<MyProtocol>' (since
      MyOtherClass implements MyProtocol).  */
   obj_cp = obj;    /* Ok */
-  obj_cp = obj_c;  // expected-warning {{incompatible pointer types assigning 'MyClass *', expected 'MyOtherClass *'}}
+  obj_cp = obj_c;  // expected-warning {{incompatible pointer types assigning to 'MyOtherClass *' from 'MyClass *'}}
   obj_cp = obj_p;  /* Ok */
-  obj_cp = obj_C;  // expected-warning {{incompatible pointer types assigning 'Class', expected 'MyOtherClass *'}}
+  obj_cp = obj_C;  // expected-warning {{incompatible pointer types assigning to 'MyOtherClass *' from 'Class'}}
 
   /* Any comparison involving an 'id' must be without warnings.  */
   if (obj == obj_p) foo() ;  /* Ok  */ /*Bogus warning here in 2.95.4*/
diff --git a/test/SemaObjC/comptypes-3.m b/test/SemaObjC/comptypes-3.m
index 94171d1..6c1ce41 100644
--- a/test/SemaObjC/comptypes-3.m
+++ b/test/SemaObjC/comptypes-3.m
@@ -26,21 +26,21 @@
   id<MyProtocolAB> obj_ab = nil;
   id<MyProtocolAC> obj_ac = nil;
 
-  obj_a = obj_b;  // expected-warning {{incompatible type assigning 'id<MyProtocolB>', expected 'id<MyProtocolA>'}}
+  obj_a = obj_b;  // expected-warning {{assigning to 'id<MyProtocolA>' from incompatible type 'id<MyProtocolB>'}}
   obj_a = obj_ab; /* Ok */
   obj_a = obj_ac; /* Ok */
   
-  obj_b = obj_a;  // expected-warning {{incompatible type assigning 'id<MyProtocolA>', expected 'id<MyProtocolB>'}}
+  obj_b = obj_a;  // expected-warning {{assigning to 'id<MyProtocolB>' from incompatible type 'id<MyProtocolA>'}}
   obj_b = obj_ab; /* Ok */
-  obj_b = obj_ac; // expected-warning {{incompatible type assigning 'id<MyProtocolAC>', expected 'id<MyProtocolB>'}}
+  obj_b = obj_ac; // expected-warning {{assigning to 'id<MyProtocolB>' from incompatible type 'id<MyProtocolAC>'}}
   
-  obj_ab = obj_a;  // expected-warning {{incompatible type assigning 'id<MyProtocolA>', expected 'id<MyProtocolAB>'}}
-  obj_ab = obj_b;  // expected-warning {{incompatible type assigning 'id<MyProtocolB>', expected 'id<MyProtocolAB>'}}
-  obj_ab = obj_ac; // expected-warning {{incompatible type assigning 'id<MyProtocolAC>', expected 'id<MyProtocolAB>'}}
+  obj_ab = obj_a;  // expected-warning {{assigning to 'id<MyProtocolAB>' from incompatible type 'id<MyProtocolA>'}}
+  obj_ab = obj_b;  // expected-warning {{assigning to 'id<MyProtocolAB>' from incompatible type 'id<MyProtocolB>'}}
+  obj_ab = obj_ac; // expected-warning {{assigning to 'id<MyProtocolAB>' from incompatible type 'id<MyProtocolAC>'}}
   
-  obj_ac = obj_a;  // expected-warning {{incompatible type assigning 'id<MyProtocolA>', expected 'id<MyProtocolAC>'}}
-  obj_ac = obj_b;  // expected-warning {{incompatible type assigning 'id<MyProtocolB>', expected 'id<MyProtocolAC>'}}
-  obj_ac = obj_ab; // expected-warning {{incompatible type assigning 'id<MyProtocolAB>', expected 'id<MyProtocolAC>'}}
+  obj_ac = obj_a;  // expected-warning {{assigning to 'id<MyProtocolAC>' from incompatible type 'id<MyProtocolA>'}}
+  obj_ac = obj_b;  // expected-warning {{assigning to 'id<MyProtocolAC>' from incompatible type 'id<MyProtocolB>'}}
+  obj_ac = obj_ab; // expected-warning {{assigning to 'id<MyProtocolAC>' from incompatible type 'id<MyProtocolAB>'}}
 
   if (obj_a == obj_b) foo (); // expected-warning {{comparison of distinct pointer types ('id<MyProtocolA>' and 'id<MyProtocolB>')}}
   if (obj_b == obj_a) foo (); // expected-warning {{comparison of distinct pointer types ('id<MyProtocolB>' and 'id<MyProtocolA>')}}
diff --git a/test/SemaObjC/comptypes-6.m b/test/SemaObjC/comptypes-6.m
index 2911a39..cabf813 100644
--- a/test/SemaObjC/comptypes-6.m
+++ b/test/SemaObjC/comptypes-6.m
@@ -9,7 +9,7 @@
 
 static Derived *test(void)
 {
-   Derived *m = foo();   // expected-warning {{incompatible pointer types initializing 'Object *', expected 'Derived *'}}
+   Derived *m = foo();   // expected-warning {{incompatible pointer types initializing 'Derived *' from an expression of type 'Object *'}}
 
    return m;
 }
diff --git a/test/SemaObjC/comptypes-7.m b/test/SemaObjC/comptypes-7.m
index 2519c41..df627e5 100644
--- a/test/SemaObjC/comptypes-7.m
+++ b/test/SemaObjC/comptypes-7.m
@@ -24,27 +24,27 @@
 
   /* These should all generate warnings.  */
   
-  obj = i; // expected-warning {{incompatible integer to pointer conversion assigning 'int', expected 'id'}}
-  obj = j; // expected-warning {{incompatible pointer types assigning 'int *', expected 'id'}}
+  obj = i; // expected-warning {{incompatible integer to pointer conversion assigning to 'id' from 'int'}}
+  obj = j; // expected-warning {{incompatible pointer types assigning to 'id' from 'int *'}}
 
-  obj_p = i; // expected-warning {{incompatible integer to pointer conversion assigning 'int', expected 'id<MyProtocol>'}}
-  obj_p = j; // expected-warning {{incompatible pointer types assigning 'int *', expected 'id<MyProtocol>'}}
+  obj_p = i; // expected-warning {{incompatible integer to pointer conversion assigning to 'id<MyProtocol>' from 'int'}}
+  obj_p = j; // expected-warning {{ incompatible pointer types assigning to 'id<MyProtocol>' from 'int *'}}
   
-  obj_c = i; // expected-warning {{incompatible integer to pointer conversion assigning 'int', expected 'MyClass *'}}
-  obj_c = j; // expected-warning {{incompatible pointer types assigning 'int *', expected 'MyClass *'}}
+  obj_c = i; // expected-warning {{ incompatible integer to pointer conversion assigning to 'MyClass *' from 'int'}}
+  obj_c = j; // expected-warning {{incompatible pointer types assigning to 'MyClass *' from 'int *'}}
 
-  obj_C = i; // expected-warning {{incompatible integer to pointer conversion assigning 'int', expected 'Class'}}
-  obj_C = j; // expected-warning {{incompatible pointer types assigning 'int *', expected 'Class'}}
+  obj_C = i; // expected-warning {{incompatible integer to pointer conversion assigning to 'Class' from 'int'}}
+  obj_C = j; // expected-warning {{incompatible pointer types assigning to 'Class' from 'int *'}}
   
-  i = obj;   // expected-warning {{incompatible pointer to integer conversion assigning 'id', expected 'int'}}
-  i = obj_p; // expected-warning {{incompatible pointer to integer conversion assigning 'id<MyProtocol>', expected 'int'}}
-  i = obj_c; // expected-warning {{incompatible pointer to integer conversion assigning 'MyClass *', expected 'int'}}
-  i = obj_C; // expected-warning {{incompatible pointer to integer conversion assigning 'Class', expected 'int'}}
+  i = obj;   // expected-warning {{incompatible pointer to integer conversion assigning to 'int' from 'id'}}
+  i = obj_p; // expected-warning {{incompatible pointer to integer conversion assigning to 'int' from 'id<MyProtocol>'}}
+  i = obj_c; // expected-warning {{incompatible pointer to integer conversion assigning to 'int' from 'MyClass *'}}
+  i = obj_C; // expected-warning {{incompatible pointer to integer conversion assigning to 'int' from 'Class'}}
   
-  j = obj;   // expected-warning {{incompatible pointer types assigning 'id', expected 'int *'}}
-  j = obj_p; // expected-warning {{incompatible pointer types assigning 'id<MyProtocol>', expected 'int *'}}
-  j = obj_c; // expected-warning {{incompatible pointer types assigning 'MyClass *', expected 'int *'}}
-  j = obj_C; // expected-warning {{incompatible pointer types assigning 'Class', expected 'int *'}}
+  j = obj;   // expected-warning {{incompatible pointer types assigning to 'int *' from 'id'}}
+  j = obj_p; // expected-warning {{ incompatible pointer types assigning to 'int *' from 'id<MyProtocol>'}}
+  j = obj_c; // expected-warning {{incompatible pointer types assigning to 'int *' from 'MyClass *'}}
+  j = obj_C; // expected-warning {{incompatible pointer types assigning to 'int *' from 'Class'}}
   
   if (obj == i) foo() ; // expected-warning {{comparison between pointer and integer ('id' and 'int')}}
   if (i == obj) foo() ; // expected-warning {{comparison between pointer and integer ('int' and 'id')}}
diff --git a/test/SemaObjC/comptypes-legal.m b/test/SemaObjC/comptypes-legal.m
index 8caf185..e318d33 100644
--- a/test/SemaObjC/comptypes-legal.m
+++ b/test/SemaObjC/comptypes-legal.m
@@ -33,5 +33,5 @@
 {
   // GCC currently allows this (it has some fiarly new support for covariant return types and contravariant argument types).
   // Since registerFunc: expects a Derived object as it's second argument, I don't know why this would be legal.
-  [Derived registerFunc: ExternFunc];  // expected-warning{{incompatible pointer types sending 'NSObject *(NSObject *, NSObject *)', expected 'FuncSignature *'}}
+  [Derived registerFunc: ExternFunc];  // expected-warning{{incompatible pointer types sending 'NSObject *(NSObject *, NSObject *)' to parameter of type 'FuncSignature *'}}
 }
diff --git a/test/SemaObjC/conditional-expr-2.m b/test/SemaObjC/conditional-expr-2.m
index e97b693..fdf3d13 100644
--- a/test/SemaObjC/conditional-expr-2.m
+++ b/test/SemaObjC/conditional-expr-2.m
@@ -25,5 +25,5 @@
   obj = i ? NSKeyValueCoding_NullValue : nukedUpdatesList; // expected-warning{{incompatible operand types ('NSKey *' and 'UpdatesList *')}}
   key = i ? NSKeyValueCoding_NullValue : nukedUpdatesList; // expected-warning{{incompatible operand types ('NSKey *' and 'UpdatesList *')}}
   key = i ? NSKeyValueCoding_NullValue : keysub;
-  keysub = i ? NSKeyValueCoding_NullValue : keysub; // expected-warning{{incompatible pointer types assigning 'NSKey *', expected 'KeySub *'}}
+  keysub = i ? NSKeyValueCoding_NullValue : keysub; // expected-warning{{incompatible pointer types assigning to 'KeySub *' from 'NSKey *'}}
 }
diff --git a/test/SemaObjC/conditional-expr-3.m b/test/SemaObjC/conditional-expr-3.m
index 312f77a..9f34ca0 100644
--- a/test/SemaObjC/conditional-expr-3.m
+++ b/test/SemaObjC/conditional-expr-3.m
@@ -27,11 +27,11 @@
 }
 
 void f2(id<P1> x) {
-  id<P0> l = x; // expected-warning {{incompatible type initializing 'id<P1>', expected 'id<P0>'}}
+  id<P0> l = x; // expected-warning {{initializing 'id<P0>' from an expression of incompatible type 'id<P1>'}}
 }
 
 void f3(A *a) {
-  id<P1> l = a; // expected-warning {{incompatible type initializing 'A *', expected 'id<P1>'}}
+  id<P1> l = a; // expected-warning {{ initializing 'id<P1>' from an expression of incompatible type 'A *'}}
 }
 
 void f4(int cond, id x, A *a) {
diff --git a/test/SemaObjC/conditional-expr-4.m b/test/SemaObjC/conditional-expr-4.m
index 84652e4..944c175 100644
--- a/test/SemaObjC/conditional-expr-4.m
+++ b/test/SemaObjC/conditional-expr-4.m
@@ -26,7 +26,7 @@
 }
 
 void *f1_const_a(int x, void *p, const A * q) {
-  void *r = x ? p : q; // expected-warning{{initializing 'void const *' discards qualifiers, expected 'void *'}}
+  void *r = x ? p : q; // expected-warning{{initializing 'void *' from an expression of type 'void const *' discards qualifiers}}
   return r;
 }
 
diff --git a/test/SemaObjC/conditional-expr.m b/test/SemaObjC/conditional-expr.m
index 1436f7e..74ab59b 100644
--- a/test/SemaObjC/conditional-expr.m
+++ b/test/SemaObjC/conditional-expr.m
@@ -27,7 +27,7 @@
 @implementation DTFilterOutputStream2 // expected-warning {{incomplete implementation}}
 - (id)initWithNextOutputStream:(id <DTOutputStreams>) outputStream {
   id <DTOutputStreams> nextOutputStream = [self nextOutputStream];
-  self = nextOutputStream; // expected-warning {{incompatible type assigning 'id<DTOutputStreams>', expected 'DTFilterOutputStream2 *'}}
+  self = nextOutputStream; // expected-warning {{assigning to 'DTFilterOutputStream2 *' from incompatible type 'id<DTOutputStreams>'}}
   return nextOutputStream ? nextOutputStream : self; // expected-warning {{incompatible operand types ('id<DTOutputStreams>' and 'DTFilterOutputStream2 *')}}
 }
 @end
@@ -36,7 +36,7 @@
 @implementation DTFilterOutputStream3 // expected-warning {{cannot find interface declaration for 'DTFilterOutputStream3'}}
 - (id)initWithNextOutputStream:(id <DTOutputStreams>) outputStream {
   id <DTOutputStreams> nextOutputStream = [self nextOutputStream]; // expected-warning {{method '-nextOutputStream' not found (return type defaults to 'id')}}
-  self = nextOutputStream; // expected-warning {{incompatible type assigning 'id<DTOutputStreams>', expected 'DTFilterOutputStream3 *'}}
+  self = nextOutputStream; // expected-warning {{assigning to 'DTFilterOutputStream3 *' from incompatible type 'id<DTOutputStreams>'}}
   return nextOutputStream ? nextOutputStream : self; // expected-warning {{incompatible operand types ('id<DTOutputStreams>' and 'DTFilterOutputStream3 *')}}
 }
 @end
diff --git a/test/SemaObjC/id.m b/test/SemaObjC/id.m
index 206127a..27b84de 100644
--- a/test/SemaObjC/id.m
+++ b/test/SemaObjC/id.m
@@ -9,8 +9,8 @@
   // Test assignment compatibility of Class and id.  No warning should be
   // produced.
   // rdar://6770142 - Class and id<foo> are compatible.
-  S = T; // expected-warning {{incompatible pointer types assigning 'Class', expected 'id<Foo>'}}
-  T = S; // expected-warning {{incompatible pointer types assigning 'id<Foo>', expected 'Class'}}
+  S = T; // expected-warning {{incompatible pointer types assigning to 'id<Foo>' from 'Class'}}
+  T = S; // expected-warning {{incompatible pointer types assigning to 'Class' from 'id<Foo>'}}
   R = T; T = R;
   R = S; S = R;
 }
diff --git a/test/SemaObjC/incompatible-protocol-qualified-types.m b/test/SemaObjC/incompatible-protocol-qualified-types.m
index 7eb540a..23cb50a 100644
--- a/test/SemaObjC/incompatible-protocol-qualified-types.m
+++ b/test/SemaObjC/incompatible-protocol-qualified-types.m
@@ -21,15 +21,15 @@
 
 INTF <MyProto1, MyProto2> * Func2(INTF <MyProto1> *p2)
 {
-	Func(p2);	// expected-warning {{incompatible pointer types passing 'INTF<MyProto1> *', expected 'INTF<MyProto1,MyProto2> *}}
-	return p2;	// expected-warning {{incompatible pointer types returning 'INTF<MyProto1> *', expected 'INTF<MyProto1,MyProto2> *}}
+	Func(p2);	// expected-warning {{incompatible pointer types passing 'INTF<MyProto1> *' to parameter of type 'INTF<MyProto1,MyProto2> *'}}
+	return p2;	// expected-warning {{incompatible pointer types returning 'INTF<MyProto1> *' from a function with result type 'INTF<MyProto1,MyProto2> *'}}
 }
 
 
 
 INTF <MyProto1> * Func3(INTF <MyProto2> *p2)
 {
-	return p2;	// expected-warning {{incompatible pointer types returning 'INTF<MyProto2> *', expected 'INTF<MyProto1> *}}
+	return p2;	// expected-warning {{incompatible pointer types returning 'INTF<MyProto2> *' from a function with result type 'INTF<MyProto1> *'}}
 }
 
 
diff --git a/test/SemaObjC/message.m b/test/SemaObjC/message.m
index 57b1097..fc4bfcc 100644
--- a/test/SemaObjC/message.m
+++ b/test/SemaObjC/message.m
@@ -87,7 +87,7 @@
 int test5(int X) {
   int a = [X somemsg];  // expected-warning {{receiver type 'int' is not 'id'}} \
                            expected-warning {{method '-somemsg' not found}} \
-                           expected-warning {{incompatible pointer to integer conversion initializing 'id', expected 'int'}}
+                           expected-warning {{incompatible pointer to integer conversion initializing 'int' from an expression of type 'id'}}
   int b = [S somemsg];  // expected-error {{bad receiver type 'struct S'}}
 }
 
diff --git a/test/SemaObjC/method-arg-qualifier-warning.m b/test/SemaObjC/method-arg-qualifier-warning.m
index 397f241..a064a7d 100644
--- a/test/SemaObjC/method-arg-qualifier-warning.m
+++ b/test/SemaObjC/method-arg-qualifier-warning.m
@@ -12,8 +12,8 @@
 
 int main () {
         
-    [@"Identifier1" isEqualToString:Identifier1]; // expected-warning {{sending 'NSString const *' discards qualifiers, expected 'NSString *'}}
-    [@"Identifier2" isEqualToString:Identifier2]; // expected-warning {{sending 'NSString const *' discards qualifiers, expected 'NSString *'}}
+    [@"Identifier1" isEqualToString:Identifier1]; // expected-warning {{sending 'NSString const *' to parameter of type 'NSString *' discards qualifiers}}
+    [@"Identifier2" isEqualToString:Identifier2]; // expected-warning {{sending 'NSString const *' to parameter of type 'NSString *' discards qualifiers}}
     [@"Identifier3" isEqualToString:Identifier3];
     return 0;
 }
diff --git a/test/SemaObjC/protocol-id-test-3.m b/test/SemaObjC/protocol-id-test-3.m
index 3538b0e..89f11c3 100644
--- a/test/SemaObjC/protocol-id-test-3.m
+++ b/test/SemaObjC/protocol-id-test-3.m
@@ -29,15 +29,15 @@
 
 id<MyProto1, MyProto2> Gunc2(id <MyProto1>p2)
 {
-	Func(p2);	// expected-warning {{incompatible type passing 'id<MyProto1>', expected 'INTF<MyProto1,MyProto2> *'}}
-	return p2;	// expected-warning {{incompatible type returning 'id<MyProto1>', expected 'id<MyProto1,MyProto2>'}}
+	Func(p2);	// expected-warning {{passing 'id<MyProto1>' to parameter of incompatible type 'INTF<MyProto1,MyProto2> *'}}
+	return p2;	// expected-warning {{returning 'id<MyProto1>' from a function with incompatible result type 'id<MyProto1,MyProto2>'}}
 }
 
 
 
 id<MyProto1> Gunc3(id <MyProto2>p2)
 {
-	return p2;	 // expected-warning {{incompatible type returning 'id<MyProto2>', expected 'id<MyProto1>'}}
+	return p2;	 // expected-warning {{returning 'id<MyProto2>' from a function with incompatible result type 'id<MyProto1>'}}
 }
 
 
@@ -61,13 +61,13 @@
 
 INTF<MyProto1, MyProto2> * Hunc2(id <MyProto1>p2)
 {
-	Func(p2);	// expected-warning {{incompatible type passing 'id<MyProto1>', expected 'INTF<MyProto1,MyProto2> *'}}
-	return p2;	// expected-warning {{incompatible type returning 'id<MyProto1>', expected 'INTF<MyProto1,MyProto2> *'}}
+	Func(p2);	// expected-warning {{passing 'id<MyProto1>' to parameter of incompatible type 'INTF<MyProto1,MyProto2> *'}}
+	return p2;	// expected-warning {{returning 'id<MyProto1>' from a function with incompatible result type 'INTF<MyProto1,MyProto2> *'}}
 }
 
 INTF<MyProto1> * Hunc3(id <MyProto2>p2)
 {
-	return p2;	 // expected-warning {{incompatible type returning 'id<MyProto2>', expected 'INTF<MyProto1> *'}}
+	return p2;	 // expected-warning {{returning 'id<MyProto2>' from a function with incompatible result type 'INTF<MyProto1> *'}}
 }
 
 
diff --git a/test/SemaObjC/protocol-typecheck.m b/test/SemaObjC/protocol-typecheck.m
index d9cde87..3d98df8 100644
--- a/test/SemaObjC/protocol-typecheck.m
+++ b/test/SemaObjC/protocol-typecheck.m
@@ -20,6 +20,6 @@
   [obj setFlexElement:flexer];
   // FIXME: GCC provides the following diagnostic (which is much better):
   // protocol-typecheck.m:21: warning: class 'NSObject <PWhatever, XCElementP>' does not implement the 'XCElementSpacerP' protocol
-  [obj setFlexElement2:flexer2]; // expected-warning{{incompatible pointer types sending 'NSObject<PWhatever,XCElementP> *', expected 'NSObject<PWhatever,XCElementSpacerP> *'}}
+  [obj setFlexElement2:flexer2]; // expected-warning{{incompatible pointer types sending 'NSObject<PWhatever,XCElementP> *' to parameter of type 'NSObject<PWhatever,XCElementSpacerP> *'}}
 }
 
diff --git a/test/SemaObjC/protocol-warn.m b/test/SemaObjC/protocol-warn.m
index d0c51e3..2d04238 100644
--- a/test/SemaObjC/protocol-warn.m
+++ b/test/SemaObjC/protocol-warn.m
@@ -51,5 +51,5 @@
 {
     UIWebBrowserView *browserView;
     UIWebPDFView *pdfView;
-    return pdfView ? pdfView : browserView; // expected-warning {{incompatible pointer types returning 'UIView<NSObject> *', expected 'UIWebPDFView *'}}
+    return pdfView ? pdfView : browserView; // expected-warning {{incompatible pointer types returning 'UIView<NSObject> *' from a function with result type 'UIWebPDFView *'}}
 }
diff --git a/test/SemaObjC/warn-incompatible-builtin-types.m b/test/SemaObjC/warn-incompatible-builtin-types.m
index 2a5005a..8806d63 100644
--- a/test/SemaObjC/warn-incompatible-builtin-types.m
+++ b/test/SemaObjC/warn-incompatible-builtin-types.m
@@ -10,8 +10,8 @@
     SEL s1, s2;
     id i, i1;
     Foo *f;
-    [f foo:f];	// expected-warning {{incompatible pointer types sending 'Foo *', expected 'Class'}}
-    c = f;	// expected-warning {{incompatible pointer types assigning 'Foo *', expected 'Class'}}
+    [f foo:f];	// expected-warning {{incompatible pointer types sending 'Foo *' to parameter of type 'Class'}}
+    c = f;	// expected-warning {{incompatible pointer types assigning to 'Class' from 'Foo *'}}
 
     c = i;
 
@@ -21,22 +21,22 @@
 
     i = i1;
 
-    s1 = i;	// expected-warning {{incompatible pointer types assigning 'id', expected 'SEL'}}
-    i = s1;	// expected-warning {{incompatible pointer types assigning 'SEL', expected 'id'}}
+    s1 = i;	// expected-warning {{incompatible pointer types assigning to 'SEL' from 'id'}}
+    i = s1;	// expected-warning {{incompatible pointer types assigning to 'id' from 'SEL'}}
 
     s1 = s2;
 
-    s1 = c;	// expected-warning {{incompatible pointer types assigning 'Class', expected 'SEL'}}
+    s1 = c;	// expected-warning {{incompatible pointer types assigning to 'SEL' from 'Class'}}
 
-    c = s1;	// expected-warning {{incompatible pointer types assigning 'SEL', expected 'Class'}}
+    c = s1;	// expected-warning {{incompatible pointer types assigning to 'Class' from 'SEL'}}
 
     f = i;
 
-    f = c;	// expected-warning {{incompatible pointer types assigning 'Class', expected 'Foo *'}}
+    f = c;	// expected-warning {{incompatible pointer types assigning to 'Foo *' from 'Class'}}
 
-    f = s1;	// expected-warning {{incompatible pointer types assigning 'SEL', expected 'Foo *'}}
+    f = s1;	// expected-warning {{incompatible pointer types assigning to 'Foo *' from 'SEL'}}
 
     i = f;
 
-    s1 = f; 	// expected-warning {{incompatible pointer types assigning 'Foo *', expected 'SEL'}}
+    s1 = f; 	// expected-warning {{incompatible pointer types assigning to 'SEL' from 'Foo *'}}
 }
diff --git a/test/SemaObjC/warn-write-strings.m b/test/SemaObjC/warn-write-strings.m
index 938f0be..c0b7741 100644
--- a/test/SemaObjC/warn-write-strings.m
+++ b/test/SemaObjC/warn-write-strings.m
@@ -1,4 +1,4 @@
 // RUN: %clang_cc1 -verify -fsyntax-only -Wwrite-strings %s
 
 // PR4804
-char* x = "foo"; // expected-warning {{initializing 'char const [4]' discards qualifiers, expected 'char *'}}
+char* x = "foo"; // expected-warning {{initializing 'char *' from an expression of type 'char const [4]' discards qualifiers}}