diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2020-03-05 18:05:37 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2020-03-05 18:05:37 +0000 |
commit | d652fd2996ce31dfd35dd2a9c58bf051ca7fff44 (patch) | |
tree | 79536ae10cf5fef47abfaa9f60f1537b0fe9cd29 /clang/lib/Format/TokenAnnotator.cpp | |
parent | 92d00d6a94bb341a1ed677031280e14863d4bb28 (diff) |
Notes
Diffstat (limited to 'clang/lib/Format/TokenAnnotator.cpp')
-rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index 88564e02f23ed..70bcd7048c559 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -2707,10 +2707,17 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, return false; if (Right.isOneOf(tok::star, tok::amp, tok::ampamp) && (Left.is(tok::identifier) || Left.isSimpleTypeSpecifier()) && - Left.Previous && Left.Previous->is(tok::kw_operator)) - // Space between the type and the * - // operator void*(), operator char*(), operator Foo*() dependant - // on PointerAlignment style. + // Space between the type and the * in: + // operator void*() + // operator char*() + // operator /*comment*/ const char*() + // operator volatile /*comment*/ char*() + // operator Foo*() + // dependent on PointerAlignment style. + Left.Previous && + (Left.Previous->endsSequence(tok::kw_operator) || + Left.Previous->endsSequence(tok::kw_const, tok::kw_operator) || + Left.Previous->endsSequence(tok::kw_volatile, tok::kw_operator))) return (Style.PointerAlignment != FormatStyle::PAS_Left); const auto SpaceRequiredForArrayInitializerLSquare = [](const FormatToken &LSquareTok, const FormatStyle &Style) { |