Omnibus friend decl refactoring.  Instead of cloning AST classes for friend
declarations of same, introduce a single AST class and add appropriate bits
(encoded in the namespace) for whether a decl is "real" or not.  Much hackery
about previously-declared / not-previously-declared, but it's essentially
mandated by the standard that friends alter lookup, and this is at least
fairly non-intrusive.

Refactor the Sema methods specific to friends for cleaner flow and less nesting.

Incidentally solve a few bugs, but I remain confident that we can put them back.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@80353 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 905b2e9..c592242 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -2143,6 +2143,9 @@
   virtual DeclPtrTy ActOnFriendDecl(Scope *S,
                           llvm::PointerUnion<const DeclSpec*,Declarator*> D,
                                     bool IsDefinition);
+  DeclPtrTy ActOnFriendTypeDecl(Scope *S, const DeclSpec& DS,
+                                bool IsDefinition);
+  DeclPtrTy ActOnFriendFunctionDecl(Scope *S, Declarator& D, bool IsDefinition);
 
   QualType CheckConstructorDeclarator(Declarator &D, QualType R,
                                       FunctionDecl::StorageClass& SC);
@@ -2955,6 +2958,7 @@
                                      bool Recursive = false);
 
   NamedDecl *FindInstantiatedDecl(NamedDecl *D);
+  DeclContext *FindInstantiatedContext(DeclContext *DC);
     
   // Objective-C declarations.
   virtual DeclPtrTy ActOnStartClassInterface(SourceLocation AtInterfaceLoc,