Skip to content

Commit 5624005

Browse files
kazutakahirataGeorgeARM
authored andcommitted
[clang] Use *(Set|Map)::contains (NFC) (llvm#138464)
1 parent 8031d81 commit 5624005

File tree

4 files changed

+5
-9
lines changed

4 files changed

+5
-9
lines changed

clang/lib/AST/DeclBase.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2149,8 +2149,7 @@ void DeclContext::makeDeclVisibleInContextImpl(NamedDecl *D, bool Internal) {
21492149
// have already checked the external source.
21502150
if (!Internal)
21512151
if (ExternalASTSource *Source = getParentASTContext().getExternalSource())
2152-
if (hasExternalVisibleStorage() &&
2153-
Map->find(D->getDeclName()) == Map->end())
2152+
if (hasExternalVisibleStorage() && !Map->contains(D->getDeclName()))
21542153
Source->FindExternalVisibleDeclsByName(this, D->getDeclName(),
21552154
D->getDeclContext());
21562155

clang/lib/Serialization/ASTReader.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8646,9 +8646,8 @@ ASTReader::getLoadedSpecializationsLookupTables(const Decl *D, bool IsPartial) {
86468646

86478647
bool ASTReader::haveUnloadedSpecializations(const Decl *D) const {
86488648
assert(D->isCanonicalDecl());
8649-
return (PartialSpecializationsLookups.find(D) !=
8650-
PartialSpecializationsLookups.end()) ||
8651-
(SpecializationsLookups.find(D) != SpecializationsLookups.end());
8649+
return PartialSpecializationsLookups.contains(D) ||
8650+
SpecializationsLookups.contains(D);
86528651
}
86538652

86548653
/// Under non-PCH compilation the consumer receives the objc methods

clang/tools/libclang/CXCursor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1638,7 +1638,7 @@ unsigned clang_CXCursorSet_contains(CXCursorSet set, CXCursor cursor) {
16381638
CXCursorSet_Impl *setImpl = unpackCXCursorSet(set);
16391639
if (!setImpl)
16401640
return 0;
1641-
return setImpl->find(cursor) != setImpl->end();
1641+
return setImpl->contains(cursor);
16421642
}
16431643

16441644
unsigned clang_CXCursorSet_insert(CXCursorSet set, CXCursor cursor) {

clang/utils/TableGen/ClangBuiltinTemplatesEmitter.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,8 @@ ParseTemplateParameterList(ParserState &PS,
6060
} else if (Arg->isSubClassOf("NTTP")) {
6161
auto Type = Arg->getValueAsString("TypeName");
6262

63-
if (TemplateNameToParmName.find(Type.str()) ==
64-
TemplateNameToParmName.end()) {
63+
if (!TemplateNameToParmName.contains(Type.str()))
6564
PrintFatalError("Unkown Type Name");
66-
}
6765

6866
auto TSIName = "TSI" + std::to_string(PS.UniqueCounter++);
6967
Code << " auto *" << TSIName << " = C.getTrivialTypeSourceInfo(QualType("

0 commit comments

Comments
 (0)