summaryrefslogtreecommitdiffstats
path: root/clang/lib/Format/Format.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/Format/Format.cpp')
-rw-r--r--clang/lib/Format/Format.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index b1f9f4c85b7..224f1d759fb 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -297,7 +297,7 @@ public:
State.IgnoreStackForComparison = false;
// The first token has already been indented and thus consumed.
- moveStateToNextToken(State, /*DryRun=*/false);
+ moveStateToNextToken(State, /*DryRun=*/false, /*Newline=*/false);
// If everything fits on a single line, just put it there.
unsigned ColumnLimit = Style.ColumnLimit;
@@ -729,12 +729,12 @@ private:
}
}
- return moveStateToNextToken(State, DryRun) + ExtraPenalty;
+ return moveStateToNextToken(State, DryRun, Newline) + ExtraPenalty;
}
/// \brief Mark the next token as consumed in \p State and modify its stacks
/// accordingly.
- unsigned moveStateToNextToken(LineState &State, bool DryRun) {
+ unsigned moveStateToNextToken(LineState &State, bool DryRun, bool Newline) {
const FormatToken &Current = *State.NextToken;
assert(State.Stack.size());
@@ -875,6 +875,10 @@ private:
State.NextToken = State.NextToken->Next;
+ if (!Newline && Style.AlwaysBreakBeforeMultilineStrings &&
+ Current.is(tok::string_literal))
+ return 0;
+
return breakProtrudingToken(Current, State, DryRun);
}
OpenPOWER on IntegriCloud