diff options
author | David Greene <greened@obbligato.org> | 2011-10-19 13:02:29 +0000 |
---|---|---|
committer | David Greene <greened@obbligato.org> | 2011-10-19 13:02:29 +0000 |
commit | 28438acd466111b0d67d1f26b8cc730d2180fc1e (patch) | |
tree | 5de6cb43dc0ce5f570abc460ad07be1d71f62834 /llvm/lib/TableGen | |
parent | 00caf09b68cf547a43abcfd7ef7f8dc0b016f927 (diff) | |
download | bcm5719-llvm-28438acd466111b0d67d1f26b8cc730d2180fc1e.tar.gz bcm5719-llvm-28438acd466111b0d67d1f26b8cc730d2180fc1e.zip |
Add Value Accessors
Add accessors to get Record values by Init name. This lets us look up
Record values whose names are not yet fully resolved. More work
toward paste.
llvm-svn: 142496
Diffstat (limited to 'llvm/lib/TableGen')
-rw-r--r-- | llvm/lib/TableGen/Record.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/llvm/lib/TableGen/Record.cpp b/llvm/lib/TableGen/Record.cpp index b7c51cae953..06a41c9eb26 100644 --- a/llvm/lib/TableGen/Record.cpp +++ b/llvm/lib/TableGen/Record.cpp @@ -1726,6 +1726,18 @@ void Record::setName(const std::string &Name) { setName(StringInit::get(Name)); } +const RecordVal *Record::getValue(Init *Name) const { + for (unsigned i = 0, e = Values.size(); i != e; ++i) + if (Values[i].getNameInit() == Name) return &Values[i]; + return 0; +} + +RecordVal *Record::getValue(Init *Name) { + for (unsigned i = 0, e = Values.size(); i != e; ++i) + if (Values[i].getNameInit() == Name) return &Values[i]; + return 0; +} + /// 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. |