diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2018-07-31 17:06:31 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2018-07-31 17:06:31 +0000 |
commit | 735bee93f1285c5c55c64d80fdc2ede4c0f23341 (patch) | |
tree | e1209c2a0b4880eee15e0ce705016372f7c88724 /contrib/llvm/tools/clang/lib/Format/FormatTokenLexer.cpp | |
parent | 51315c45ff5643a27f9c84b816db54ee870ba29b (diff) | |
parent | 486754660bb926339aefcf012a3f848592babb8b (diff) |
Notes
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Format/FormatTokenLexer.cpp')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Format/FormatTokenLexer.cpp | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/contrib/llvm/tools/clang/lib/Format/FormatTokenLexer.cpp b/contrib/llvm/tools/clang/lib/Format/FormatTokenLexer.cpp index 199d2974c5c7..c7f720a443d3 100644 --- a/contrib/llvm/tools/clang/lib/Format/FormatTokenLexer.cpp +++ b/contrib/llvm/tools/clang/lib/Format/FormatTokenLexer.cpp @@ -8,7 +8,7 @@ //===----------------------------------------------------------------------===// /// /// \file -/// \brief This file implements FormatTokenLexer, which tokenizes a source file +/// This file implements FormatTokenLexer, which tokenizes a source file /// into a FormatToken stream suitable for ClangFormat. /// //===----------------------------------------------------------------------===// @@ -38,7 +38,7 @@ FormatTokenLexer::FormatTokenLexer(const SourceManager &SourceMgr, FileID ID, for (const std::string &ForEachMacro : Style.ForEachMacros) ForEachMacros.push_back(&IdentTable.get(ForEachMacro)); - std::sort(ForEachMacros.begin(), ForEachMacros.end()); + llvm::sort(ForEachMacros.begin(), ForEachMacros.end()); } ArrayRef<FormatToken *> FormatTokenLexer::lex() { @@ -334,7 +334,7 @@ void FormatTokenLexer::handleTemplateStrings() { void FormatTokenLexer::tryParsePythonComment() { FormatToken *HashToken = Tokens.back(); - if (HashToken->isNot(tok::hash)) + if (!HashToken->isOneOf(tok::hash, tok::hashhash)) return; // Turn the remainder of this line into a comment. const char *CommentBegin = @@ -691,7 +691,9 @@ void FormatTokenLexer::readRawToken(FormatToken &Tok) { } } - if (Style.Language == FormatStyle::LK_JavaScript && + if ((Style.Language == FormatStyle::LK_JavaScript || + Style.Language == FormatStyle::LK_Proto || + Style.Language == FormatStyle::LK_TextProto) && Tok.is(tok::char_constant)) { Tok.Tok.setKind(tok::string_literal); } |