[clang-tools-extra] r365993 - Simplify with llvm::is_contained. NFC
Fangrui Song via cfe-commits
cfe-commits at lists.llvm.org
Sat Jul 13 00:23:13 PDT 2019
Author: maskray
Date: Sat Jul 13 00:23:12 2019
New Revision: 365993
URL: http://llvm.org/viewvc/llvm-project?rev=365993&view=rev
Log:
Simplify with llvm::is_contained. NFC
Modified:
clang-tools-extra/trunk/clang-tidy/bugprone/AssertSideEffectCheck.cpp
clang-tools-extra/trunk/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp
clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
clang-tools-extra/trunk/modularize/Modularize.cpp
Modified: clang-tools-extra/trunk/clang-tidy/bugprone/AssertSideEffectCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/AssertSideEffectCheck.cpp?rev=365993&r1=365992&r2=365993&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/bugprone/AssertSideEffectCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/bugprone/AssertSideEffectCheck.cpp Sat Jul 13 00:23:12 2019
@@ -108,8 +108,7 @@ void AssertSideEffectCheck::check(const
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;
}
Modified: clang-tools-extra/trunk/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp?rev=365993&r1=365992&r2=365993&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/bugprone/ForwardingReferenceOverloadCheck.cpp Sat Jul 13 00:23:12 2019
@@ -105,7 +105,7 @@ void ForwardingReferenceOverloadCheck::c
// 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.
Modified: clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp?rev=365993&r1=365992&r2=365993&view=diff
==============================================================================
--- clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp (original)
+++ clang-tools-extra/trunk/clang-tidy/modernize/UseNullptrCheck.cpp Sat Jul 13 00:23:12 2019
@@ -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();
Modified: clang-tools-extra/trunk/modularize/Modularize.cpp
URL: http://llvm.org/viewvc/llvm-project/clang-tools-extra/trunk/modularize/Modularize.cpp?rev=365993&r1=365992&r2=365993&view=diff
==============================================================================
--- clang-tools-extra/trunk/modularize/Modularize.cpp (original)
+++ clang-tools-extra/trunk/modularize/Modularize.cpp Sat Jul 13 00:23:12 2019
@@ -369,7 +369,7 @@ getModularizeArgumentsAdjuster(Dependenc
// 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++");
}
More information about the cfe-commits
mailing list