This is a pretty big cleanup for how invalid decl/type are handle.
This gets rid of a bunch of random InvalidDecl bools in sema, changing
us to use the following approach:

1. When analyzing a declspec or declarator, if an error is found, we 
   set a bit in Declarator saying that it is invalid.
2. Once the Decl is created by sema, we immediately set the isInvalid
   bit on it from what is in the declarator.  From this point on, sema
   consistently looks at and sets the bit on the decl.

This gives a very clear separation of concerns and simplifies a bunch
of code.  In addition to this, this patch makes these changes:

1. it renames DeclSpec::getInvalidType() -> isInvalidType().
2. various "merge" functions no longer return bools: they just set the
   invalid bit on the dest decl if invalid.
3. The ActOnTypedefDeclarator/ActOnFunctionDeclarator/ActOnVariableDeclarator
   methods now set invalid on the decl returned instead of returning an
   invalid bit byref.
4. In SemaType, refering to a typedef that was invalid now propagates the
   bit into the resultant type.  Stuff declared with the invalid typedef
   will now be marked invalid.
5. Various methods like CheckVariableDeclaration now return void and set the
   invalid bit on the decl they check.


There are a few minor changes to tests with this, but the only major bad
result is test/SemaCXX/constructor-recovery.cpp.  I'll take a look at this
next.




git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@70020 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/test/Sema/invalid-decl.c b/test/Sema/invalid-decl.c
index e9130c8..8c45800 100644
--- a/test/Sema/invalid-decl.c
+++ b/test/Sema/invalid-decl.c
@@ -6,11 +6,14 @@
 
 
 // PR2400
-typedef xtype (*zend_stream_fsizer_t)(void* handle); // expected-error {{function cannot return array or function type}} expected-warning {{type specifier missing, defaults to 'int'}} expected-warning {{type specifier missing, defaults to 'int'}}
+typedef xtype (*x)(void* handle); // expected-error {{function cannot return array or function type}} expected-warning {{type specifier missing, defaults to 'int'}} expected-warning {{type specifier missing, defaults to 'int'}}
+
+typedef void ytype();
+
 
 typedef struct _zend_module_entry zend_module_entry;
 struct _zend_module_entry {
-    xtype globals_size; // expected-error {{field 'globals_size' declared as a function}}
+    ytype globals_size; // expected-error {{field 'globals_size' declared as a function}}
 };
 
 zend_module_entry openssl_module_entry = {
diff --git a/test/Sema/tentative-decls.c b/test/Sema/tentative-decls.c
index 85b5ed7..e3c893c 100644
--- a/test/Sema/tentative-decls.c
+++ b/test/Sema/tentative-decls.c
@@ -23,8 +23,8 @@
 int i1 = 2; // expected-error {{redefinition of 'i1'}}
 int i1;
 int i1;
-extern int i1; // expected-note {{previous definition is here}}
-static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}}
+extern int i5; // expected-note {{previous definition is here}}
+static int i5; // expected-error{{static declaration of 'i5' follows non-static declaration}}
 
 static int i2 = 5; // expected-note 1 {{previous definition is here}}
 int i2 = 3; // expected-error{{non-static declaration of 'i2' follows static declaration}}
@@ -47,8 +47,8 @@
 int redef[11]; // expected-error{{redefinition of 'redef'}}
 
 void func() {
-  extern int i1; // expected-note {{previous definition is here}}
-  static int i1; // expected-error{{static declaration of 'i1' follows non-static declaration}}
+  extern int i6; // expected-note {{previous definition is here}}
+  static int i6; // expected-error{{static declaration of 'i6' follows non-static declaration}}
 }
 
 void func2(void)
diff --git a/test/SemaCXX/constructor-recovery.cpp b/test/SemaCXX/constructor-recovery.cpp
index f2f9f43..50fdc96 100644
--- a/test/SemaCXX/constructor-recovery.cpp
+++ b/test/SemaCXX/constructor-recovery.cpp
@@ -1,9 +1,10 @@
 // RUN: clang-cc -fsyntax-only -verify %s
 
-struct C {
-  virtual C() = 0; // expected-error{{constructor cannot be declared 'virtual'}}
+struct C {  // expected-note {{candidate function}}
+  virtual C() = 0; // expected-error{{constructor cannot be declared 'virtual'}} \
+                      expected-note {{candidate function}}
 };
 
 void f() {
- C c;
+ C c;  // expected-error {{call to constructor of 'c' is ambiguous}}
 }
diff --git a/test/SemaCXX/destructor.cpp b/test/SemaCXX/destructor.cpp
index 3ba5fd5..c60045b 100644
--- a/test/SemaCXX/destructor.cpp
+++ b/test/SemaCXX/destructor.cpp
@@ -23,6 +23,7 @@
     // expected-error{{destructor cannot be variadic}}
 };
 
+
 struct E;
 
 typedef E E_typedef;