clang-format: Fix regression introduced by r189353.
Before:
FirstToken->WhitespaceRange.getBegin()
.getLocWithOffset(First->LastNewlineOffset);
After:
FirstToken->WhitespaceRange.getBegin().getLocWithOffset(
First->LastNewlineOffset);
Re-add logic to prevent breaking after an empty set of parentheses.
Basically it seems that calling a function without parameters is more
like navigating along the same object than it is a separate step of a
builder-type call.
We might need to extends this in future to allow "short" parameters that
e.g. are an index accessing a specific element.
llvm-svn: 190126
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index 7d4048f..d408b38 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -520,7 +520,7 @@
LBrace.Children.size() == 0)
// The previous token does not open a block. Nothing to do. We don't
// assert so that we can simply call this function for all tokens.
- return true;
+ return true;
if (NewLine) {
unsigned ParentIndent = State.Stack.back().Indent;
@@ -624,7 +624,7 @@
++FormatTok->NewlinesBefore;
// FIXME: This is technically incorrect, as it could also
// be a literal backslash at the end of the line.
- if (i == 0 || FormatTok->TokenText[i-1] != '\\')
+ if (i == 0 || FormatTok->TokenText[i - 1] != '\\')
FormatTok->HasUnescapedNewline = true;
FormatTok->LastNewlineOffset = WhitespaceLength + i + 1;
Column = 0;