[clang-tidy] Avoid repeated hash lookups (NFC) (#127370)
This commit is contained in:
parent
1c87e4739f
commit
0bae0bf8ba
@ -179,15 +179,15 @@ static bool checkOverrideByDerivedMethod(const CXXMethodDecl *BaseMD,
|
||||
|
||||
bool VirtualNearMissCheck::isPossibleToBeOverridden(
|
||||
const CXXMethodDecl *BaseMD) {
|
||||
auto Iter = PossibleMap.find(BaseMD);
|
||||
if (Iter != PossibleMap.end())
|
||||
auto [Iter, Inserted] = PossibleMap.try_emplace(BaseMD);
|
||||
if (!Inserted)
|
||||
return Iter->second;
|
||||
|
||||
bool IsPossible = !BaseMD->isImplicit() && !isa<CXXConstructorDecl>(BaseMD) &&
|
||||
!isa<CXXDestructorDecl>(BaseMD) && BaseMD->isVirtual() &&
|
||||
!BaseMD->isOverloadedOperator() &&
|
||||
!isa<CXXConversionDecl>(BaseMD);
|
||||
PossibleMap[BaseMD] = IsPossible;
|
||||
Iter->second = IsPossible;
|
||||
return IsPossible;
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user