Use {DenseSet,SetVector,SmallPtrSet}::contains (NFC)
This commit is contained in:
parent
213666f804
commit
4db2e4cebe
|
|
@ -123,7 +123,7 @@ void ForwardDeclarationNamespaceCheck::onEndOfTranslationUnit() {
|
|||
if (CurDecl->hasDefinition() || CurDecl->isReferenced()) {
|
||||
continue; // Skip forward declarations that are used/referenced.
|
||||
}
|
||||
if (FriendTypes.count(CurDecl->getTypeForDecl()) != 0) {
|
||||
if (FriendTypes.contains(CurDecl->getTypeForDecl())) {
|
||||
continue; // Skip forward declarations referenced as friend.
|
||||
}
|
||||
if (CurDecl->getLocation().isMacroID() ||
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ computeInsertions(const CXXConstructorDecl::init_const_range &Inits,
|
|||
// Add all fields between current field up until the next initializer.
|
||||
for (; Decl != std::end(OrderedDecls) && *Decl != InitDecl; ++Decl) {
|
||||
if (const auto *D = dyn_cast<T>(*Decl)) {
|
||||
if (DeclsToInit.count(D) > 0)
|
||||
if (DeclsToInit.contains(D))
|
||||
Insertions.back().Initializers.emplace_back(getName(D));
|
||||
}
|
||||
}
|
||||
|
|
@ -221,7 +221,7 @@ computeInsertions(const CXXConstructorDecl::init_const_range &Inits,
|
|||
// Add remaining decls that require initialization.
|
||||
for (; Decl != std::end(OrderedDecls); ++Decl) {
|
||||
if (const auto *D = dyn_cast<T>(*Decl)) {
|
||||
if (DeclsToInit.count(D) > 0)
|
||||
if (DeclsToInit.contains(D))
|
||||
Insertions.back().Initializers.emplace_back(getName(D));
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -172,7 +172,7 @@ void UnusedUsingDeclsCheck::removeFromFoundDecls(const Decl *D) {
|
|||
//
|
||||
// FIXME: Use a more efficient way to find a matching context.
|
||||
for (auto &Context : Contexts) {
|
||||
if (Context.UsingTargetDecls.count(D->getCanonicalDecl()) > 0)
|
||||
if (Context.UsingTargetDecls.contains(D->getCanonicalDecl()))
|
||||
Context.IsUsed = true;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -303,7 +303,7 @@ void InconsistentDeclarationParameterNameCheck::check(
|
|||
const auto *OriginalDeclaration =
|
||||
Result.Nodes.getNodeAs<FunctionDecl>("functionDecl");
|
||||
|
||||
if (VisitedDeclarations.count(OriginalDeclaration) > 0)
|
||||
if (VisitedDeclarations.contains(OriginalDeclaration))
|
||||
return; // Avoid multiple warnings.
|
||||
|
||||
const FunctionDecl *ParameterSourceDeclaration =
|
||||
|
|
|
|||
|
|
@ -1013,8 +1013,7 @@ public:
|
|||
}
|
||||
bool isValidAsmImmediate(const llvm::APInt &Value) const {
|
||||
if (!ImmSet.empty())
|
||||
return Value.isSignedIntN(32) &&
|
||||
ImmSet.count(Value.getZExtValue()) != 0;
|
||||
return Value.isSignedIntN(32) && ImmSet.contains(Value.getZExtValue());
|
||||
return !ImmRange.isConstrained ||
|
||||
(Value.sge(ImmRange.Min) && Value.sle(ImmRange.Max));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -337,7 +337,7 @@ public:
|
|||
|
||||
/// isDeclScope - Return true if this is the scope that the specified decl is
|
||||
/// declared in.
|
||||
bool isDeclScope(const Decl *D) const { return DeclsInScope.count(D) != 0; }
|
||||
bool isDeclScope(const Decl *D) const { return DeclsInScope.contains(D); }
|
||||
|
||||
/// Get the entity corresponding to this scope.
|
||||
DeclContext *getEntity() const {
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ ASTImporterLookupTable::lookup(DeclContext *DC, DeclarationName Name) const {
|
|||
}
|
||||
|
||||
bool ASTImporterLookupTable::contains(DeclContext *DC, NamedDecl *ND) const {
|
||||
return 0 < lookup(DC, ND->getDeclName()).count(ND);
|
||||
return lookup(DC, ND->getDeclName()).contains(ND);
|
||||
}
|
||||
|
||||
void ASTImporterLookupTable::dump(DeclContext *DC) const {
|
||||
|
|
|
|||
|
|
@ -3091,7 +3091,7 @@ void MicrosoftRecordLayoutBuilder::layoutVirtualBases(const CXXRecordDecl *RD) {
|
|||
for (const CXXBaseSpecifier &VBase : RD->vbases()) {
|
||||
const CXXRecordDecl *BaseDecl = VBase.getType()->getAsCXXRecordDecl();
|
||||
const ASTRecordLayout &BaseLayout = Context.getASTRecordLayout(BaseDecl);
|
||||
bool HasVtordisp = HasVtorDispSet.count(BaseDecl) > 0;
|
||||
bool HasVtordisp = HasVtorDispSet.contains(BaseDecl);
|
||||
// Insert padding between two bases if the left first one is zero sized or
|
||||
// contains a zero sized subobject and the right is zero sized or one leads
|
||||
// with a zero sized base. The padding between virtual bases is 4
|
||||
|
|
|
|||
|
|
@ -3454,7 +3454,7 @@ static void removeRedundantPaths(std::list<FullPathTy> &FullPaths) {
|
|||
if (&SpecificPath == &OtherPath)
|
||||
continue;
|
||||
if (llvm::all_of(SpecificPath, [&](const BaseSubobject &BSO) {
|
||||
return OtherPath.count(BSO) != 0;
|
||||
return OtherPath.contains(BSO);
|
||||
})) {
|
||||
return true;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -12373,7 +12373,7 @@ bool CGOpenMPRuntime::isNontemporalDecl(const ValueDecl *VD) const {
|
|||
|
||||
return llvm::any_of(
|
||||
CGM.getOpenMPRuntime().NontemporalDeclsStack,
|
||||
[VD](const NontemporalDeclsSet &Set) { return Set.count(VD) > 0; });
|
||||
[VD](const NontemporalDeclsSet &Set) { return Set.contains(VD); });
|
||||
}
|
||||
|
||||
void CGOpenMPRuntime::LastprivateConditionalRAII::tryToDisableInnerAnalysis(
|
||||
|
|
|
|||
|
|
@ -2711,8 +2711,7 @@ static void CheckProtocolMethodDefs(Sema &S,
|
|||
ProtocolsExplictImpl.reset(new ProtocolNameSet);
|
||||
findProtocolsWithExplicitImpls(Super, *ProtocolsExplictImpl);
|
||||
}
|
||||
if (ProtocolsExplictImpl->find(PDecl->getIdentifier()) !=
|
||||
ProtocolsExplictImpl->end())
|
||||
if (ProtocolsExplictImpl->contains(PDecl->getIdentifier()))
|
||||
return;
|
||||
|
||||
// If no super class conforms to the protocol, we should not search
|
||||
|
|
|
|||
|
|
@ -515,7 +515,7 @@ public:
|
|||
/// Checks if the specified declaration was used in the inner scan directive.
|
||||
bool isUsedInScanDirective(ValueDecl *D) const {
|
||||
if (const SharingMapTy *Stack = getTopOfStackOrNull())
|
||||
return Stack->UsedInScanDirective.count(D) > 0;
|
||||
return Stack->UsedInScanDirective.contains(D);
|
||||
return false;
|
||||
}
|
||||
|
||||
|
|
@ -1040,7 +1040,7 @@ public:
|
|||
// Return set of mapped classes types
|
||||
bool isClassPreviouslyMapped(QualType QT) const {
|
||||
const SharingMapTy &StackElem = getTopOfStack();
|
||||
return StackElem.MappedClassesQualTypes.count(QT) != 0;
|
||||
return StackElem.MappedClassesQualTypes.contains(QT);
|
||||
}
|
||||
|
||||
/// Adds global declare target to the parent target region.
|
||||
|
|
@ -1079,7 +1079,7 @@ public:
|
|||
}
|
||||
/// Checks if the decl is implicitly firstprivate in the task-based region.
|
||||
bool isImplicitTaskFirstprivate(Decl *D) const {
|
||||
return getTopOfStack().ImplicitTaskFirstprivates.count(D) > 0;
|
||||
return getTopOfStack().ImplicitTaskFirstprivates.contains(D);
|
||||
}
|
||||
|
||||
/// Marks decl as used in uses_allocators clause as the allocator.
|
||||
|
|
|
|||
|
|
@ -949,7 +949,7 @@ void NonLocalizedStringChecker::checkPostCall(const CallEvent &Call,
|
|||
const IdentifierInfo *Identifier = Call.getCalleeIdentifier();
|
||||
|
||||
SVal sv = Call.getReturnValue();
|
||||
if (isAnnotatedAsReturningLocalized(D) || LSF.count(Identifier) != 0) {
|
||||
if (isAnnotatedAsReturningLocalized(D) || LSF.contains(Identifier)) {
|
||||
setLocalizedState(sv, C);
|
||||
} else if (isNSStringType(RT, C.getASTContext()) &&
|
||||
!hasLocalizedState(sv, C)) {
|
||||
|
|
|
|||
|
|
@ -107,7 +107,7 @@ void Object::removeSections(function_ref<bool(const Section &)> ToRemove) {
|
|||
// section,
|
||||
// remove those as well as nothing will include them (and we can't
|
||||
// leave them dangling).
|
||||
if (RemovedSections.count(Sym.AssociativeComdatTargetSectionId) == 1)
|
||||
if (RemovedSections.contains(Sym.AssociativeComdatTargetSectionId))
|
||||
AssociatedSections.insert(Sym.TargetSectionId);
|
||||
return RemovedSections.contains(Sym.TargetSectionId);
|
||||
});
|
||||
|
|
|
|||
Loading…
Reference in New Issue