diff options
Diffstat (limited to 'clang/lib/Format')
| -rw-r--r-- | clang/lib/Format/Format.cpp | 12 | ||||
| -rw-r--r-- | clang/lib/Format/TokenAnnotator.cpp | 5 |
2 files changed, 11 insertions, 6 deletions
diff --git a/clang/lib/Format/Format.cpp b/clang/lib/Format/Format.cpp index aac9fffb01e..7e92a705cad 100644 --- a/clang/lib/Format/Format.cpp +++ b/clang/lib/Format/Format.cpp @@ -1012,10 +1012,14 @@ private: ++CountBoundToType; } - if (Tok->Type == TT_TemplateCloser && - Tok->Previous->Type == TT_TemplateCloser && - Tok->WhitespaceRange.getBegin() == Tok->WhitespaceRange.getEnd()) - HasCpp03IncompatibleFormat = true; + if (Tok->WhitespaceRange.getBegin() == Tok->WhitespaceRange.getEnd()) { + if (Tok->is(tok::coloncolon) && + Tok->Previous->Type == TT_TemplateOpener) + HasCpp03IncompatibleFormat = true; + if (Tok->Type == TT_TemplateCloser && + Tok->Previous->Type == TT_TemplateCloser) + HasCpp03IncompatibleFormat = true; + } if (Tok->PackingKind == PPK_BinPacked) HasBinPackedFunction = true; diff --git a/clang/lib/Format/TokenAnnotator.cpp b/clang/lib/Format/TokenAnnotator.cpp index e1ffc25f633..4d95ecfe4f9 100644 --- a/clang/lib/Format/TokenAnnotator.cpp +++ b/clang/lib/Format/TokenAnnotator.cpp @@ -1231,8 +1231,9 @@ bool TokenAnnotator::spaceRequiredBetween(const AnnotatedLine &Line, if (Left.is(tok::coloncolon)) return false; if (Right.is(tok::coloncolon)) - return !Left.isOneOf(tok::identifier, tok::greater, tok::l_paren, - tok::r_paren); + return (Left.is(tok::less) && Style.Standard == FormatStyle::LS_Cpp03) || + !Left.isOneOf(tok::identifier, tok::greater, tok::l_paren, + tok::r_paren, tok::less); if (Left.is(tok::less) || Right.isOneOf(tok::greater, tok::less)) return false; if (Right.is(tok::ellipsis)) |

