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
/// reference to RV with the RHS of RV. If RV is null, we resolve all possible
/// references.
~Record() {}
const std::string &getName() const { return Name; }
+ void setName(const std::string &Name); // Also updates RecordKeeper.
const std::vector<std::string> &getTemplateArgs() const {
return TemplateArgs;
}
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...