Use llvm::is_contained. NFC

llvm-svn: 353635
This commit is contained in:
Fangrui Song 2019-02-10 05:54:57 +00:00
parent 609d676aab
commit 9ac13a1244
9 changed files with 12 additions and 14 deletions

View File

@ -35,10 +35,10 @@ bool CapturedDiagList::clearDiagnostic(ArrayRef<unsigned> IDs,
while (I != List.end()) {
FullSourceLoc diagLoc = I->getLocation();
if ((IDs.empty() || // empty means clear all diagnostics in the range.
std::find(IDs.begin(), IDs.end(), I->getID()) != IDs.end()) &&
llvm::is_contained(IDs, I->getID())) &&
!diagLoc.isBeforeInTranslationUnitThan(range.getBegin()) &&
(diagLoc == range.getEnd() ||
diagLoc.isBeforeInTranslationUnitThan(range.getEnd()))) {
diagLoc.isBeforeInTranslationUnitThan(range.getEnd()))) {
cleared = true;
ListTy::iterator eraseS = I++;
if (eraseS->getLevel() != DiagnosticsEngine::Note)

View File

@ -254,7 +254,7 @@ void EmptySubobjectMap::AddSubobjectAtOffset(const CXXRecordDecl *RD,
// If we have empty structures inside a union, we can assign both
// the same offset. Just avoid pushing them twice in the list.
ClassVectorTy &Classes = EmptyClassOffsets[Offset];
if (std::find(Classes.begin(), Classes.end(), RD) != Classes.end())
if (llvm::is_contained(Classes, RD))
return;
Classes.push_back(RD);

View File

@ -456,7 +456,7 @@ bool TargetInfo::isValidGCCRegisterName(StringRef Name) const {
}
// Check register names.
if (std::find(Names.begin(), Names.end(), Name) != Names.end())
if (llvm::is_contained(Names, Name))
return true;
// Check any additional names that we have.

View File

@ -1575,8 +1575,7 @@ void Driver::HandleAutocompletions(StringRef PassedFlags) const {
// We want to show cc1-only options only when clang is invoked with -cc1 or
// -Xclang.
if (std::find(Flags.begin(), Flags.end(), "-Xclang") != Flags.end() ||
std::find(Flags.begin(), Flags.end(), "-cc1") != Flags.end())
if (llvm::is_contained(Flags, "-Xclang") || llvm::is_contained(Flags, "-cc1"))
DisableFlags &= ~options::NoDriverOption;
StringRef Cur;

View File

@ -207,7 +207,7 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
// TargetParser rewrite.
const auto ItRNoFullFP16 = std::find(Features.rbegin(), Features.rend(), "-fullfp16");
const auto ItRFP16FML = std::find(Features.rbegin(), Features.rend(), "+fp16fml");
if (std::find(Features.begin(), Features.end(), "+v8.4a") != Features.end()) {
if (llvm::is_contained(Features, "+v8.4a")) {
const auto ItRFullFP16 = std::find(Features.rbegin(), Features.rend(), "+fullfp16");
if (ItRFullFP16 < ItRNoFullFP16 && ItRFullFP16 < ItRFP16FML) {
// Only entangled feature that can be to the right of this +fullfp16 is -fp16fml.
@ -217,8 +217,7 @@ void aarch64::getAArch64TargetFeatures(const Driver &D,
}
else
goto fp16_fml_fallthrough;
}
else {
} else {
fp16_fml_fallthrough:
// In both of these cases, putting the 'other' feature on the end of the vector will
// result in the same effect as placing it immediately after the current feature.

View File

@ -170,7 +170,7 @@ static void getExtensionFeatures(const Driver &D,
}
// Check if duplicated extension.
if (std::find(AllExts.begin(), AllExts.end(), Ext) != AllExts.end()) {
if (llvm::is_contained(AllExts, Ext)) {
std::string Error = "duplicated ";
Error += Desc;
D.Diag(diag::err_drv_invalid_riscv_ext_arch_name)

View File

@ -273,7 +273,7 @@ std::string HTMLDiagnostics::GenerateHTML(const PathDiagnostic& D, Rewriter &R,
std::vector<FileID> FileIDs;
for (auto I : path) {
FileID FID = I->getLocation().asLocation().getExpansionLoc().getFileID();
if (std::find(FileIDs.begin(), FileIDs.end(), FID) != FileIDs.end())
if (llvm::is_contained(FileIDs, FID))
continue;
FileIDs.push_back(FID);

View File

@ -382,7 +382,7 @@ TEST(ClangToolTest, ArgumentAdjusters) {
ArgumentsAdjuster CheckSyntaxOnlyAdjuster =
[&Found, &Ran](const CommandLineArguments &Args, StringRef /*unused*/) {
Ran = true;
if (std::find(Args.begin(), Args.end(), "-fsyntax-only") != Args.end())
if (llvm::is_contained(Args, "-fsyntax-only"))
Found = true;
return Args;
};

View File

@ -2471,7 +2471,7 @@ void NeonEmitter::run(raw_ostream &OS) {
I != Defs.end(); /*No step*/) {
bool DependenciesSatisfied = true;
for (auto *II : (*I)->getDependencies()) {
if (std::find(Defs.begin(), Defs.end(), II) != Defs.end())
if (llvm::is_contained(Defs, II))
DependenciesSatisfied = false;
}
if (!DependenciesSatisfied) {
@ -2580,7 +2580,7 @@ void NeonEmitter::runFP16(raw_ostream &OS) {
I != Defs.end(); /*No step*/) {
bool DependenciesSatisfied = true;
for (auto *II : (*I)->getDependencies()) {
if (std::find(Defs.begin(), Defs.end(), II) != Defs.end())
if (llvm::is_contained(Defs, II))
DependenciesSatisfied = false;
}
if (!DependenciesSatisfied) {