diff options
author | Daniel Marjamaki <daniel.marjamaki@evidente.se> | 2015-06-18 10:59:26 +0000 |
---|---|---|
committer | Daniel Marjamaki <daniel.marjamaki@evidente.se> | 2015-06-18 10:59:26 +0000 |
commit | e59f8d7f1d88c3a316956a84c63646398a2dcbf5 (patch) | |
tree | 778d100bc6d6146647da0d061facdddc0f01dfab /clang/lib/Lex/TokenConcatenation.cpp | |
parent | 9869724dcfcd3b10cdcdfb7d8f7ab5f9d6ee6f5b (diff) | |
download | llvm-e59f8d7f1d88c3a316956a84c63646398a2dcbf5.zip llvm-e59f8d7f1d88c3a316956a84c63646398a2dcbf5.tar.gz llvm-e59f8d7f1d88c3a316956a84c63646398a2dcbf5.tar.bz2 |
[clang] Refactoring of conditions so they use isOneOf() instead of multiple is().
llvm-svn: 240008
Diffstat (limited to 'clang/lib/Lex/TokenConcatenation.cpp')
-rw-r--r-- | clang/lib/Lex/TokenConcatenation.cpp | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/clang/lib/Lex/TokenConcatenation.cpp b/clang/lib/Lex/TokenConcatenation.cpp index 0832749..27b4eab 100644 --- a/clang/lib/Lex/TokenConcatenation.cpp +++ b/clang/lib/Lex/TokenConcatenation.cpp @@ -178,20 +178,20 @@ bool TokenConcatenation::AvoidConcat(const Token &PrevPrevTok, if (ConcatInfo & aci_avoid_equal) { // If the next token is '=' or '==', avoid concatenation. - if (Tok.is(tok::equal) || Tok.is(tok::equalequal)) + if (Tok.isOneOf(tok::equal, tok::equalequal)) return true; ConcatInfo &= ~aci_avoid_equal; } if (Tok.isAnnotation()) { // Modules annotation can show up when generated automatically for includes. - assert((Tok.is(tok::annot_module_include) || - Tok.is(tok::annot_module_begin) || - Tok.is(tok::annot_module_end)) && + assert(Tok.isOneOf(tok::annot_module_include, tok::annot_module_begin, + tok::annot_module_end) && "unexpected annotation in AvoidConcat"); ConcatInfo = 0; } - if (ConcatInfo == 0) return false; + if (ConcatInfo == 0) + return false; // Basic algorithm: we look at the first character of the second token, and // determine whether it, if appended to the first token, would form (or @@ -238,11 +238,11 @@ bool TokenConcatenation::AvoidConcat(const Token &PrevPrevTok, if (Tok.is(tok::numeric_constant)) return GetFirstChar(PP, Tok) != '.'; - if (Tok.getIdentifierInfo() || Tok.is(tok::wide_string_literal) || - Tok.is(tok::utf8_string_literal) || Tok.is(tok::utf16_string_literal) || - Tok.is(tok::utf32_string_literal) || Tok.is(tok::wide_char_constant) || - Tok.is(tok::utf8_char_constant) || Tok.is(tok::utf16_char_constant) || - Tok.is(tok::utf32_char_constant)) + if (Tok.getIdentifierInfo() || + Tok.isOneOf(tok::wide_string_literal, tok::utf8_string_literal, + tok::utf16_string_literal, tok::utf32_string_literal, + tok::wide_char_constant, tok::utf8_char_constant, + tok::utf16_char_constant, tok::utf32_char_constant)) return true; // If this isn't identifier + string, we're done. |