diff options
author | Daniel Jasper <djasper@google.com> | 2015-05-08 15:36:30 +0000 |
---|---|---|
committer | Daniel Jasper <djasper@google.com> | 2015-05-08 15:36:30 +0000 |
commit | e44e5665d4a38aa7da6b3b500e6fc8c68c73285a (patch) | |
tree | 723442d855a43386472f693735111c93be8e9e4a /clang/tools/clang-format/ClangFormat.cpp | |
parent | ec1fc97e5da00a4bfbb16ac74449b2e042dc37cb (diff) | |
download | bcm5719-llvm-e44e5665d4a38aa7da6b3b500e6fc8c68c73285a.tar.gz bcm5719-llvm-e44e5665d4a38aa7da6b3b500e6fc8c68c73285a.zip |
clang-format: Only output IncompleteFormat if -cursor is given.
This is only for editor integrations.
llvm-svn: 236867
Diffstat (limited to 'clang/tools/clang-format/ClangFormat.cpp')
-rw-r--r-- | clang/tools/clang-format/ClangFormat.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/clang/tools/clang-format/ClangFormat.cpp b/clang/tools/clang-format/ClangFormat.cpp index ae2180c8370..5037e901f3b 100644 --- a/clang/tools/clang-format/ClangFormat.cpp +++ b/clang/tools/clang-format/ClangFormat.cpp @@ -226,7 +226,8 @@ 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='" @@ -255,12 +256,11 @@ static bool format(StringRef FileName) { else if (Rewrite.overwriteChangedFiles()) return true; } else { - outs() << "{"; if (Cursor.getNumOccurrences() != 0) - outs() << " \"Cursor\": " - << tooling::shiftedCodePosition(Replaces, Cursor) << ","; - outs() << " \"IncompleteFormat\": " - << (IncompleteFormat ? "true" : "false") << " }\n"; + outs() << "{ \"Cursor\": " + << tooling::shiftedCodePosition(Replaces, Cursor) + << ", \"IncompleteFormat\": " + << (IncompleteFormat ? "true" : "false") << " }\n"; Rewrite.getEditBuffer(ID).write(outs()); } } |