Simplify with llvm::is_contained. NFC

llvm-svn: 365993
This commit is contained in:
Fangrui Song 2019-07-13 07:23:12 +00:00
parent 21a92a8a55
commit 36fbd0da5f
4 changed files with 5 additions and 9 deletions

View File

@ -108,8 +108,7 @@ void AssertSideEffectCheck::check(const MatchFinder::MatchResult &Result) {
StringRef MacroName = Lexer::getImmediateMacroName(Loc, SM, LangOpts);
// Check if this macro is an assert.
if (std::find(AssertMacros.begin(), AssertMacros.end(), MacroName) !=
AssertMacros.end()) {
if (llvm::is_contained(AssertMacros, MacroName)) {
AssertMacroName = MacroName;
break;
}

View File

@ -105,7 +105,7 @@ void ForwardingReferenceOverloadCheck::check(
// template as the function parameter of that type. (This implies that type
// deduction will happen on the type.)
const TemplateParameterList *Params = FuncTemplate->getTemplateParameters();
if (std::find(Params->begin(), Params->end(), TypeParmDecl) == Params->end())
if (!llvm::is_contained(*Params, TypeParmDecl))
return;
// Every parameter after the first must have a default value.

View File

@ -242,10 +242,8 @@ public:
getOutermostMacroName(StartLoc, SM, Context.getLangOpts());
// Check to see if the user wants to replace the macro being expanded.
if (std::find(NullMacros.begin(), NullMacros.end(), OutermostMacroName) ==
NullMacros.end()) {
if (!llvm::is_contained(NullMacros, OutermostMacroName))
return skipSubTree();
}
StartLoc = SM.getFileLoc(StartLoc);
EndLoc = SM.getFileLoc(EndLoc);
@ -327,8 +325,7 @@ private:
StringRef Name =
Lexer::getImmediateMacroName(OldArgLoc, SM, Context.getLangOpts());
return std::find(NullMacros.begin(), NullMacros.end(), Name) !=
NullMacros.end();
return llvm::is_contained(NullMacros, Name);
}
MacroLoc = SM.getExpansionRange(ArgLoc).getBegin();

View File

@ -369,7 +369,7 @@ getModularizeArgumentsAdjuster(DependencyMap &Dependencies) {
// Ignore warnings. (Insert after "clang_tool" at beginning.)
NewArgs.insert(NewArgs.begin() + 1, "-w");
// Since we are compiling .h files, assume C++ unless given a -x option.
if (std::find(NewArgs.begin(), NewArgs.end(), "-x") == NewArgs.end()) {
if (!llvm::is_contained(NewArgs, "-x")) {
NewArgs.insert(NewArgs.begin() + 2, "-x");
NewArgs.insert(NewArgs.begin() + 3, "c++");
}