Implementation of new and delete parsing and sema.
This version uses VLAs to represent arrays. I'll try an alternative way next, but I want this safe first.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59835 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Sema/Sema.h b/lib/Sema/Sema.h
index ba647ca..d569994 100644
--- a/lib/Sema/Sema.h
+++ b/lib/Sema/Sema.h
@@ -238,14 +238,16 @@
   //
   QualType ConvertDeclSpecToType(const DeclSpec &DS);
   void ProcessTypeAttributeList(QualType &Result, const AttributeList *AL);
-  QualType GetTypeForDeclarator(Declarator &D, Scope *S);
+  QualType GetTypeForDeclarator(Declarator &D, Scope *S,
+                                bool CXXNewMode = false);
   DeclarationName GetNameForDeclarator(Declarator &D);
 
   QualType ObjCGetTypeForMethodDefinition(DeclTy *D);
 
   bool UnwrapSimilarPointerTypes(QualType& T1, QualType& T2);
 
-  virtual TypeResult ActOnTypeName(Scope *S, Declarator &D);
+  virtual TypeResult ActOnTypeName(Scope *S, Declarator &D,
+                                   bool CXXNewMode = false);
 
   //===--------------------------------------------------------------------===//
   // Symbol table / Decl tracking callbacks: SemaDecl.cpp.
@@ -805,6 +807,23 @@
                                                SourceLocation *CommaLocs,
                                                SourceLocation RParenLoc);
 
+  /// ActOnCXXNew - Parsed a C++ 'new' expression.
+  virtual ExprResult ActOnCXXNew(SourceLocation StartLoc, bool UseGlobal,
+                                 SourceLocation PlacementLParen,
+                                 ExprTy **PlacementArgs, unsigned NumPlaceArgs,
+                                 SourceLocation PlacementRParen,
+                                 bool ParenTypeId, SourceLocation TyStart,
+                                 TypeTy *Ty, SourceLocation TyEnd,
+                                 SourceLocation ConstructorLParen,
+                                 ExprTy **ConstructorArgs, unsigned NumConsArgs,
+                                 SourceLocation ConstructorRParen);
+  bool CheckAllocatedType(QualType AllocType, SourceLocation StartLoc,
+                          const SourceRange &TyR);
+
+  /// ActOnCXXDelete - Parsed a C++ 'delete' expression
+  virtual ExprResult ActOnCXXDelete(SourceLocation StartLoc, bool UseGlobal,
+                                    bool ArrayForm, ExprTy *Operand);
+
   /// ActOnCXXConditionDeclarationExpr - Parsed a condition declaration of a
   /// C++ if/switch/while/for statement.
   /// e.g: "if (int x = f()) {...}"