[llvm-commits] CVS: llvm/utils/TableGen/FileParser.y
Chris Lattner
lattner at cs.uiuc.edu
Thu Sep 29 21:42:44 PDT 2005
Changes in directory llvm/utils/TableGen:
FileParser.y updated: 1.37 -> 1.38
---
Log message:
Generate a parse error instead of a checked exception if template args are
used on a def.
---
Diffs of the changes: (+10 -14)
FileParser.y | 24 ++++++++++--------------
1 files changed, 10 insertions(+), 14 deletions(-)
Index: llvm/utils/TableGen/FileParser.y
diff -u llvm/utils/TableGen/FileParser.y:1.37 llvm/utils/TableGen/FileParser.y:1.38
--- llvm/utils/TableGen/FileParser.y:1.37 Thu Sep 29 23:10:49 2005
+++ llvm/utils/TableGen/FileParser.y Thu Sep 29 23:42:31 2005
@@ -559,15 +559,15 @@
Records.addDef(CurRec);
};
-ObjectBody : OptTemplateArgList ClassList {
+ObjectBody : ClassList {
ParsingTemplateArgs = false;
- for (unsigned i = 0, e = $2->size(); i != e; ++i) {
- addSubClass((*$2)[i].first, *(*$2)[i].second);
+ for (unsigned i = 0, e = $1->size(); i != e; ++i) {
+ addSubClass((*$1)[i].first, *(*$1)[i].second);
// Delete the template arg values for the class
- delete (*$2)[i].second;
+ delete (*$1)[i].second;
}
- delete $2; // Delete the class list...
-
+ delete $1; // Delete the class list...
+
// Process any variables on the set stack...
for (unsigned i = 0, e = LetStack.size(); i != e; ++i)
for (unsigned j = 0, e = LetStack[i].size(); j != e; ++j)
@@ -579,19 +579,15 @@
CurRec = 0;
};
-ClassInst : CLASS ClassName ObjectBody {
- $$ = $3;
-};
+ClassInst : CLASS ClassName OptTemplateArgList ObjectBody {
+ $$ = $4;
+ };
DefInst : DEF DefName ObjectBody {
$3->resolveReferences();
// If ObjectBody has template arguments, it's an error.
- if (!$3->getTemplateArgs().empty()) {
- err() << "Def '" << $3->getName()
- << "' is not permitted to have template arguments!\n";
- exit(1);
- }
+ assert($3->getTemplateArgs().empty() && "How'd this get template args?");
$$ = $3;
};
More information about the llvm-commits
mailing list