Correct spacing around new and delete.

This fixes llvm.org/PR14913.

Before:  A *a = new(placement) A;
After:   A *a = new (placement) A;

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@172212 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 56bb6ec..38d39bc 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -1063,7 +1063,8 @@
       return CurrentLineType == LT_ObjCDecl || Left.is(tok::kw_if) ||
              Left.is(tok::kw_for) || Left.is(tok::kw_while) ||
              Left.is(tok::kw_switch) || Left.is(tok::kw_return) ||
-             Left.is(tok::kw_catch);
+             Left.is(tok::kw_catch) || Left.is(tok::kw_new) ||
+             Left.is(tok::kw_delete);
     }
     if (Left.is(tok::at) &&
         Right.FormatTok.Tok.getObjCKeywordID() != tok::objc_not_keyword)
diff --git a/unittests/Format/FormatTest.cpp b/unittests/Format/FormatTest.cpp
index 47e6bdd..cb634fc 100644
--- a/unittests/Format/FormatTest.cpp
+++ b/unittests/Format/FormatTest.cpp
@@ -980,6 +980,13 @@
   verifyFormat("void operator delete[](void *ptr);");
 }
 
+TEST_F(FormatTest, UnderstandsNewAndDelete) {
+  verifyFormat("A *a = new A;");
+  verifyFormat("A *a = new (placement) A;");
+  verifyFormat("delete a;");
+  verifyFormat("delete (A *)a;");
+}
+
 TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
   verifyFormat("int *f(int *a) {}");
   verifyFormat("f(a, *a);");