Put all LLVM code into the llvm namespace, as per bug 109.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@9903 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/AsmParser/Lexer.l b/lib/AsmParser/Lexer.l
index 6466cb7..b0e174a 100644
--- a/lib/AsmParser/Lexer.l
+++ b/lib/AsmParser/Lexer.l
@@ -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
@@ -121,6 +122,10 @@
return BOut;
}
+} // End llvm namespace
+
+using namespace llvm;
+
#define YY_NEVER_INTERACTIVE 1
%}
diff --git a/lib/AsmParser/Parser.cpp b/lib/AsmParser/Parser.cpp
index e8a7bdb..2d6185e 100644
--- a/lib/AsmParser/Parser.cpp
+++ b/lib/AsmParser/Parser.cpp
@@ -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
diff --git a/lib/AsmParser/ParserInternals.h b/lib/AsmParser/ParserInternals.h
index c783795..c18434d 100644
--- a/lib/AsmParser/ParserInternals.h
+++ b/lib/AsmParser/ParserInternals.h
@@ -22,19 +22,23 @@
#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 std::string CurFilename;
-Module *RunVMAsmParser(const std::string &Filename, FILE *F);
-
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);
+
+
// 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
// an exception to be thrown.
@@ -209,4 +213,6 @@
}
}
+} // End llvm namespace
+
#endif
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index 96d2dae..a55e735 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -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;
+ 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 Type *PrimType;
- PATypeHolder *TypeVal;
- Value *ValueVal;
+ const llvm::Type *PrimType;
+ llvm::PATypeHolder *TypeVal;
+ llvm::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;
+ 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
@@ -1892,6 +1898,7 @@
delete $2; delete $4;
};
+
%%
int yyerror(const char *ErrorMsg) {
std::string where