mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-01-08 04:11:27 +00:00
TableGen: use auto and for-range
llvm-svn: 216348
This commit is contained in:
parent
f154999a11
commit
1e8ed68e13
@ -2014,16 +2014,14 @@ void RecordKeeper::dump() const { errs() << *this; }
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
@ -2038,10 +2036,9 @@ RecordKeeper::getAllDerivedDefinitions(const std::string &ClassName) const {
|
||||
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;
|
||||
}
|
||||
|
@ -69,19 +69,15 @@ SMLoc CTagsEmitter::locate(const Record *R) {
|
||||
}
|
||||
|
||||
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";
|
||||
|
@ -277,11 +277,10 @@ void PseudoLoweringEmitter::run(raw_ostream &o) {
|
||||
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.
|
||||
|
Loading…
Reference in New Issue
Block a user