diff options
| author | David Greene <greened@obbligato.org> | 2011-10-19 13:04:13 +0000 |
|---|---|---|
| committer | David Greene <greened@obbligato.org> | 2011-10-19 13:04:13 +0000 |
| commit | e338565757bfcfe9d762751c976684f66954fb45 (patch) | |
| tree | 53efedeb81f0056894aa09af2c241dd0cf291d19 /lib | |
| parent | 22dde7e655b76f75bf11e86129410a7dcbfac3ba (diff) | |
| download | external_llvm-e338565757bfcfe9d762751c976684f66954fb45.zip external_llvm-e338565757bfcfe9d762751c976684f66954fb45.tar.gz external_llvm-e338565757bfcfe9d762751c976684f66954fb45.tar.bz2 | |
Add NAME Member
Add a Value named "NAME" to each Record. This will be set to the def or defm
name when instantiating multiclasses. This will replace the #NAME# processing
hack once paste functionality is in place.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142518 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/TableGen/Record.cpp | 5 | ||||
| -rw-r--r-- | lib/TableGen/TGParser.cpp | 2 |
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/TableGen/Record.cpp b/lib/TableGen/Record.cpp index a22c80c..92559d1 100644 --- a/lib/TableGen/Record.cpp +++ b/lib/TableGen/Record.cpp @@ -1686,6 +1686,11 @@ unsigned Record::LastID = 0; void Record::init() { checkName(); + + // Every record potentially has a def at the top. This value is + // replaced with the top-level def name at instantiation time. + RecordVal DN("NAME", StringRecTy::get(), 0); + addValue(DN); } void Record::checkName() { diff --git a/lib/TableGen/TGParser.cpp b/lib/TableGen/TGParser.cpp index 45625f9..085136d 100644 --- a/lib/TableGen/TGParser.cpp +++ b/lib/TableGen/TGParser.cpp @@ -1744,7 +1744,7 @@ bool TGParser::ParseClass() { Record *CurRec = Records.getClass(Lex.getCurStrVal()); if (CurRec) { // If the body was previously defined, this is an error. - if (!CurRec->getValues().empty() || + if (CurRec->getValues().size() > 1 || // Account for NAME. !CurRec->getSuperClasses().empty() || !CurRec->getTemplateArgs().empty()) return TokError("Class '" + CurRec->getNameInitAsString() |
