r236882 - Revert "clang-format: Only output IncompleteFormat if -cursor is given."

Renato Golin renato.golin at linaro.org
Fri May 8 10:05:25 PDT 2015


Author: rengolin
Date: Fri May  8 12:05:24 2015
New Revision: 236882

URL: http://llvm.org/viewvc/llvm-project?rev=236882&view=rev
Log:
Revert "clang-format: Only output IncompleteFormat if -cursor is given."

This reverts commit r236867, as it was breaking multiple buildbots. Daniel
will look into it later.

Modified:
    cfe/trunk/test/Format/incomplete.cpp
    cfe/trunk/tools/clang-format/ClangFormat.cpp

Modified: cfe/trunk/test/Format/incomplete.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Format/incomplete.cpp?rev=236882&r1=236881&r2=236882&view=diff
==============================================================================
--- cfe/trunk/test/Format/incomplete.cpp (original)
+++ cfe/trunk/test/Format/incomplete.cpp Fri May  8 12:05:24 2015
@@ -1,7 +1,7 @@
 // RUN: grep -Ev "// *[A-Z-]+:" %s > %t2.cpp
 // RUN: clang-format -style=LLVM %t2.cpp > %t.cpp
-// RUN: FileCheck -strict-whitespace -cursor=0 -input-file=%t.cpp %s
-// CHECK: {{"IncompleteFormat": true}}
+// RUN: FileCheck -strict-whitespace -input-file=%t.cpp %s
+// CHECK: {{^\{ "IncompleteFormat": true }}
 // CHECK: {{^int\ \i;$}}
  int    i;
 // CHECK: {{^f  \( g  \(;$}}

Modified: cfe/trunk/tools/clang-format/ClangFormat.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/clang-format/ClangFormat.cpp?rev=236882&r1=236881&r2=236882&view=diff
==============================================================================
--- cfe/trunk/tools/clang-format/ClangFormat.cpp (original)
+++ cfe/trunk/tools/clang-format/ClangFormat.cpp Fri May  8 12:05:24 2015
@@ -226,8 +226,7 @@ static bool format(StringRef FileName) {
   FormatStyle FormatStyle = getStyle(
       Style, (FileName == "-") ? AssumeFilename : FileName, FallbackStyle);
   bool IncompleteFormat = false;
-  tooling::Replacements Replaces =
-      reformat(FormatStyle, Sources, ID, Ranges, &IncompleteFormat);
+  tooling::Replacements Replaces = reformat(FormatStyle, Sources, ID, Ranges, &IncompleteFormat);
   if (OutputXML) {
     llvm::outs() << "<?xml version='1.0'?>\n<replacements "
                     "xml:space='preserve' incomplete_format='"
@@ -256,11 +255,12 @@ static bool format(StringRef FileName) {
       else if (Rewrite.overwriteChangedFiles())
         return true;
     } else {
+      outs() << "{";
       if (Cursor.getNumOccurrences() != 0)
-        outs() << "{ \"Cursor\": "
-               << tooling::shiftedCodePosition(Replaces, Cursor)
-               << ", \"IncompleteFormat\": "
-               << (IncompleteFormat ? "true" : "false") << " }\n";
+        outs() << " \"Cursor\": "
+               << tooling::shiftedCodePosition(Replaces, Cursor) << ",";
+      outs() << " \"IncompleteFormat\": "
+             << (IncompleteFormat ? "true" : "false") << " }\n";
       Rewrite.getEditBuffer(ID).write(outs());
     }
   }





More information about the cfe-commits mailing list