[llvm-commits] [llvm] r142520 - /llvm/trunk/lib/TableGen/TGParser.cpp
David Greene
greened at obbligato.org
Wed Oct 19 06:04:21 PDT 2011
Author: greened
Date: Wed Oct 19 08:04:21 2011
New Revision: 142520
URL: http://llvm.org/viewvc/llvm-project?rev=142520&view=rev
Log:
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.
Modified:
llvm/trunk/lib/TableGen/TGParser.cpp
Modified: llvm/trunk/lib/TableGen/TGParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/TableGen/TGParser.cpp?rev=142520&r1=142519&r2=142520&view=diff
==============================================================================
--- llvm/trunk/lib/TableGen/TGParser.cpp (original)
+++ llvm/trunk/lib/TableGen/TGParser.cpp Wed Oct 19 08:04:21 2011
@@ -677,11 +677,18 @@
}
}
+ 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.
More information about the llvm-commits
mailing list