[AST] Use DenseMapBase::lookup (NFC)
This commit is contained in:
parent
684f3c968d
commit
8dc7647845
@ -499,10 +499,7 @@ const RawComment *ASTContext::getRawCommentForAnyRedecl(
|
||||
// Any redeclarations of D that we haven't checked for comments yet?
|
||||
// We can't use DenseMap::iterator directly since it'd get invalid.
|
||||
auto LastCheckedRedecl = [this, CanonicalD]() -> const Decl * {
|
||||
auto LookupRes = CommentlessRedeclChains.find(CanonicalD);
|
||||
if (LookupRes != CommentlessRedeclChains.end())
|
||||
return LookupRes->second;
|
||||
return nullptr;
|
||||
return CommentlessRedeclChains.lookup(CanonicalD);
|
||||
}();
|
||||
|
||||
for (const auto Redecl : D->redecls()) {
|
||||
@ -1523,11 +1520,7 @@ ASTContext::setTemplateOrSpecializationInfo(VarDecl *Inst,
|
||||
|
||||
NamedDecl *
|
||||
ASTContext::getInstantiatedFromUsingDecl(NamedDecl *UUD) {
|
||||
auto Pos = InstantiatedFromUsingDecl.find(UUD);
|
||||
if (Pos == InstantiatedFromUsingDecl.end())
|
||||
return nullptr;
|
||||
|
||||
return Pos->second;
|
||||
return InstantiatedFromUsingDecl.lookup(UUD);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1546,11 +1539,7 @@ ASTContext::setInstantiatedFromUsingDecl(NamedDecl *Inst, NamedDecl *Pattern) {
|
||||
|
||||
UsingEnumDecl *
|
||||
ASTContext::getInstantiatedFromUsingEnumDecl(UsingEnumDecl *UUD) {
|
||||
auto Pos = InstantiatedFromUsingEnumDecl.find(UUD);
|
||||
if (Pos == InstantiatedFromUsingEnumDecl.end())
|
||||
return nullptr;
|
||||
|
||||
return Pos->second;
|
||||
return InstantiatedFromUsingEnumDecl.lookup(UUD);
|
||||
}
|
||||
|
||||
void ASTContext::setInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst,
|
||||
@ -1561,12 +1550,7 @@ void ASTContext::setInstantiatedFromUsingEnumDecl(UsingEnumDecl *Inst,
|
||||
|
||||
UsingShadowDecl *
|
||||
ASTContext::getInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst) {
|
||||
llvm::DenseMap<UsingShadowDecl*, UsingShadowDecl*>::const_iterator Pos
|
||||
= InstantiatedFromUsingShadowDecl.find(Inst);
|
||||
if (Pos == InstantiatedFromUsingShadowDecl.end())
|
||||
return nullptr;
|
||||
|
||||
return Pos->second;
|
||||
return InstantiatedFromUsingShadowDecl.lookup(Inst);
|
||||
}
|
||||
|
||||
void
|
||||
@ -1577,12 +1561,7 @@ ASTContext::setInstantiatedFromUsingShadowDecl(UsingShadowDecl *Inst,
|
||||
}
|
||||
|
||||
FieldDecl *ASTContext::getInstantiatedFromUnnamedFieldDecl(FieldDecl *Field) {
|
||||
llvm::DenseMap<FieldDecl *, FieldDecl *>::iterator Pos
|
||||
= InstantiatedFromUnnamedFieldDecl.find(Field);
|
||||
if (Pos == InstantiatedFromUnnamedFieldDecl.end())
|
||||
return nullptr;
|
||||
|
||||
return Pos->second;
|
||||
return InstantiatedFromUnnamedFieldDecl.lookup(Field);
|
||||
}
|
||||
|
||||
void ASTContext::setInstantiatedFromUnnamedFieldDecl(FieldDecl *Inst,
|
||||
|
@ -8994,11 +8994,7 @@ Expected<Attr *> ASTImporter::Import(const Attr *FromAttr) {
|
||||
}
|
||||
|
||||
Decl *ASTImporter::GetAlreadyImportedOrNull(const Decl *FromD) const {
|
||||
auto Pos = ImportedDecls.find(FromD);
|
||||
if (Pos != ImportedDecls.end())
|
||||
return Pos->second;
|
||||
else
|
||||
return nullptr;
|
||||
return ImportedDecls.lookup(FromD);
|
||||
}
|
||||
|
||||
TranslationUnitDecl *ASTImporter::GetFromTU(Decl *ToD) {
|
||||
|
@ -187,10 +187,7 @@ public:
|
||||
/// Implements the ASTImporter interface for tracking back a declaration
|
||||
/// to its original declaration it came from.
|
||||
Decl *GetOriginalDecl(Decl *To) override {
|
||||
auto It = ToOrigin.find(To);
|
||||
if (It != ToOrigin.end())
|
||||
return It->second;
|
||||
return nullptr;
|
||||
return ToOrigin.lookup(To);
|
||||
}
|
||||
|
||||
/// Whenever a DeclContext is imported, ensure that ExternalASTSource's origin
|
||||
@ -541,4 +538,3 @@ void ExternalASTMerger::FindExternalLexicalDecls(
|
||||
return false;
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -44,9 +44,7 @@ const Record::Base *Record::getBase(QualType T) const {
|
||||
return nullptr;
|
||||
|
||||
const RecordDecl *RD = T->getAs<RecordType>()->getDecl();
|
||||
if (auto It = BaseMap.find(RD); It != BaseMap.end())
|
||||
return It->second;
|
||||
return nullptr;
|
||||
return BaseMap.lookup(RD);
|
||||
}
|
||||
|
||||
const Record::Base *Record::getVirtualBase(const RecordDecl *FD) const {
|
||||
|
Loading…
x
Reference in New Issue
Block a user