A bunch-o changes to fix <rdar://problem/5716046> incomplete implementation of ObjC class warning is incomplete

As part of this fix, I made a low-level change to the text diagnostics machinery (to basically avoid printing duplicate source lines/carets when you have multiple diagnostics that refer to the same exact place). For now, this only happens with we don't have a source range (could be extended to support source ranges as well). 


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@46897 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/method-undef-category-warn-1.m b/test/Sema/method-undef-category-warn-1.m
index af5a0e2..792c24d 100644
--- a/test/Sema/method-undef-category-warn-1.m
+++ b/test/Sema/method-undef-category-warn-1.m
@@ -4,23 +4,27 @@
 @end
 
 @protocol P
-- (void) Pmeth;	// expected-warning {{method definition for 'Pmeth' not found}}
-- (void) Pmeth1; // expected-warning {{method definition for 'Pmeth1' not found}}
+- (void) Pmeth;	
+- (void) Pmeth1;  
 @end
 
 @interface MyClass1(CAT) <P>
-- (void) meth2;	// expected-warning {{method definition for 'meth2' not found}}
+- (void) meth2;	
 @end
 
-@implementation MyClass1(CAT) // expected-warning {{incomplete implementation of category 'CAT'}}
+@implementation MyClass1(CAT) // expected-warning {{incomplete implementation}} \
+                                 expected-warning {{method definition for 'meth2' not found}} \
+                                 expected-warning {{method definition for 'Pmeth' not found}}
 - (void) Pmeth1{}
 @end
 
 @interface MyClass1(DOG) <P>
-- (void)ppp;  // expected-warning {{method definition for 'ppp' not found}}
+- (void)ppp;   
 @end
 
-@implementation MyClass1(DOG) // expected-warning {{incomplete implementation of category 'DOG'}}
+@implementation MyClass1(DOG) // expected-warning {{incomplete implementation}} \
+                                 expected-warning {{method definition for 'ppp' not found}} \
+                                 expected-warning {{method definition for 'Pmeth1' not found}}
 - (void) Pmeth {}
 @end
 
diff --git a/test/Sema/method-undefined-warn-1.m b/test/Sema/method-undefined-warn-1.m
index 0e4e6a1..9e646f8 100644
--- a/test/Sema/method-undefined-warn-1.m
+++ b/test/Sema/method-undefined-warn-1.m
@@ -3,12 +3,12 @@
 @interface INTF
 - (void) meth;
 - (void) meth : (int) arg1;
-- (int)  int_meth;	// expected-warning {{method definition for 'int_meth' not found}}
-+ (int) cls_meth;	// expected-warning {{method definition for 'cls_meth' not found}}
-+ (void) cls_meth1 : (int) arg1; // expected-warning {{method definition for 'cls_meth1:' not found}}
+- (int)  int_meth; 
++ (int) cls_meth;
++ (void) cls_meth1 : (int) arg1; 
 @end
 
-@implementation INTF 	// expected-warning {{incomplete implementation of class 'INTF'}}
+@implementation INTF 	// expected-warning {{incomplete implementation}} expected-warning {{method definition for 'int_meth' not found}} expected-warning {{method definition for 'cls_meth' not found}} expected-warning {{method definition for 'cls_meth1:' not found}}
 - (void) meth {}
 - (void) meth : (int) arg2{}
 - (void) cls_meth1 : (int) arg2{}
@@ -17,12 +17,12 @@
 @interface INTF1
 - (void) meth;
 - (void) meth : (int) arg1;
-- (int)  int_meth;      // expected-warning {{method definition for 'int_meth' not found}}
-+ (int) cls_meth;       // expected-warning {{method definition for 'cls_meth' not found}}
-+ (void) cls_meth1 : (int) arg1; // expected-warning {{method definition for 'cls_meth1:' not found}}
+- (int)  int_meth;      
++ (int) cls_meth;       
++ (void) cls_meth1 : (int) arg1; 
 @end
 
-@implementation INTF1 // expected-warning {{incomplete implementation of class 'INTF1'}}
+@implementation INTF1 // expected-warning {{incomplete implementation}} expected-warning {{method definition for 'int_meth' not found}} expected-warning {{method definition for 'cls_meth' not found}} expected-warning {{method definition for 'cls_meth1:' not found}}
 - (void) meth {}
 - (void) meth : (int) arg2{}
 - (void) cls_meth1 : (int) arg2{}
diff --git a/test/Sema/undef-protocol-methods-1.m b/test/Sema/undef-protocol-methods-1.m
index 748b151..9ad3593 100644
--- a/test/Sema/undef-protocol-methods-1.m
+++ b/test/Sema/undef-protocol-methods-1.m
@@ -1,31 +1,40 @@
 // RUN: clang -fsyntax-only -verify %s
 
 @protocol P1
-- (void) P1proto; // expected-warning {{method definition for 'P1proto' not found}}
-+ (void) ClsP1Proto; // expected-warning {{method definition for 'ClsP1Proto' not found}}
+- (void) P1proto;
++ (void) ClsP1Proto;  
 - (void) DefP1proto;
 @end
 @protocol P2
-- (void) P2proto;  // expected-warning {{method definition for 'P2proto' not found}}
-+ (void) ClsP2Proto; // expected-warning {{method definition for 'ClsP2Proto' not found}}
+- (void) P2proto;  
++ (void) ClsP2Proto; 
 @end
 
 @protocol P3<P2>
-- (void) P3proto; // expected-warning {{method definition for 'P3proto' not found}}
-+ (void) ClsP3Proto; // expected-warning {{method definition for 'ClsP3Proto' not found}}
+- (void) P3proto; 
++ (void) ClsP3Proto; 
 + (void) DefClsP3Proto;
 @end
 
 @protocol PROTO<P1, P3>
-- (void) meth;			// expected-warning {{method definition for 'meth' not found}}
-- (void) meth : (int) arg1;	// expected-warning {{method definition for 'meth:' not found}}
-+ (void) cls_meth : (int) arg1; // expected-warning {{method definition for 'cls_meth:' not found}}
+- (void) meth;		
+- (void) meth : (int) arg1; 
++ (void) cls_meth : (int) arg1; 
 @end
 
 @interface INTF <PROTO>
 @end
 
-@implementation INTF   // expected-warning {{incomplete implementation of class 'INTF'}}
+@implementation INTF   // expected-warning {{incomplete implementation}} \
+                          expected-warning {{method definition for 'meth' not found}} \
+                          expected-warning {{method definition for 'meth:' not found}} \
+                          expected-warning {{method definition for 'cls_meth:' not found}} \
+                          expected-warning {{method definition for 'P3proto' not found}} \
+                          expected-warning {{method definition for 'ClsP3Proto' not found}} \
+                          expected-warning {{method definition for 'P2proto' not found}} \
+                          expected-warning {{method definition for 'ClsP2Proto' not found}} \
+                          expected-warning {{method definition for 'ClsP1Proto' not found}} \
+                          expected-warning {{method definition for 'P1proto' not found}}
 - (void) DefP1proto{}
 
 + (void) DefClsP3Proto{}