forked from OSchip/llvm-project
Further fix to pointer to member formatting.
With style where the *s go with the type: Before: typedef bool* (Class:: *Member)() const; After: typedef bool* (Class::*Member)() const; llvm-svn: 181439
This commit is contained in:
parent
cfda517ea8
commit
2f34cacc3b
|
@ -1035,7 +1035,8 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line,
|
|||
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))
|
||||
|
|
|
@ -2418,7 +2418,7 @@ TEST_F(FormatTest, UnderstandsBinaryOperators) {
|
|||
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"
|
||||
|
@ -2426,6 +2426,9 @@ TEST_F(FormatTest, UnderstandsPointersToMembers) {
|
|||
" ((*a).*f)();\n"
|
||||
" a.*x;\n"
|
||||
"}");
|
||||
FormatStyle Style = getLLVMStyle();
|
||||
Style.PointerBindsToType = true;
|
||||
verifyFormat("typedef bool* (Class::*Member)() const;", Style);
|
||||
}
|
||||
|
||||
TEST_F(FormatTest, UnderstandsUnaryOperators) {
|
||||
|
|
Loading…
Reference in New Issue