[llvm-commits] CVS: llvm/lib/AsmParser/Lexer.l Parser.cpp ParserInternals.h llvmAsmParser.y

Brian Gaeke gaeke at cs.uiuc.edu
Tue Nov 11 16:44:55 PST 2003


Changes in directory llvm/lib/AsmParser:

Lexer.l updated: 1.43 -> 1.44
Parser.cpp updated: 1.12 -> 1.13
ParserInternals.h updated: 1.32 -> 1.33
llvmAsmParser.y updated: 1.137 -> 1.138

---
Log message:

Put all LLVM code into the llvm namespace, as per bug 109.

---
Diffs of the changes:  (+52 -30)

Index: llvm/lib/AsmParser/Lexer.l
diff -u llvm/lib/AsmParser/Lexer.l:1.43 llvm/lib/AsmParser/Lexer.l:1.44
--- llvm/lib/AsmParser/Lexer.l:1.43	Tue Oct 21 10:17:12 2003
+++ llvm/lib/AsmParser/Lexer.l	Tue Nov 11 16:41:32 2003
@@ -35,6 +35,7 @@
 #define RET_TOK(type, Enum, sym) \
   llvmAsmlval.type = Instruction::Enum; return sym
 
+namespace llvm {
 
 // TODO: All of the static identifiers are figured out by the lexer, 
 // these should be hashed to reduce the lexer size
@@ -120,6 +121,10 @@
 
   return BOut;
 }
+
+} // End llvm namespace
+
+using namespace llvm;
 
 #define YY_NEVER_INTERACTIVE 1
 %}


Index: llvm/lib/AsmParser/Parser.cpp
diff -u llvm/lib/AsmParser/Parser.cpp:1.12 llvm/lib/AsmParser/Parser.cpp:1.13
--- llvm/lib/AsmParser/Parser.cpp:1.12	Thu Oct 23 13:00:34 2003
+++ llvm/lib/AsmParser/Parser.cpp	Tue Nov 11 16:41:32 2003
@@ -15,6 +15,8 @@
 #include "llvm/Module.h"
 #include "llvm/Analysis/Verifier.h"
 
+namespace llvm {
+
 // The useful interface defined by this file... Parse an ASCII file, and return
 // the internal representation in a nice slice'n'dice'able representation.
 //
@@ -82,3 +84,5 @@
   
   return Result + ": " + Message;
 }
+
+} // End llvm namespace


Index: llvm/lib/AsmParser/ParserInternals.h
diff -u llvm/lib/AsmParser/ParserInternals.h:1.32 llvm/lib/AsmParser/ParserInternals.h:1.33
--- llvm/lib/AsmParser/ParserInternals.h:1.32	Tue Oct 21 10:17:12 2003
+++ llvm/lib/AsmParser/ParserInternals.h	Tue Nov 11 16:41:32 2003
@@ -22,18 +22,22 @@
 #include "llvm/Assembly/Parser.h"
 #include "Support/StringExtras.h"
 
-class Module;
-
 // Global variables exported from the lexer...
 extern std::FILE *llvmAsmin;
 extern int llvmAsmlineno;
 
 // Globals exported by the parser...
+extern char* llvmAsmtext;
+extern int   llvmAsmleng;
+
+namespace llvm {
+
+// Globals exported by the parser...
 extern std::string CurFilename;
+
+class Module;
 Module *RunVMAsmParser(const std::string &Filename, FILE *F);
 
-extern char* llvmAsmtext;
-extern int   llvmAsmleng;
 
 // UnEscapeLexed - Run through the specified buffer and change \xx codes to the
 // appropriate character.  If AllowNull is set to false, a \00 value will cause
@@ -208,5 +212,7 @@
   default:               return ((ValuePlaceHolder*)Val)->getLineNum();
   }
 }
+
+} // End llvm namespace
 
 #endif


