diff options
author | Alexander Kornienko <alexfh@google.com> | 2013-03-20 16:41:56 +0000 |
---|---|---|
committer | Alexander Kornienko <alexfh@google.com> | 2013-03-20 16:41:56 +0000 |
commit | 54a38bd5cf243310290f34b43fc940a498a00f90 (patch) | |
tree | a2950daa9d25641a7a79675898464262b983a908 /lib/Format | |
parent | 92f9faf3cf1065f987f227e0c2fdf06fcccf1ae8 (diff) |
Support for pointers-to-members usage via .*
Summary: Added support for pointers-to-members usage via .* and a few tests.
Reviewers: djasper
Reviewed By: djasper
CC: cfe-commits, klimek
Differential Revision: http://llvm-reviews.chandlerc.com/D556
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@177537 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Format')
-rw-r--r-- | lib/Format/TokenAnnotator.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/Format/TokenAnnotator.cpp b/lib/Format/TokenAnnotator.cpp index 7c4797978f..3578162c3f 100644 --- a/lib/Format/TokenAnnotator.cpp +++ b/lib/Format/TokenAnnotator.cpp @@ -1058,7 +1058,8 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, if (Tok.is(tok::l_paren) && !Tok.Children.empty() && Tok.Children[0].Type == TT_PointerOrReference && !Tok.Children[0].Children.empty() && - Tok.Children[0].Children[0].isNot(tok::r_paren)) + Tok.Children[0].Children[0].isNot(tok::r_paren) && + Tok.Parent->isNot(tok::l_paren)) return true; if (Tok.Parent->Type == TT_UnaryOperator || Tok.Parent->Type == TT_CastRParen) return false; @@ -1071,7 +1072,8 @@ bool TokenAnnotator::spaceRequiredBefore(const AnnotatedLine &Line, Tok.Parent->Type == TT_TemplateCloser && Style.Standard != FormatStyle::LS_Cpp11; } - if (Tok.is(tok::arrowstar) || Tok.Parent->is(tok::arrowstar)) + if (Tok.isOneOf(tok::arrowstar, tok::periodstar) || + Tok.Parent->isOneOf(tok::arrowstar, tok::periodstar)) return false; if (Tok.Type == TT_BinaryOperator || Tok.Parent->Type == TT_BinaryOperator) return true; |