aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp10
1 files changed, 7 insertions, 3 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 2a8fbd6e5e..ad85a8ecf2 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -90,7 +90,7 @@ public:
: Style(Style), SourceMgr(SourceMgr), Line(Line),
Annotations(Annotations), Replaces(Replaces),
StructuralError(StructuralError) {
- Parameters.PenaltyIndentLevel = 5;
+ Parameters.PenaltyIndentLevel = 15;
}
void format() {
@@ -325,10 +325,14 @@ private:
if (Left.Tok.is(tok::semi) || Left.Tok.is(tok::comma))
return 0;
- if (Left.Tok.is(tok::equal) || Left.Tok.is(tok::l_paren) ||
- Left.Tok.is(tok::pipepipe) || Left.Tok.is(tok::ampamp))
+ if (Left.Tok.is(tok::l_paren))
return 2;
+ prec::Level Level =
+ getBinOpPrecedence(Line.Tokens[Index].Tok.getKind(), true, true);
+ if (Level != prec::Unknown)
+ return Level;
+
if (Right.Tok.is(tok::arrow) || Right.Tok.is(tok::period))
return 200;