[clang-tidy] Avoid repeated map lookups (NFC) (#127167)

This commit is contained in:
Kazu Hirata 2025-02-14 01:33:51 -08:00 committed by GitHub
parent 5be4536d09
commit 1bc2f1c83f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -119,13 +119,12 @@ void NonConstParameterCheck::addParm(const ParmVarDecl *Parm) {
T->getPointeeType()->isFloatingType()))
return;
if (Parameters.find(Parm) != Parameters.end())
auto [It, Inserted] = Parameters.try_emplace(Parm);
if (!Inserted)
return;
ParmInfo PI;
PI.IsReferenced = false;
PI.CanBeConst = true;
Parameters[Parm] = PI;
It->second.IsReferenced = false;
It->second.CanBeConst = true;
}
void NonConstParameterCheck::setReferenced(const DeclRefExpr *Ref) {