diff options
author | dim <dim@FreeBSD.org> | 2015-12-30 13:34:49 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2015-12-30 13:34:49 +0000 |
commit | 63b24cc778504ffd19e4c30a730e574c346312ee (patch) | |
tree | 28726ef2038e86121e353aabf52297b35a48efa2 /contrib/llvm/tools/clang/lib/Format/FormatToken.h | |
parent | 9b5bf5c4f53d65d6a48722d7410ed7cb15f5ba3a (diff) | |
parent | 3176e97f130184ece0e1a21352c8124cc83ff24a (diff) | |
download | FreeBSD-src-63b24cc778504ffd19e4c30a730e574c346312ee.zip FreeBSD-src-63b24cc778504ffd19e4c30a730e574c346312ee.tar.gz |
Update clang to trunk r256633.
Diffstat (limited to 'contrib/llvm/tools/clang/lib/Format/FormatToken.h')
-rw-r--r-- | contrib/llvm/tools/clang/lib/Format/FormatToken.h | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/contrib/llvm/tools/clang/lib/Format/FormatToken.h b/contrib/llvm/tools/clang/lib/Format/FormatToken.h index f335eda..78bc0ed 100644 --- a/contrib/llvm/tools/clang/lib/Format/FormatToken.h +++ b/contrib/llvm/tools/clang/lib/Format/FormatToken.h @@ -283,6 +283,10 @@ struct FormatToken { bool is(const IdentifierInfo *II) const { return II && II == Tok.getIdentifierInfo(); } + bool is(tok::PPKeywordKind Kind) const { + return Tok.getIdentifierInfo() && + Tok.getIdentifierInfo()->getPPKeywordID() == Kind; + } template <typename A, typename B> bool isOneOf(A K1, B K2) const { return is(K1) || is(K2); } @@ -408,16 +412,16 @@ struct FormatToken { /// \brief Returns \c true if this tokens starts a block-type list, i.e. a /// list that should be indented with a block indent. - bool opensBlockTypeList(const FormatStyle &Style) const { + bool opensBlockOrBlockTypeList(const FormatStyle &Style) const { return is(TT_ArrayInitializerLSquare) || (is(tok::l_brace) && (BlockKind == BK_Block || is(TT_DictLiteral) || (!Style.Cpp11BracedListStyle && NestingLevel == 0))); } - /// \brief Same as opensBlockTypeList, but for the closing token. - bool closesBlockTypeList(const FormatStyle &Style) const { - return MatchingParen && MatchingParen->opensBlockTypeList(Style); + /// \brief Same as opensBlockOrBlockTypeList, but for the closing token. + bool closesBlockOrBlockTypeList(const FormatStyle &Style) const { + return MatchingParen && MatchingParen->opensBlockOrBlockTypeList(Style); } private: @@ -521,6 +525,8 @@ private: /// properly supported by Clang's lexer. struct AdditionalKeywords { AdditionalKeywords(IdentifierTable &IdentTable) { + kw_final = &IdentTable.get("final"); + kw_override = &IdentTable.get("override"); kw_in = &IdentTable.get("in"); kw_CF_ENUM = &IdentTable.get("CF_ENUM"); kw_CF_OPTIONS = &IdentTable.get("CF_OPTIONS"); @@ -530,11 +536,13 @@ struct AdditionalKeywords { kw_finally = &IdentTable.get("finally"); kw_function = &IdentTable.get("function"); kw_import = &IdentTable.get("import"); + kw_is = &IdentTable.get("is"); + kw_let = &IdentTable.get("let"); kw_var = &IdentTable.get("var"); kw_abstract = &IdentTable.get("abstract"); + kw_assert = &IdentTable.get("assert"); kw_extends = &IdentTable.get("extends"); - kw_final = &IdentTable.get("final"); kw_implements = &IdentTable.get("implements"); kw_instanceof = &IdentTable.get("instanceof"); kw_interface = &IdentTable.get("interface"); @@ -546,6 +554,7 @@ struct AdditionalKeywords { kw_mark = &IdentTable.get("mark"); + kw_extend = &IdentTable.get("extend"); kw_option = &IdentTable.get("option"); kw_optional = &IdentTable.get("optional"); kw_repeated = &IdentTable.get("repeated"); @@ -553,11 +562,14 @@ struct AdditionalKeywords { kw_returns = &IdentTable.get("returns"); kw_signals = &IdentTable.get("signals"); + kw_qsignals = &IdentTable.get("Q_SIGNALS"); kw_slots = &IdentTable.get("slots"); kw_qslots = &IdentTable.get("Q_SLOTS"); } // Context sensitive keywords. + IdentifierInfo *kw_final; + IdentifierInfo *kw_override; IdentifierInfo *kw_in; IdentifierInfo *kw_CF_ENUM; IdentifierInfo *kw_CF_OPTIONS; @@ -569,12 +581,14 @@ struct AdditionalKeywords { IdentifierInfo *kw_finally; IdentifierInfo *kw_function; IdentifierInfo *kw_import; + IdentifierInfo *kw_is; + IdentifierInfo *kw_let; IdentifierInfo *kw_var; // Java keywords. IdentifierInfo *kw_abstract; + IdentifierInfo *kw_assert; IdentifierInfo *kw_extends; - IdentifierInfo *kw_final; IdentifierInfo *kw_implements; IdentifierInfo *kw_instanceof; IdentifierInfo *kw_interface; @@ -587,6 +601,7 @@ struct AdditionalKeywords { IdentifierInfo *kw_mark; // Proto keywords. + IdentifierInfo *kw_extend; IdentifierInfo *kw_option; IdentifierInfo *kw_optional; IdentifierInfo *kw_repeated; @@ -595,6 +610,7 @@ struct AdditionalKeywords { // QT keywords. IdentifierInfo *kw_signals; + IdentifierInfo *kw_qsignals; IdentifierInfo *kw_slots; IdentifierInfo *kw_qslots; }; |