1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-11-22 10:42:39 +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; return Name;
assert(GUIDToFuncNameMap && "GUIDToFuncNameMap needs to be popluated first"); assert(GUIDToFuncNameMap && "GUIDToFuncNameMap needs to be popluated first");
auto iter = GUIDToFuncNameMap->find(std::stoull(Name.data())); return GUIDToFuncNameMap->lookup(std::stoull(Name.data()));
if (iter == GUIDToFuncNameMap->end())
return StringRef();
return iter->second;
} }
/// Returns the line offset to the start line of the subprogram. /// 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 we have an equals sign, remember the value.
if (EqualPos == StringRef::npos) { if (EqualPos == StringRef::npos) {
// Look up the option. // Look up the option.
auto I = Sub.OptionsMap.find(Arg); return Sub.OptionsMap.lookup(Arg);
if (I == Sub.OptionsMap.end())
return nullptr;
return I != Sub.OptionsMap.end() ? I->second : nullptr;
} }
// If the argument before the = is a valid option name and the option allows // 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 { const Symbol *Object::findSymbol(size_t UniqueId) const {
auto It = SymbolMap.find(UniqueId); return SymbolMap.lookup(UniqueId);
if (It == SymbolMap.end())
return nullptr;
return It->second;
} }
Error Object::removeSymbols( Error Object::removeSymbols(
@ -86,10 +83,7 @@ void Object::updateSections() {
} }
const Section *Object::findSection(ssize_t UniqueId) const { const Section *Object::findSection(ssize_t UniqueId) const {
auto It = SectionMap.find(UniqueId); return SectionMap.lookup(UniqueId);
if (It == SectionMap.end())
return nullptr;
return It->second;
} }
void Object::removeSections(function_ref<bool(const Section &)> ToRemove) { void Object::removeSections(function_ref<bool(const Section &)> ToRemove) {

View File

@ -1238,8 +1238,7 @@ CodeGenSubRegIndex *CodeGenRegBank::getSubRegIdx(Record *Def) {
const CodeGenSubRegIndex * const CodeGenSubRegIndex *
CodeGenRegBank::findSubRegIdx(const Record* Def) const { CodeGenRegBank::findSubRegIdx(const Record* Def) const {
auto I = Def2SubRegIdx.find(Def); return Def2SubRegIdx.lookup(Def);
return (I == Def2SubRegIdx.end()) ? nullptr : I->second;
} }
CodeGenRegister *CodeGenRegBank::getReg(Record *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, /// getRegisterByName - If there is a register with the specific AsmName,
/// return it. /// return it.
const CodeGenRegister *CodeGenTarget::getRegisterByName(StringRef Name) const { const CodeGenRegister *CodeGenTarget::getRegisterByName(StringRef Name) const {
const StringMap<CodeGenRegister*> &Regs = getRegBank().getRegistersByName(); return getRegBank().getRegistersByName().lookup(Name);
StringMap<CodeGenRegister*>::const_iterator I = Regs.find(Name);
if (I == Regs.end())
return nullptr;
return I->second;
} }
std::vector<ValueTypeByHwMode> CodeGenTarget::getRegisterVTs(Record *R) std::vector<ValueTypeByHwMode> CodeGenTarget::getRegisterVTs(Record *R)

View File

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