summaryrefslogtreecommitdiffstats
path: root/clang/lib/Lex
diff options
context:
space:
mode:
authorDaniel Marjamaki <daniel.marjamaki@evidente.se>2015-06-18 10:59:26 +0000
committerDaniel Marjamaki <daniel.marjamaki@evidente.se>2015-06-18 10:59:26 +0000
commite59f8d7f1d88c3a316956a84c63646398a2dcbf5 (patch)
tree778d100bc6d6146647da0d061facdddc0f01dfab /clang/lib/Lex
parent9869724dcfcd3b10cdcdfb7d8f7ab5f9d6ee6f5b (diff)
downloadbcm5719-llvm-e59f8d7f1d88c3a316956a84c63646398a2dcbf5.tar.gz
bcm5719-llvm-e59f8d7f1d88c3a316956a84c63646398a2dcbf5.zip
[clang] Refactoring of conditions so they use isOneOf() instead of multiple is().
llvm-svn: 240008
Diffstat (limited to 'clang/lib/Lex')
-rw-r--r--clang/lib/Lex/PPDirectives.cpp4
-rw-r--r--clang/lib/Lex/PPMacroExpansion.cpp8
-rw-r--r--clang/lib/Lex/TokenConcatenation.cpp20
-rw-r--r--clang/lib/Lex/TokenLexer.cpp2
4 files changed, 17 insertions, 17 deletions
diff --git a/clang/lib/Lex/PPDirectives.cpp b/clang/lib/Lex/PPDirectives.cpp
index 45b86329fb4..43def2b32c5 100644
--- a/clang/lib/Lex/PPDirectives.cpp
+++ b/clang/lib/Lex/PPDirectives.cpp
@@ -2009,8 +2009,8 @@ static bool isConfigurationPattern(Token &MacroName, MacroInfo *MI,
}
// #define inline
- if ((MacroName.is(tok::kw_extern) || MacroName.is(tok::kw_inline) ||
- MacroName.is(tok::kw_static) || MacroName.is(tok::kw_const)) &&
+ if (MacroName.isOneOf(tok::kw_extern, tok::kw_inline, tok::kw_static,
+ tok::kw_const) &&
MI->getNumTokens() == 0) {
return true;
}
diff --git a/clang/lib/Lex/PPMacroExpansion.cpp b/clang/lib/Lex/PPMacroExpansion.cpp
index 0aaf3dd23c4..c63cafb6d79 100644
--- a/clang/lib/Lex/PPMacroExpansion.cpp
+++ b/clang/lib/Lex/PPMacroExpansion.cpp
@@ -726,10 +726,10 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName,
unsigned NumActuals = 0;
while (Tok.isNot(tok::r_paren)) {
- if (ContainsCodeCompletionTok && (Tok.is(tok::eof) || Tok.is(tok::eod)))
+ if (ContainsCodeCompletionTok && Tok.isOneOf(tok::eof, tok::eod))
break;
- assert((Tok.is(tok::l_paren) || Tok.is(tok::comma)) &&
+ assert(Tok.isOneOf(tok::l_paren, tok::comma) &&
"only expect argument separators here");
unsigned ArgTokenStart = ArgTokens.size();
@@ -744,7 +744,7 @@ MacroArgs *Preprocessor::ReadFunctionLikeMacroArgs(Token &MacroName,
// an argument value in a macro could expand to ',' or '(' or ')'.
LexUnexpandedToken(Tok);
- if (Tok.is(tok::eof) || Tok.is(tok::eod)) { // "#if f(<eof>" & "#if f(\n"
+ if (Tok.isOneOf(tok::eof, tok::eod)) { // "#if f(<eof>" & "#if f(\n"
if (!ContainsCodeCompletionTok) {
Diag(MacroName, diag::err_unterm_macro_invoc);
Diag(MI->getDefinitionLoc(), diag::note_macro_here)
@@ -1747,7 +1747,7 @@ void Preprocessor::ExpandBuiltinMacro(Token &Tok) {
Diag(Tok.getLocation(), diag::err_pp_identifier_arg_not_identifier)
<< Tok.getKind();
// Don't walk past anything that's not a real token.
- if (Tok.is(tok::eof) || Tok.is(tok::eod) || Tok.isAnnotation())
+ if (Tok.isOneOf(tok::eof, tok::eod) || Tok.isAnnotation())
return;
}
diff --git a/clang/lib/Lex/TokenConcatenation.cpp b/clang/lib/Lex/TokenConcatenation.cpp
index 08327496ab8..27b4eab1a28 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.
diff --git a/clang/lib/Lex/TokenLexer.cpp b/clang/lib/Lex/TokenLexer.cpp
index 83efbab7613..e7512fa2831 100644
--- a/clang/lib/Lex/TokenLexer.cpp
+++ b/clang/lib/Lex/TokenLexer.cpp
@@ -185,7 +185,7 @@ void TokenLexer::ExpandFunctionArguments() {
if (i != 0 && !Tokens[i-1].is(tok::hashhash) && CurTok.hasLeadingSpace())
NextTokGetsSpace = true;
- if (CurTok.is(tok::hash) || CurTok.is(tok::hashat)) {
+ if (CurTok.isOneOf(tok::hash, tok::hashat)) {
int ArgNo = Macro->getArgumentNum(Tokens[i+1].getIdentifierInfo());
assert(ArgNo != -1 && "Token following # is not an argument?");
OpenPOWER on IntegriCloud