summaryrefslogtreecommitdiffstats
path: root/clang
diff options
context:
space:
mode:
authorNico Weber <nicolasweber@gmx.de>2013-01-12 05:50:48 +0000
committerNico Weber <nicolasweber@gmx.de>2013-01-12 05:50:48 +0000
commiteee7b81a168cc3f2a82882375109b9a059dde705 (patch)
treead8ff30f681067a36ed6e5cefe03615f7a294423 /clang
parent5dafd4a7ae0e0252ee45361977127dd24c2a8ab6 (diff)
downloadbcm5719-llvm-eee7b81a168cc3f2a82882375109b9a059dde705.tar.gz
bcm5719-llvm-eee7b81a168cc3f2a82882375109b9a059dde705.zip
Formatter: * and & are binary operators before ( and [.
llvm-svn: 172303
Diffstat (limited to 'clang')
-rw-r--r--clang/lib/Format/Format.cpp1
-rw-r--r--clang/unittests/Format/FormatTest.cpp3
2 files changed, 4 insertions, 0 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp
index e4dc2913126..aa534b9ef3f 100644
--- a/clang/lib/Format/Format.cpp
+++ b/clang/lib/Format/Format.cpp
@@ -974,6 +974,7 @@ private:
NextToken.Tok.is(tok::plus) || NextToken.Tok.is(tok::minus) ||
NextToken.Tok.is(tok::plusplus) || NextToken.Tok.is(tok::minusminus) ||
NextToken.Tok.is(tok::tilde) || NextToken.Tok.is(tok::exclaim) ||
+ NextToken.Tok.is(tok::l_paren) || NextToken.Tok.is(tok::l_square) ||
NextToken.Tok.is(tok::kw_alignof) || NextToken.Tok.is(tok::kw_sizeof))
return TT_BinaryOperator;
diff --git a/clang/unittests/Format/FormatTest.cpp b/clang/unittests/Format/FormatTest.cpp
index e5dbd630202..4b3297db3df 100644
--- a/clang/unittests/Format/FormatTest.cpp
+++ b/clang/unittests/Format/FormatTest.cpp
@@ -1016,6 +1016,9 @@ TEST_F(FormatTest, UnderstandsUsesOfStarAndAmp) {
verifyFormat("a * --b;");
verifyFormat("a[4] * b;");
verifyFormat("f() * b;");
+ verifyFormat("a * [self dostuff];");
+ verifyFormat("a * (a + b);");
+ verifyFormat("(a *)(a + b);");
verifyFormat("int *pa = (int *)&a;");
verifyFormat("InvalidRegions[*R] = 0;");
OpenPOWER on IntegriCloud