1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-25 20:23:11 +01:00

[llvm] Use *Map::lookup (NFC)

This commit is contained in:
Kazu Hirata 2021-01-01 12:44:54 -08:00
parent 56a8e347fc
commit 6b0d4e7fd3
6 changed files with 7 additions and 28 deletions

View File

@ -796,10 +796,7 @@ public:
return Name;
assert(GUIDToFuncNameMap && "GUIDToFuncNameMap needs to be popluated first");
auto iter = GUIDToFuncNameMap->find(std::stoull(Name.data()));
if (iter == GUIDToFuncNameMap->end())
return StringRef();
return iter->second;
return GUIDToFuncNameMap->lookup(std::stoull(Name.data()));
}
/// Returns the line offset to the start line of the subprogram.

View File

@ -531,11 +531,7 @@ Option *CommandLineParser::LookupOption(SubCommand &Sub, StringRef &Arg,
// If we have an equals sign, remember the value.
if (EqualPos == StringRef::npos) {
// Look up the option.
auto I = Sub.OptionsMap.find(Arg);
if (I == Sub.OptionsMap.end())
return nullptr;
return I != Sub.OptionsMap.end() ? I->second : nullptr;
return Sub.OptionsMap.lookup(Arg);
}
// If the argument before the = is a valid option name and the option allows

View File

@ -31,10 +31,7 @@ void Object::updateSymbols() {
}
const Symbol *Object::findSymbol(size_t UniqueId) const {
auto It = SymbolMap.find(UniqueId);
if (It == SymbolMap.end())
return nullptr;
return It->second;
return SymbolMap.lookup(UniqueId);
}
Error Object::removeSymbols(
@ -86,10 +83,7 @@ void Object::updateSections() {
}
const Section *Object::findSection(ssize_t UniqueId) const {
auto It = SectionMap.find(UniqueId);
if (It == SectionMap.end())
return nullptr;
return It->second;
return SectionMap.lookup(UniqueId);
}
void Object::removeSections(function_ref<bool(const Section &)> ToRemove) {

View File

@ -1238,8 +1238,7 @@ CodeGenSubRegIndex *CodeGenRegBank::getSubRegIdx(Record *Def) {
const CodeGenSubRegIndex *
CodeGenRegBank::findSubRegIdx(const Record* Def) const {
auto I = Def2SubRegIdx.find(Def);
return (I == Def2SubRegIdx.end()) ? nullptr : I->second;
return Def2SubRegIdx.lookup(Def);
}
CodeGenRegister *CodeGenRegBank::getReg(Record *Def) {

View File

@ -393,11 +393,7 @@ void CodeGenTarget::ReadRegAltNameIndices() const {
/// getRegisterByName - If there is a register with the specific AsmName,
/// return it.
const CodeGenRegister *CodeGenTarget::getRegisterByName(StringRef Name) const {
const StringMap<CodeGenRegister*> &Regs = getRegBank().getRegistersByName();
StringMap<CodeGenRegister*>::const_iterator I = Regs.find(Name);
if (I == Regs.end())
return nullptr;
return I->second;
return getRegBank().getRegistersByName().lookup(Name);
}
std::vector<ValueTypeByHwMode> CodeGenTarget::getRegisterVTs(Record *R)

View File

@ -353,10 +353,7 @@ public:
void declareOperand(unsigned InstrID, unsigned OpIdx);
GIMatchTreeInstrInfo *getInstrInfo(unsigned ID) const {
auto I = InstrIDToInfo.find(ID);
if (I != InstrIDToInfo.end())
return I->second;
return nullptr;
return InstrIDToInfo.lookup(ID);
}
void dump(raw_ostream &OS) const {