aboutsummaryrefslogtreecommitdiff
path: root/lib/Format
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Format')
-rw-r--r--lib/Format/Format.cpp7
-rw-r--r--lib/Format/TokenAnnotator.cpp11
2 files changed, 9 insertions, 9 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index c50bfb0a70..92c138aa7e 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -675,7 +675,7 @@ private:
std::set<LineState> Seen;
// Insert start element into queue.
- StateNode *Node=
+ StateNode *Node =
new (Allocator.Allocate()) StateNode(InitialState, false, NULL);
Queue.push(QueueItem(OrderedPenalty(0, Count), Node));
++Count;
@@ -683,7 +683,7 @@ private:
// While not empty, take first element and follow edges.
while (!Queue.empty()) {
unsigned Penalty = Queue.top().first.first;
- StateNode *Node= Queue.top().second;
+ StateNode *Node = Queue.top().second;
if (Node->State.NextToken == NULL) {
DEBUG(llvm::errs() << "\n---\nPenalty for line: " << Penalty << "\n");
break;
@@ -1024,8 +1024,7 @@ private:
/// \p IndentForLevel must contain the indent for the level \c l
/// at \p IndentForLevel[l], or a value < 0 if the indent for
/// that level is unknown.
- unsigned getIndent(const std::vector<int> IndentForLevel,
- unsigned Level) {
+ unsigned getIndent(const std::vector<int> IndentForLevel, unsigned Level) {
if (IndentForLevel[Level] != -1)
return IndentForLevel[Level];
if (Level == 0)
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp
index 22e67df1ec..ace6d25467 100644
--- a/lib/Format/TokenAnnotator.cpp
+++ b/lib/Format/TokenAnnotator.cpp
@@ -524,11 +524,9 @@ private:
struct ScopedContextCreator {
AnnotatingParser &P;
- ScopedContextCreator(AnnotatingParser &P, unsigned Increase)
- : P(P) {
- P.Contexts.push_back(Context(
- P.Contexts.back().BindingStrength + Increase,
- P.Contexts.back().IsExpression));
+ ScopedContextCreator(AnnotatingParser &P, unsigned Increase) : P(P) {
+ P.Contexts.push_back(Context(P.Contexts.back().BindingStrength + Increase,
+ P.Contexts.back().IsExpression));
}
~ScopedContextCreator() { P.Contexts.pop_back(); }
@@ -865,6 +863,9 @@ unsigned TokenAnnotator::splitPenalty(const AnnotatedLine &Line,
if (Right.is(tok::arrow) || Right.is(tok::period)) {
if (Left.is(tok::r_paren) && Line.Type == LT_BuilderTypeCall)
return 5; // Should be smaller than breaking at a nested comma.
+ if ((Left.is(tok::r_paren) || Left.is(tok::r_square)) &&
+ Left.MatchingParen && Left.MatchingParen->ParameterCount > 0)
+ return 10;
return 150;
}