mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2024-12-26 21:32:10 +00:00
Add and use a new method
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7682 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
2b8b2b4aee
commit
a40e5ad69f
@ -703,6 +703,13 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isSubClassOf(const std::string &Name) const {
|
||||
for (unsigned i = 0, e = SuperClasses.size(); i != e; ++i)
|
||||
if (SuperClasses[i]->getName() == Name)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void addSuperClass(Record *R) {
|
||||
assert(!isSubClassOf(R) && "Already subclassing record!");
|
||||
SuperClasses.push_back(R);
|
||||
|
@ -73,7 +73,6 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
Records.getAllDerivedDefinitions("RegisterClass");
|
||||
|
||||
std::vector<Record*> Registers = Records.getAllDerivedDefinitions("Register");
|
||||
Record *RegisterClass = Records.getClass("Register");
|
||||
|
||||
std::set<Record*> RegistersFound;
|
||||
std::vector<std::string> RegClassNames;
|
||||
@ -99,7 +98,7 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
DefInit *RegDef = dynamic_cast<DefInit*>(RegList->getElement(i));
|
||||
if (!RegDef) throw "Register class member is not a record!";
|
||||
Record *Reg = RegDef->getDef();
|
||||
if (!Reg->isSubClassOf(RegisterClass))
|
||||
if (!Reg->isSubClassOf("Register"))
|
||||
throw "Register Class member '" + Reg->getName() +
|
||||
" does not derive from the Register class!";
|
||||
if (RegistersFound.count(Reg))
|
||||
|
@ -703,6 +703,13 @@ public:
|
||||
return false;
|
||||
}
|
||||
|
||||
bool isSubClassOf(const std::string &Name) const {
|
||||
for (unsigned i = 0, e = SuperClasses.size(); i != e; ++i)
|
||||
if (SuperClasses[i]->getName() == Name)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
void addSuperClass(Record *R) {
|
||||
assert(!isSubClassOf(R) && "Already subclassing record!");
|
||||
SuperClasses.push_back(R);
|
||||
|
@ -73,7 +73,6 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
Records.getAllDerivedDefinitions("RegisterClass");
|
||||
|
||||
std::vector<Record*> Registers = Records.getAllDerivedDefinitions("Register");
|
||||
Record *RegisterClass = Records.getClass("Register");
|
||||
|
||||
std::set<Record*> RegistersFound;
|
||||
std::vector<std::string> RegClassNames;
|
||||
@ -99,7 +98,7 @@ void RegisterInfoEmitter::run(std::ostream &OS) {
|
||||
DefInit *RegDef = dynamic_cast<DefInit*>(RegList->getElement(i));
|
||||
if (!RegDef) throw "Register class member is not a record!";
|
||||
Record *Reg = RegDef->getDef();
|
||||
if (!Reg->isSubClassOf(RegisterClass))
|
||||
if (!Reg->isSubClassOf("Register"))
|
||||
throw "Register Class member '" + Reg->getName() +
|
||||
" does not derive from the Register class!";
|
||||
if (RegistersFound.count(Reg))
|
||||
|
Loading…
Reference in New Issue
Block a user