Centralize error reporting of improper uses of incomplete types in the
new DiagnoseIncompleteType. It provides additional information about
struct/class/union/enum types when possible, either by pointing to the
forward declaration of that type or by pointing to the definition (if
we're in the process of defining that type). 
Fixes <rdar://problem/6500531>.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@62521 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/pointer-addition.c b/test/Sema/pointer-addition.c
index f2fb973..95f364f 100644
--- a/test/Sema/pointer-addition.c
+++ b/test/Sema/pointer-addition.c
@@ -1,6 +1,6 @@
 // RUN: clang %s -fsyntax-only -verify -pedantic
 
-typedef struct S S;
+typedef struct S S; // expected-note{{forward declaration of 'struct S'}}
 void a(S* b, void* c) {
   b++;       // expected-error {{arithmetic on pointer to incomplete type}}
   b += 1;    // expected-error {{arithmetic on pointer to incomplete type}}
@@ -9,6 +9,6 @@
   b = 1+b;   // expected-error {{arithmetic on pointer to incomplete type}}
   /* The next couple tests are only pedantic warnings in gcc */
   void (*d)(S*,void*) = a;
-  d += 1;    // expected-error {{pointer to incomplete type}}
-  d++;       // expected-error {{pointer to incomplete type}}
+  d += 1;    // expected-error {{arithmetic on pointer to function type}}}
+  d++;       // expected-error {{arithmetic on pointer to function type}}}
 }