aboutsummaryrefslogtreecommitdiff
path: root/llvm/lib/TableGen/TGParser.cpp
diff options
context:
space:
mode:
authorDavid Greene <greened@obbligato.org>2011-10-19 13:04:21 +0000
committerDavid Greene <greened@obbligato.org>2011-10-19 13:04:21 +0000
commit232bd6017cf877d7b5f10dd48d50d2acbd321a95 (patch)
tree104212b52edfeb8a18385503506ca0e95f99d359 /llvm/lib/TableGen/TGParser.cpp
parentd4263a6ad007aa538e180ed559fac125eed520a2 (diff)
downloadllvm-232bd6017cf877d7b5f10dd48d50d2acbd321a95.zip
llvm-232bd6017cf877d7b5f10dd48d50d2acbd321a95.tar.gz
llvm-232bd6017cf877d7b5f10dd48d50d2acbd321a95.tar.bz2
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
Diffstat (limited to 'llvm/lib/TableGen/TGParser.cpp')
-rw-r--r--llvm/lib/TableGen/TGParser.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/llvm/lib/TableGen/TGParser.cpp b/llvm/lib/TableGen/TGParser.cpp
index d864b4f..fdf88d86 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.