diff options
author | David Greene <greened@obbligato.org> | 2011-08-10 18:27:46 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2011-08-10 18:27:46 +0000 |
commit | 0d886401b3ec09b0c2d267942b07702a2f0740f4 (patch) | |
tree | cfd3dca0884b735b192328cd3289acf94a9d906e /utils/TableGen/Record.h | |
parent | 0b18d59435a7c01a433ac69845e6d8e1ad66ce8b (diff) | |
download | external_llvm-0d886401b3ec09b0c2d267942b07702a2f0740f4.zip external_llvm-0d886401b3ec09b0c2d267942b07702a2f0740f4.tar.gz external_llvm-0d886401b3ec09b0c2d267942b07702a2f0740f4.tar.bz2 |
Make Record Name an Init
Use an Init (ultimately a StringInit) to represent the Record name.
This allows the name to be composed by standard TableGen operators.
This will enable us to get rid of the ugly #NAME# hack processing and
naturally replace it with operators. It also increases flexibility
and power of the TableGen language by allowing record identifiers to
be computed dynamically.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@137232 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils/TableGen/Record.h')
-rw-r--r-- | utils/TableGen/Record.h | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/utils/TableGen/Record.h b/utils/TableGen/Record.h index 802eaed..8e97530 100644 --- a/utils/TableGen/Record.h +++ b/utils/TableGen/Record.h @@ -1373,7 +1373,7 @@ class Record { // Unique record ID. unsigned ID; - std::string Name; + Init *Name; SMLoc Loc; std::vector<std::string> TemplateArgs; std::vector<RecordVal> Values; @@ -1384,11 +1384,13 @@ class Record { DefInit *TheInit; + void checkName(); + public: // Constructs a record. explicit Record(const std::string &N, SMLoc loc, RecordKeeper &records) : - ID(LastID++), Name(N), Loc(loc), TrackedRecords(records), TheInit(0) {} + ID(LastID++), Name(StringInit::get(N)), Loc(loc), TrackedRecords(records), TheInit(0) {} ~Record() {} @@ -1397,7 +1399,8 @@ public: unsigned getID() const { return ID; } - const std::string &getName() const { return Name; } + const std::string &getName() const; + void setName(Init *Name); // Also updates RecordKeeper. void setName(const std::string &Name); // Also updates RecordKeeper. SMLoc getLoc() const { return Loc; } |