diff options
author | Renato Golin <renato.golin@linaro.org> | 2015-05-08 17:05:24 +0000 |
---|---|---|
committer | Renato Golin <renato.golin@linaro.org> | 2015-05-08 17:05:24 +0000 |
commit | 82fbfe684ed054523393dda26dd48077452fd2ea (patch) | |
tree | d7cb84bb3f69c0e08100776e74d6aad4e6b7446f | |
parent | eaef4bcd406952c84f26e7ebeab3bb25db75e144 (diff) | |
download | bcm5719-llvm-82fbfe684ed054523393dda26dd48077452fd2ea.tar.gz bcm5719-llvm-82fbfe684ed054523393dda26dd48077452fd2ea.zip |
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.
llvm-svn: 236882
-rw-r--r-- | clang/test/Format/incomplete.cpp | 4 | ||||
-rw-r--r-- | clang/tools/clang-format/ClangFormat.cpp | 12 |
2 files changed, 8 insertions, 8 deletions
diff --git a/clang/test/Format/incomplete.cpp b/clang/test/Format/incomplete.cpp index b66d5f816ea..ade38b66a39 100644 --- a/clang/test/Format/incomplete.cpp +++ b/clang/test/Format/incomplete.cpp @@ -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 \(;$}} diff --git a/clang/tools/clang-format/ClangFormat.cpp b/clang/tools/clang-format/ClangFormat.cpp index 5037e901f3b..ae2180c8370 100644 --- a/clang/tools/clang-format/ClangFormat.cpp +++ b/clang/tools/clang-format/ClangFormat.cpp @@ -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()); } } |