Restore r121752 without modification.



git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@121763 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/SemaExprCXX.cpp b/lib/Sema/SemaExprCXX.cpp
index 41a3429..76fcaea 100644
--- a/lib/Sema/SemaExprCXX.cpp
+++ b/lib/Sema/SemaExprCXX.cpp
@@ -1074,21 +1074,24 @@
     // To perform this comparison, we compute the function type that
     // the deallocation function should have, and use that type both
     // for template argument deduction and for comparison purposes.
+    //
+    // FIXME: this comparison should ignore CC and the like.
     QualType ExpectedFunctionType;
     {
       const FunctionProtoType *Proto
         = OperatorNew->getType()->getAs<FunctionProtoType>();
+
       llvm::SmallVector<QualType, 4> ArgTypes;
       ArgTypes.push_back(Context.VoidPtrTy); 
       for (unsigned I = 1, N = Proto->getNumArgs(); I < N; ++I)
         ArgTypes.push_back(Proto->getArgType(I));
 
+      FunctionProtoType::ExtProtoInfo EPI;
+      EPI.Variadic = Proto->isVariadic();
+
       ExpectedFunctionType
         = Context.getFunctionType(Context.VoidTy, ArgTypes.data(),
-                                  ArgTypes.size(),
-                                  Proto->isVariadic(),
-                                  0, false, false, 0, 0,
-                                  FunctionType::ExtInfo());
+                                  ArgTypes.size(), EPI);
     }
 
     for (LookupResult::iterator D = FoundDelete.begin(), 
@@ -1340,12 +1343,15 @@
     assert(StdBadAlloc && "Must have std::bad_alloc declared");
     BadAllocType = Context.getTypeDeclType(getStdBadAlloc());
   }
+
+  FunctionProtoType::ExtProtoInfo EPI;
+  EPI.HasExceptionSpec = true;
+  if (HasBadAllocExceptionSpec) {
+    EPI.NumExceptions = 1;
+    EPI.Exceptions = &BadAllocType;
+  }
   
-  QualType FnType = Context.getFunctionType(Return, &Argument, 1, false, 0,
-                                            true, false,
-                                            HasBadAllocExceptionSpec? 1 : 0,
-                                            &BadAllocType,
-                                            FunctionType::ExtInfo());
+  QualType FnType = Context.getFunctionType(Return, &Argument, 1, EPI);
   FunctionDecl *Alloc =
     FunctionDecl::Create(Context, GlobalCtx, SourceLocation(), Name,
                          FnType, /*TInfo=*/0, SC_None,