summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2015-05-08 15:36:30 +0000
committerDaniel Jasper <djasper@google.com>2015-05-08 15:36:30 +0000
commit199217c454a55a6edb9aac735fe073a591968ffa (patch)
tree972da064727f5877777d3d9d261678dbed87813e /tools
parent82157e148da398da96a848886b3ab15dffea799b (diff)
downloadclang-199217c454a55a6edb9aac735fe073a591968ffa.tar.gz
clang-format: Only output IncompleteFormat if -cursor is given.
This is only for editor integrations. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@236867 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'tools')
-rw-r--r--tools/clang-format/ClangFormat.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/tools/clang-format/ClangFormat.cpp b/tools/clang-format/ClangFormat.cpp
index ae2180c837..5037e901f3 100644
--- a/tools/clang-format/ClangFormat.cpp
+++ b/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());
}
}