mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
Add a setName method to Record.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22911 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -589,6 +589,18 @@ void RecordVal::print(std::ostream &OS, bool PrintSem) const {
|
|||||||
if (PrintSem) OS << ";\n";
|
if (PrintSem) OS << ";\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Record::setName(const std::string &Name) {
|
||||||
|
if (Records.getDef(getName()) == this) {
|
||||||
|
Records.removeDef(getName());
|
||||||
|
this->Name = Name;
|
||||||
|
Records.addDef(this);
|
||||||
|
} else {
|
||||||
|
Records.removeClass(getName());
|
||||||
|
this->Name = Name;
|
||||||
|
Records.addClass(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// resolveReferencesTo - If anything in this record refers to RV, replace the
|
/// resolveReferencesTo - If anything in this record refers to RV, replace the
|
||||||
/// reference to RV with the RHS of RV. If RV is null, we resolve all possible
|
/// reference to RV with the RHS of RV. If RV is null, we resolve all possible
|
||||||
/// references.
|
/// references.
|
||||||
|
@@ -898,6 +898,7 @@ public:
|
|||||||
~Record() {}
|
~Record() {}
|
||||||
|
|
||||||
const std::string &getName() const { return Name; }
|
const std::string &getName() const { return Name; }
|
||||||
|
void setName(const std::string &Name); // Also updates RecordKeeper.
|
||||||
const std::vector<std::string> &getTemplateArgs() const {
|
const std::vector<std::string> &getTemplateArgs() const {
|
||||||
return TemplateArgs;
|
return TemplateArgs;
|
||||||
}
|
}
|
||||||
@@ -1058,6 +1059,19 @@ public:
|
|||||||
Defs.insert(std::make_pair(R->getName(), R));
|
Defs.insert(std::make_pair(R->getName(), R));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// removeClass - Remove, but do not delete, the specified record.
|
||||||
|
///
|
||||||
|
void removeClass(const std::string &Name) {
|
||||||
|
assert(Classes.count(Name) && "Class does not exist!");
|
||||||
|
Classes.erase(Name);
|
||||||
|
}
|
||||||
|
/// removeDef - Remove, but do not delete, the specified record.
|
||||||
|
///
|
||||||
|
void removeDef(const std::string &Name) {
|
||||||
|
assert(Defs.count(Name) && "Def does not exist!");
|
||||||
|
Defs.erase(Name);
|
||||||
|
}
|
||||||
|
|
||||||
//===--------------------------------------------------------------------===//
|
//===--------------------------------------------------------------------===//
|
||||||
// High-level helper methods, useful for tablegen backends...
|
// High-level helper methods, useful for tablegen backends...
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user