]> granicus.if.org Git - clang/commitdiff
Revert "clang-format: Only output IncompleteFormat if -cursor is given."
authorRenato Golin <renato.golin@linaro.org>
Fri, 8 May 2015 17:05:24 +0000 (17:05 +0000)
committerRenato Golin <renato.golin@linaro.org>
Fri, 8 May 2015 17:05:24 +0000 (17:05 +0000)
This reverts commit r236867, as it was breaking multiple buildbots. Daniel
will look into it later.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236882 91177308-0d34-0410-b5e6-96231b3b80d8

test/Format/incomplete.cpp
tools/clang-format/ClangFormat.cpp

index b66d5f816ea875c61c8236d7efafac353c29450a..ade38b66a393c2a89c53cabf422771ace3faf9df 100644 (file)
@@ -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  \(;$}}
index 5037e901f3b41c42c59d181d7db866d3e8bfba77..ae2180c8370d72141079aa6a7c0322204ee4e32c 100644 (file)
@@ -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());
     }
   }