summaryrefslogtreecommitdiff
path: root/utils/TableGen/Record.cpp
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-08-19 17:58:11 +0000
committerChris Lattner <sabre@nondot.org>2005-08-19 17:58:11 +0000
commit936dd9274aca2f2ccd0e10dafe83a22767475fa6 (patch)
tree681002d2e0a61b6edcae67c9ea1d90c3aeb2f32e /utils/TableGen/Record.cpp
parent0e384b66a781fc0ff005f475a7ab151afa054fb0 (diff)
downloadllvm-936dd9274aca2f2ccd0e10dafe83a22767475fa6.tar.gz
llvm-936dd9274aca2f2ccd0e10dafe83a22767475fa6.tar.bz2
llvm-936dd9274aca2f2ccd0e10dafe83a22767475fa6.tar.xz
Add a setName method to Record.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@22911 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/Record.cpp')
-rw-r--r--utils/TableGen/Record.cpp12
1 files changed, 12 insertions, 0 deletions
diff --git a/utils/TableGen/Record.cpp b/utils/TableGen/Record.cpp
index 16b902b562..077476d07b 100644
--- a/utils/TableGen/Record.cpp
+++ b/utils/TableGen/Record.cpp
@@ -589,6 +589,18 @@ void RecordVal::print(std::ostream &OS, bool PrintSem) const {
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.