[llvm-commits] CVS: llvm/utils/TableGen/FileParser.y

Chris Lattner lattner at cs.uiuc.edu
Tue Jul 29 23:27:01 PDT 2003


Changes in directory llvm/utils/TableGen:

FileParser.y updated: 1.6 -> 1.7

---
Log message:

Allow specification of anonymous definitions


---
Diffs of the changes:

Index: llvm/utils/TableGen/FileParser.y
diff -u llvm/utils/TableGen/FileParser.y:1.6 llvm/utils/TableGen/FileParser.y:1.7
--- llvm/utils/TableGen/FileParser.y:1.6	Sun Jul 27 22:49:40 2003
+++ llvm/utils/TableGen/FileParser.y	Tue Jul 29 23:26:44 2003
@@ -6,10 +6,10 @@
 
 %{
 #include "Record.h"
+#include "Support/StringExtras.h"
 #include <iostream>
 #include <algorithm>
-#include <string>
-#include <stdio.h>
+#include <cstdio>
 #define YYERROR_VERBOSE 1
 
 int yyerror(const char *ErrorMsg);
@@ -181,7 +181,7 @@
 %type <Initializer>  Value OptValue
 %type <FieldList>    ValueList ValueListNE
 %type <BitList>      BitList OptBitList RBitList
-%type <StrVal>       Declaration
+%type <StrVal>       Declaration OptID
 
 %start File
 %%
@@ -398,7 +398,12 @@
 TemplateArgList : '<' DeclListNE '>' {};
 OptTemplateArgList : /*empty*/ | TemplateArgList;
 
-ObjectBody : ID {
+OptID : ID { $$ = $1; } | /*empty*/ { $$ = new std::string(); };
+
+ObjectBody : OptID {
+           static unsigned AnonCounter = 0;
+           if ($1->empty())
+             *$1 = "anonymous."+utostr(AnonCounter++);
            CurRec = new Record(*$1);
            delete $1;
          } OptTemplateArgList ClassList {





More information about the llvm-commits mailing list