Fix bug 20892 - clang-format does not handle C-style comments

Summary:
http://llvm.org/bugs/show_bug.cgi?id=20892

Add support of C-style formatting enabling/disabling directives. Now the following two styles are supported:

  // clang-format on
  /* clang-format on */

The flexibility in comments (support of extra spaces and/or slashes, etc.) is deliberately avoided to simplify search in large code bases.

Reviewers: djasper

Reviewed By: djasper

Subscribers: cfe-commits, curdeius, klimek

Differential Revision: http://reviews.llvm.org/D5309

llvm-svn: 217588
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index 8b8aaf1..f8e3183 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -9355,6 +9355,16 @@
                    "  int j;\n"
                    " // clang-format on\n"
                    "   int   k;"));
+  EXPECT_EQ("int i;\n"
+            "/* clang-format off */\n"
+            "  int j;\n"
+            "/* clang-format on */\n"
+            "int k;",
+            format(" int  i;\n"
+                   "   /* clang-format off */\n"
+                   "  int j;\n"
+                   " /* clang-format on */\n"
+                   "   int   k;"));
 }
 
 TEST_F(FormatTest, DoNotCrashOnInvalidInput) {