summaryrefslogtreecommitdiffstats
path: root/llvm/lib/TableGen/TGParser.h
diff options
context:
space:
mode:
authorAlp Toker <alp@nuanti.com>2013-12-21 18:51:00 +0000
committerAlp Toker <alp@nuanti.com>2013-12-21 18:51:00 +0000
commitce91fe55692b6172d14a2408e5e4cd2eed4cab76 (patch)
tree79f2f08fc4d729d6964d70e4045f58dc4963d9eb /llvm/lib/TableGen/TGParser.h
parent888e935978fea8404a58e039491e3c3b3f92013f (diff)
downloadbcm5719-llvm-ce91fe55692b6172d14a2408e5e4cd2eed4cab76.tar.gz
bcm5719-llvm-ce91fe55692b6172d14a2408e5e4cd2eed4cab76.zip
TableGen: Generate valid identifiers for anonymous records
Backends like OptParserEmitter assume that record names can be used as valid identifiers. The period '.' in generated anonymous names broke that assumption, causing a build-time error and in practice forcing all records to be named. llvm-svn: 197869
Diffstat (limited to 'llvm/lib/TableGen/TGParser.h')
-rw-r--r--llvm/lib/TableGen/TGParser.h8
1 files changed, 6 insertions, 2 deletions
diff --git a/llvm/lib/TableGen/TGParser.h b/llvm/lib/TableGen/TGParser.h
index 044e3a02ba4..a5753458108 100644
--- a/llvm/lib/TableGen/TGParser.h
+++ b/llvm/lib/TableGen/TGParser.h
@@ -69,6 +69,8 @@ class TGParser {
// Record tracker
RecordKeeper &Records;
+ unsigned AnonCounter;
+
// A "named boolean" indicating how to parse identifiers. Usually
// identifiers map to some existing object but in special cases
// (e.g. parsing def names) no such object exists yet because we are
@@ -82,8 +84,8 @@ class TGParser {
};
public:
- TGParser(SourceMgr &SrcMgr, RecordKeeper &records) :
- Lex(SrcMgr), CurMultiClass(0), Records(records) {}
+ TGParser(SourceMgr &SrcMgr, RecordKeeper &records)
+ : Lex(SrcMgr), CurMultiClass(0), Records(records), AnonCounter(0) {}
/// ParseFile - Main entrypoint for parsing a tblgen file. These parser
/// routines return true on error, or false on success.
@@ -112,6 +114,8 @@ private: // Semantic analysis methods.
bool AddSubMultiClass(MultiClass *CurMC,
SubMultiClassReference &SubMultiClass);
+ std::string GetNewAnonymousName();
+
// IterRecord: Map an iterator name to a value.
struct IterRecord {
VarInit *IterVar;
OpenPOWER on IntegriCloud