aboutsummaryrefslogtreecommitdiff
path: root/lib/Format/Format.cpp
diff options
context:
space:
mode:
authorDaniel Jasper <djasper@google.com>2013-01-23 11:15:14 +0000
committerDaniel Jasper <djasper@google.com>2013-01-23 11:15:14 +0000
commit218b6dfaee321cec558e15d47b68155dd9f35684 (patch)
treeda34dce327cac94ed8bdb646ab644666d8f04638 /lib/Format/Format.cpp
parent836b58f564e07e806d3d0b41a193fde0921013c7 (diff)
Fix regression in formatting pointer types.
We will need a more principled solution, but we should not leave this unfixed until we come up with one. Before: void f() { int * a; } After: void f() { int *a; } git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@173252 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format/Format.cpp')
-rw-r--r--lib/Format/Format.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/lib/Format/Format.cpp b/lib/Format/Format.cpp
index 90bcf6feb7..36bf53d9a7 100644
--- a/lib/Format/Format.cpp
+++ b/lib/Format/Format.cpp
@@ -1260,6 +1260,8 @@ private:
if (getPrecedence(Current) == prec::Assignment ||
Current.is(tok::kw_return) || Current.is(tok::kw_throw))
IsRHS = true;
+ if (Current.is(tok::l_paren) && !Line.MustBeDeclaration)
+ IsRHS = true;
if (Current.Type == TT_Unknown) {
if (Current.is(tok::star) || Current.is(tok::amp)) {
@@ -1370,7 +1372,7 @@ private:
// It is very unlikely that we are going to find a pointer or reference type
// definition on the RHS of an assignment.
- if (IsRHS || !Line.MustBeDeclaration)
+ if (IsRHS)
return TT_BinaryOperator;
return TT_PointerOrReference;