From 232bd6017cf877d7b5f10dd48d50d2acbd321a95 Mon Sep 17 00:00:00 2001 From: David Greene Date: Wed, 19 Oct 2011 13:04:21 +0000 Subject: Use Parse Mode Augment the value parser to respect the parse mode and not error if an ID doesn't map to an object and we are in name parsing mode. llvm-svn: 142520 --- llvm/lib/TableGen/TGParser.cpp | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) (limited to 'llvm/lib/TableGen') diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp index d864b4f69d8..fdf88d86ec4 100644 --- a/llvm/lib/TableGen/TGParser.cpp +++ b/llvm/lib/TableGen/TGParser.cpp @@ -677,11 +677,18 @@ Init *TGParser::ParseIDValue(Record *CurRec, } } + if (Mode == ParseNameMode) + return StringInit::get(Name); + if (Record *D = Records.getDef(Name)) return DefInit::get(D); - Error(NameLoc, "Variable not defined: '" + Name + "'"); - return 0; + if (Mode == ParseValueMode) { + Error(NameLoc, "Variable not defined: '" + Name + "'"); + return 0; + } + + return StringInit::get(Name); } /// ParseOperation - Parse an operator. This returns null on error. -- cgit v1.2.3