With style where the *s go with the type:
Before: typedef bool* (Class:: *Member)() const;
After: typedef bool* (Class::*Member)() const;
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@181439
91177308-0d34-0410-b5e6-
96231b3b80d8
return Right.FormatTok.Tok.isLiteral() ||
((Right.Type != TT_PointerOrReference) &&
Right.isNot(tok::l_paren) && Style.PointerBindsToType &&
- Left.Parent && Left.Parent->isNot(tok::l_paren));
+ Left.Parent &&
+ !Left.Parent->isOneOf(tok::l_paren, tok::coloncolon));
if (Right.is(tok::star) && Left.is(tok::l_paren))
return false;
if (Left.is(tok::l_square))
TEST_F(FormatTest, UnderstandsPointersToMembers) {
verifyFormat("int A::*x;");
verifyFormat("int (S::*func)(void *);");
- verifyFormat("typedef bool (Class::*Member)() const;");
+ verifyFormat("typedef bool *(Class::*Member)() const;");
verifyFormat("void f() {\n"
" (a->*f)();\n"
" a->*x;\n"
" ((*a).*f)();\n"
" a.*x;\n"
"}");
+ FormatStyle Style = getLLVMStyle();
+ Style.PointerBindsToType = true;
+ verifyFormat("typedef bool* (Class::*Member)() const;", Style);
}
TEST_F(FormatTest, UnderstandsUnaryOperators) {