Index: llvm/lib/AsmParser/llvmAsmParser.y
diff -u llvm/lib/AsmParser/llvmAsmParser.y:1.137 llvm/lib/AsmParser/llvmAsmParser.y:1.138
--- llvm/lib/AsmParser/llvmAsmParser.y:1.137	Wed Oct 29 19:38:18 2003
+++ llvm/lib/AsmParser/llvmAsmParser.y	Tue Nov 11 16:41:32 2003
@@ -29,6 +29,8 @@
 int yylex();                       // declaration" of xxx warnings.
 int yyparse();
 
+namespace llvm {
+
 static Module *ParserResult;
 std::string CurFilename;
 
@@ -686,30 +688,34 @@
   return Result;
 }
 
+} // End llvm namespace
+
+using namespace llvm;
+
 %}
 
 %union {
-  Module                           *ModuleVal;
-  Function                         *FunctionVal;
-  std::pair<PATypeHolder*, char*>  *ArgVal;
-  BasicBlock                       *BasicBlockVal;
-  TerminatorInst                   *TermInstVal;
-  Instruction                      *InstVal;
-  Constant                         *ConstVal;
-
-  const Type                       *PrimType;
-  PATypeHolder                     *TypeVal;
-  Value                            *ValueVal;
-
-  std::vector<std::pair<PATypeHolder*,char*> > *ArgList;
-  std::vector<Value*>              *ValueList;
-  std::list<PATypeHolder>          *TypeList;
-  std::list<std::pair<Value*,
-                      BasicBlock*> > *PHIList; // Represent the RHS of PHI node
-  std::vector<std::pair<Constant*, BasicBlock*> > *JumpTable;
-  std::vector<Constant*>           *ConstVector;
+  llvm::Module                           *ModuleVal;
+  llvm::Function                         *FunctionVal;
+  std::pair<llvm::PATypeHolder*, char*>  *ArgVal;
+  llvm::BasicBlock                       *BasicBlockVal;
+  llvm::TerminatorInst                   *TermInstVal;
+  llvm::Instruction                      *InstVal;
+  llvm::Constant                         *ConstVal;
+
+  const llvm::Type                       *PrimType;
+  llvm::PATypeHolder                     *TypeVal;
+  llvm::Value                            *ValueVal;
+
+  std::vector<std::pair<llvm::PATypeHolder*,char*> > *ArgList;
+  std::vector<llvm::Value*>              *ValueList;
+  std::list<llvm::PATypeHolder>          *TypeList;
+  std::list<std::pair<llvm::Value*,
+                      llvm::BasicBlock*> > *PHIList; // Represent the RHS of PHI node
+  std::vector<std::pair<llvm::Constant*, llvm::BasicBlock*> > *JumpTable;
+  std::vector<llvm::Constant*>           *ConstVector;
 
-  GlobalValue::LinkageTypes         Linkage;
+  llvm::GlobalValue::LinkageTypes         Linkage;
   int64_t                           SInt64Val;
   uint64_t                          UInt64Val;
   int                               SIntVal;
@@ -718,13 +724,13 @@
   bool                              BoolVal;
 
   char                             *StrVal;   // This memory is strdup'd!
-  ValID                             ValIDVal; // strdup'd memory maybe!
+  llvm::ValID                             ValIDVal; // strdup'd memory maybe!
 
-  Instruction::BinaryOps            BinaryOpVal;
-  Instruction::TermOps              TermOpVal;
-  Instruction::MemoryOps            MemOpVal;
-  Instruction::OtherOps             OtherOpVal;
-  Module::Endianness                Endianness;
+  llvm::Instruction::BinaryOps            BinaryOpVal;
+  llvm::Instruction::TermOps              TermOpVal;
+  llvm::Instruction::MemoryOps            MemOpVal;
+  llvm::Instruction::OtherOps             OtherOpVal;
+  llvm::Module::Endianness                Endianness;
 }
 
 %type <ModuleVal>     Module FunctionList
@@ -1891,6 +1897,7 @@
     $$ = new GetElementPtrInst(getVal(*$2, $3), *$4);
     delete $2; delete $4;
   };
+
 
 %%
 int yyerror(const char *ErrorMsg) {





More information about the llvm-commits mailing list