Parse deleted function definitions and hook them up to Doug's machinery.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67653 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index 90ef136..46df1c7 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -363,6 +363,7 @@
   virtual void AddInitializerToDecl(DeclTy *dcl, ExprArg init);
   void AddInitializerToDecl(DeclTy *dcl, ExprArg init, bool DirectInit);
   void ActOnUninitializedDecl(DeclTy *dcl);
+  virtual void SetDeclDeleted(DeclTy *dcl, SourceLocation DelLoc);
   virtual DeclTy *FinalizeDeclaratorGroup(Scope *S, DeclTy *Group);
 
   virtual void ActOnFinishKNRParamDeclarations(Scope *S, Declarator &D);
diff --git a/lib/Sema/SemaDeclCXX.cpp b/lib/Sema/SemaDeclCXX.cpp
index af71e71..a85d62b 100644
--- a/lib/Sema/SemaDeclCXX.cpp
+++ b/lib/Sema/SemaDeclCXX.cpp
@@ -2501,3 +2501,19 @@
   CurContext->addDecl(Decl);
   return Decl;
 }
+
+void Sema::SetDeclDeleted(DeclTy *dcl, SourceLocation DelLoc) {
+  Decl *Dcl = static_cast<Decl*>(dcl);
+  FunctionDecl *Fn = dyn_cast<FunctionDecl>(Dcl);
+  if (!Fn) {
+    Diag(DelLoc, diag::err_deleted_non_function);
+    return;
+  }
+  if (const FunctionDecl *Prev = Fn->getPreviousDeclaration()) {
+    Diag(DelLoc, diag::err_deleted_decl_not_first);
+    Diag(Prev->getLocation(), diag::note_previous_declaration);
+    // If the declaration wasn't the first, we delete the function anyway for
+    // recovery.
+  }
+  Fn->setDeleted();
+}