[clang] Call *set::insert without checking membership first (NFC)

This commit is contained in:
Kazu Hirata
2022-06-18 10:41:26 -07:00
parent f8b5be64ab
commit 80c12bdb3b
3 changed files with 4 additions and 8 deletions

View File

@@ -457,8 +457,7 @@ Value *Environment::createValueUnlessSelfReferential(
QualType PointeeType = Type->castAs<ReferenceType>()->getPointeeType();
auto &PointeeLoc = createStorageLocation(PointeeType);
if (!Visited.contains(PointeeType.getCanonicalType())) {
Visited.insert(PointeeType.getCanonicalType());
if (Visited.insert(PointeeType.getCanonicalType()).second) {
Value *PointeeVal = createValueUnlessSelfReferential(
PointeeType, Visited, Depth, CreatedValuesCount);
Visited.erase(PointeeType.getCanonicalType());
@@ -475,8 +474,7 @@ Value *Environment::createValueUnlessSelfReferential(
QualType PointeeType = Type->castAs<PointerType>()->getPointeeType();
auto &PointeeLoc = createStorageLocation(PointeeType);
if (!Visited.contains(PointeeType.getCanonicalType())) {
Visited.insert(PointeeType.getCanonicalType());
if (Visited.insert(PointeeType.getCanonicalType()).second) {
Value *PointeeVal = createValueUnlessSelfReferential(
PointeeType, Visited, Depth, CreatedValuesCount);
Visited.erase(PointeeType.getCanonicalType());

View File

@@ -14473,8 +14473,7 @@ static void RecordModifiableNonNullParam(Sema &S, const Expr *Exp) {
if (!FD->hasAttr<NonNullAttr>() && !Param->hasAttr<NonNullAttr>())
return;
if (FunctionScopeInfo *FD = S.getCurFunction())
if (!FD->ModifiedNonNullParams.count(Param))
FD->ModifiedNonNullParams.insert(Param);
FD->ModifiedNonNullParams.insert(Param);
}
/// CheckIndirectionOperand - Type check unary indirection (prefix '*').

View File

@@ -4321,9 +4321,8 @@ void EmitClangAttrParsedAttrKinds(RecordKeeper &Records, raw_ostream &OS) {
if (Attr.isSubClassOf("TargetSpecificAttr") &&
!Attr.isValueUnset("ParseKind")) {
AttrName = std::string(Attr.getValueAsString("ParseKind"));
if (Seen.find(AttrName) != Seen.end())
if (!Seen.insert(AttrName).second)
continue;
Seen.insert(AttrName);
} else
AttrName = NormalizeAttrName(StringRef(Attr.getName())).str();