}
}
- StringRef &FoundStr = MangledDeclNames[CanonicalGD];
- if (!FoundStr.empty())
- return FoundStr;
+ auto FoundName = MangledDeclNames.find(CanonicalGD);
+ if (FoundName != MangledDeclNames.end())
+ return FoundName->second;
const auto *ND = cast<NamedDecl>(GD.getDecl());
SmallString<256> Buffer;
// Keep the first result in the case of a mangling collision.
auto Result = Manglings.insert(std::make_pair(Str, GD));
- assert(&FoundStr == &MangledDeclNames[CanonicalGD] && "FoundStr is invalidated!");
- assert(FoundStr.empty() && "FoundStr is not empty!");
- return FoundStr = Result.first->first();
+ assert(MangledDeclNames.find(CanonicalGD) == MangledDeclNames.end() &&
+ "CanonicalGD is already mangled.");
+ return MangledDeclNames[CanonicalGD] = Result.first->first();
}
StringRef CodeGenModule::getBlockMangledName(GlobalDecl GD,