aboutsummaryrefslogtreecommitdiffstats
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
commitbbec279d8eb0d7e27c2bf6e4da4f44286451d142 (patch)
treee8606ccf41a174ddd472a2a4fcee5477e5ad352c
parentf3744a0cf9f622e0879a80c1fdcb0f6072e5a6c3 (diff)
downloadexternal_llvm-bbec279d8eb0d7e27c2bf6e4da4f44286451d142.zip
external_llvm-bbec279d8eb0d7e27c2bf6e4da4f44286451d142.tar.gz
external_llvm-bbec279d8eb0d7e27c2bf6e4da4f44286451d142.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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@142520 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/TableGen/TGParser.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/lib/TableGen/TGParser.cpp b/lib/TableGen/TGParser.cpp
index d864b4f..fdf88d8 100644
--- a/lib/TableGen/TGParser.cpp
+++ b/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.