raw_ostream &llvm::operator<<(raw_ostream &OS, const RecordKeeper &RK) {
OS << "------------- Classes -----------------\n";
- const std::map<std::string, Record*> &Classes = RK.getClasses();
- for (std::map<std::string, Record*>::const_iterator I = Classes.begin(),
- E = Classes.end(); I != E; ++I)
- OS << "class " << *I->second;
+ const auto &Classes = RK.getClasses();
+ for (const auto &C : Classes)
+ OS << "class " << *C.second;
OS << "------------- Defs -----------------\n";
- const std::map<std::string, Record*> &Defs = RK.getDefs();
- for (std::map<std::string, Record*>::const_iterator I = Defs.begin(),
- E = Defs.end(); I != E; ++I)
- OS << "def " << *I->second;
+ const auto &Defs = RK.getDefs();
+ for (const auto &D : Defs)
+ OS << "def " << *D.second;
return OS;
}
PrintFatalError("ERROR: Couldn't find the `" + ClassName + "' class!\n");
std::vector<Record*> Defs;
- for (std::map<std::string, Record*>::const_iterator I = getDefs().begin(),
- E = getDefs().end(); I != E; ++I)
- if (I->second->isSubClassOf(Class))
- Defs.push_back(I->second);
+ for (const auto &D : getDefs())
+ if (D.second->isSubClassOf(Class))
+ Defs.push_back(D.second);
return Defs;
}
}
void CTagsEmitter::run(raw_ostream &OS) {
- const std::map<std::string, Record *> &Classes = Records.getClasses();
- const std::map<std::string, Record *> &Defs = Records.getDefs();
+ const auto &Classes = Records.getClasses();
+ const auto &Defs = Records.getDefs();
std::vector<Tag> Tags;
// Collect tags.
Tags.reserve(Classes.size() + Defs.size());
- for (std::map<std::string, Record *>::const_iterator I = Classes.begin(),
- E = Classes.end();
- I != E; ++I)
- Tags.push_back(Tag(I->first, locate(I->second)));
- for (std::map<std::string, Record *>::const_iterator I = Defs.begin(),
- E = Defs.end();
- I != E; ++I)
- Tags.push_back(Tag(I->first, locate(I->second)));
+ for (const auto &C : Classes)
+ Tags.push_back(Tag(C.first, locate(C.second)));
+ for (const auto &D : Defs)
+ Tags.push_back(Tag(D.first, locate(D.second)));
// Emit tags.
std::sort(Tags.begin(), Tags.end());
OS << "!_TAG_FILE_FORMAT\t1\t/original ctags format/\n";
assert(InstructionClass && "Instruction class definition missing!");
std::vector<Record*> Insts;
- for (std::map<std::string, Record*>::const_iterator I =
- Records.getDefs().begin(), E = Records.getDefs().end(); I != E; ++I) {
- if (I->second->isSubClassOf(ExpansionClass) &&
- I->second->isSubClassOf(InstructionClass))
- Insts.push_back(I->second);
+ for (const auto &D : Records.getDefs()) {
+ if (D.second->isSubClassOf(ExpansionClass) &&
+ D.second->isSubClassOf(InstructionClass))
+ Insts.push_back(D.second);
}
// Process the pseudo expansion definitions, validating them as we do so.