aboutsummaryrefslogtreecommitdiffstats
path: root/utils
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2005-09-30 04:42:31 +0000
committerChris Lattner <sabre@nondot.org>2005-09-30 04:42:31 +0000
commit583a0249b61ec5b31600fa59bfbb098ad55865c7 (patch)
tree2109ed06efaa1233d428ed1fd0094d60dd6b3ff6 /utils
parentef242b1cccb47b0d2f4f5acde18143712ccc79d3 (diff)
downloadexternal_llvm-583a0249b61ec5b31600fa59bfbb098ad55865c7.zip
external_llvm-583a0249b61ec5b31600fa59bfbb098ad55865c7.tar.gz
external_llvm-583a0249b61ec5b31600fa59bfbb098ad55865c7.tar.bz2
Generate a parse error instead of a checked exception if template args are
used on a def. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@23545 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'utils')
-rw-r--r--utils/TableGen/FileParser.y24
1 files changed, 10 insertions, 14 deletions
diff --git a/utils/TableGen/FileParser.y b/utils/TableGen/FileParser.y
index 8fc7042..9be816e 100644
--- a/utils/TableGen/FileParser.y
+++ b/utils/TableGen/FileParser.y
@@ -559,15 +559,15 @@ DefName : ObjectName {
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 @@ ObjectBody : OptTemplateArgList ClassList {
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;
};