Fix the following bug submitted by Ted Kremenek:

void func() {
int xx = xx; // incorrectly diagnosed 'xx' as an undeclared identifier.
}

This smallish bug resulted in a largish fix. Here are some highlights:

- Needed to make sure ParseDeclarator is called *before* parsing any
initializer. Removed the "Init" argument to ParseDeclarator.
- Added AddInitializerToDecl() to the Action & Sema classes.
In Sema, this hook is responsible for validating the initializer and
installing it into the respective decl.
- Moved several semantic checks from ParseDeclarator() to 
FinalizeDeclaratorGroup(). Previously, this hook was only responsible for 
reversing a list. Now it plays a much larger semantic role. 

All of the above changes ended up simplifying ParseDeclarator(), which
is goodness...



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41877 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Sema/Sema.h b/Sema/Sema.h
index 2be727a..b6fe89a 100644
--- a/Sema/Sema.h
+++ b/Sema/Sema.h
@@ -137,8 +137,8 @@
   // Symbol table / Decl tracking callbacks: SemaDecl.cpp.
   //
   virtual DeclTy *isTypeName(const IdentifierInfo &II, Scope *S) const;
-  virtual DeclTy *ParseDeclarator(Scope *S, Declarator &D, ExprTy *Init,
-                                  DeclTy *LastInGroup);
+  virtual DeclTy *ParseDeclarator(Scope *S, Declarator &D, DeclTy *LastInGroup);
+  void AddInitializerToDecl(DeclTy *dcl, ExprTy *init);
   virtual DeclTy *FinalizeDeclaratorGroup(Scope *S, DeclTy *Group);
 
   virtual DeclTy *ParseStartOfFunctionDef(Scope *S, Declarator &D);
@@ -361,7 +361,7 @@
   virtual void ObjcAddMethodsToClass(DeclTy *ClassDecl, 
 				     DeclTy **allMethods, unsigned allNum);
                                       
-  virtual void ObjcAddInstanceVariable(DeclTy *ClassDec, DeclTy *Ivars,
+  virtual void ObjcAddInstanceVariable(DeclTy *ClassDec, DeclTy *Ivar,
                                        tok::ObjCKeywordKind visibility);
 private:
   // UsualUnaryConversions - promotes integers (C99 6.3.1.1p2) and converts