From 18226e0cf16873179d7193401959b17fbc9fbc12 Mon Sep 17 00:00:00 2001 From: Chris Lattner Date: Wed, 30 Jul 2003 05:17:35 +0000 Subject: [PATCH] Fix coredump for when an ID is used illegally outside a record git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@7411 91177308-0d34-0410-b5e6-96231b3b80d8 --- support/tools/TableGen/FileParser.y | 4 ++++ utils/TableGen/FileParser.y | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/support/tools/TableGen/FileParser.y b/support/tools/TableGen/FileParser.y index f8fa16de2a5..55938f47ea7 100644 --- a/support/tools/TableGen/FileParser.y +++ b/support/tools/TableGen/FileParser.y @@ -245,6 +245,10 @@ Value : INTVAL { $$ = Init; delete $2; } | ID { + if (CurRec == 0) { + err() << "Def/Class name '" << *$1 << "' not allowed here!\n"; + abort(); + } if (const RecordVal *RV = CurRec->getValue(*$1)) { $$ = new VarInit(*$1, RV->getType()); } else if (Record *D = Records.getDef(*$1)) { diff --git a/utils/TableGen/FileParser.y b/utils/TableGen/FileParser.y index f8fa16de2a5..55938f47ea7 100644 --- a/utils/TableGen/FileParser.y +++ b/utils/TableGen/FileParser.y @@ -245,6 +245,10 @@ Value : INTVAL { $$ = Init; delete $2; } | ID { + if (CurRec == 0) { + err() << "Def/Class name '" << *$1 << "' not allowed here!\n"; + abort(); + } if (const RecordVal *RV = CurRec->getValue(*$1)) { $$ = new VarInit(*$1, RV->getType()); } else if (Record *D = Records.getDef(*$1)) {