aboutsummaryrefslogtreecommitdiff
path: root/lib/AsmParser
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2002-01-20 22:54:45 +0000
committerChris Lattner <sabre@nondot.org>2002-01-20 22:54:45 +0000
commit697954c15da58bd8b186dbafdedd8b06db770201 (patch)
treee119a71f09b5c2513c8c270161ae2a858c6f3b96 /lib/AsmParser
parent13c4659220bc78a0a3529f4d9e57546e898088e3 (diff)
Changes to build successfully with GCC 3.02
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@1503 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/AsmParser')
-rw-r--r--lib/AsmParser/Parser.cpp3
-rw-r--r--lib/AsmParser/ParserInternals.h19
-rw-r--r--lib/AsmParser/llvmAsmParser.y47
3 files changed, 32 insertions, 37 deletions
diff --git a/lib/AsmParser/Parser.cpp b/lib/AsmParser/Parser.cpp
index b487042bcb..4b280efd7d 100644
--- a/lib/AsmParser/Parser.cpp
+++ b/lib/AsmParser/Parser.cpp
@@ -8,6 +8,7 @@
#include "llvm/Module.h"
#include "ParserInternals.h"
#include <stdio.h> // for sprintf
+using std::string;
// The useful interface defined by this file... Parse an ascii file, and return
// the internal representation in a nice slice'n'dice'able representation.
@@ -30,7 +31,7 @@ Module *ParseAssemblyFile(const string &Filename) { // throw (ParseException)
fclose(F);
if (Result) { // Check to see that it is valid...
- vector<string> Errors;
+ std::vector<string> Errors;
if (verify(Result, Errors)) {
delete Result; Result = 0;
string Message;
diff --git a/lib/AsmParser/ParserInternals.h b/lib/AsmParser/ParserInternals.h
index 750833fae8..e1e2c4954c 100644
--- a/lib/AsmParser/ParserInternals.h
+++ b/lib/AsmParser/ParserInternals.h
@@ -23,12 +23,12 @@
class Module;
// Global variables exported from the lexer...
-extern FILE *llvmAsmin;
+extern std::FILE *llvmAsmin;
extern int llvmAsmlineno;
// Globals exported by the parser...
-extern string CurFilename;
-Module *RunVMAsmParser(const string &Filename, FILE *F);
+extern std::string CurFilename;
+Module *RunVMAsmParser(const std::string &Filename, FILE *F);
// UnEscapeLexed - Run through the specified buffer and change \xx codes to the
@@ -47,7 +47,7 @@ char *UnEscapeLexed(char *Buffer, bool AllowNull = false);
// This also helps me because I keep typing 'throw new ParseException' instead
// of just 'throw ParseException'... sigh...
//
-static inline void ThrowException(const string &message,
+static inline void ThrowException(const std::string &message,
int LineNo = -1) {
if (LineNo == -1) LineNo = llvmAsmlineno;
// TODO: column number in exception
@@ -116,18 +116,19 @@ struct ValID {
return Result;
}
- inline string getName() const {
+ inline std::string getName() const {
switch (Type) {
- case NumberVal : return string("#") + itostr(Num);
+ case NumberVal : return std::string("#") + itostr(Num);
case NameVal : return Name;
- case ConstStringVal: return string("\"") + Name + string("\"");
+ case ConstStringVal: return std::string("\"") + Name + std::string("\"");
case ConstFPVal : return ftostr(ConstPoolFP);
case ConstNullVal : return "null";
case ConstUIntVal :
- case ConstSIntVal : return string("%") + itostr(ConstPool64);
+ case ConstSIntVal : return std::string("%") + itostr(ConstPool64);
default:
assert(0 && "Unknown value!");
abort();
+ return "";
}
}
@@ -163,7 +164,7 @@ public:
struct InstPlaceHolderHelper : public Instruction {
InstPlaceHolderHelper(const Type *Ty) : Instruction(Ty, UserOp1, "") {}
- virtual Instruction *clone() const { abort(); }
+ virtual Instruction *clone() const { abort(); return 0; }
virtual const char *getOpcodeName() const { return "placeholder"; }
};
diff --git a/lib/AsmParser/llvmAsmParser.y b/lib/AsmParser/llvmAsmParser.y
index 285e78acef..aab868abb9 100644
--- a/lib/AsmParser/llvmAsmParser.y
+++ b/lib/AsmParser/llvmAsmParser.y
@@ -22,6 +22,15 @@
#include <utility> // Get definition of pair class
#include <algorithm>
#include <stdio.h> // This embarasment is due to our flex lexer...
+#include <iostream>
+using std::list;
+using std::vector;
+using std::pair;
+using std::map;
+using std::pair;
+using std::make_pair;
+using std::cerr;
+using std::string;
int yyerror(const char *ErrorMsg); // Forward declarations to prevent "implicit
int yylex(); // declaration" of xxx warnings.
@@ -46,7 +55,6 @@ string CurFilename;
typedef vector<Value *> ValueList; // Numbered defs
static void ResolveDefinitions(vector<ValueList> &LateResolvers,
vector<ValueList> *FutureLateResolvers = 0);
-static void ResolveTypes (vector<PATypeHolder<Type> > &LateResolveTypes);
static struct PerModuleInfo {
Module *CurrentModule;
@@ -425,22 +433,6 @@ static void ResolveDefinitions(vector<ValueList> &LateResolvers,
LateResolvers.clear();
}
-// ResolveType - Take a specified unresolved type and resolve it. If there is
-// nothing to resolve it to yet, return true. Otherwise resolve it and return
-// false.
-//
-static bool ResolveType(PATypeHolder<Type> &T) {
- const Type *Ty = T;
- ValID &DID = getValIDFromPlaceHolder(Ty);
-
- const Type *TheRealType = getTypeVal(DID, true);
- if (TheRealType == 0 || TheRealType == Ty) return true;
-
- // Refine the opaque type we had to the new type we are getting.
- cast<DerivedType>(Ty)->refineAbstractTypeTo(TheRealType);
- return false;
-}
-
// ResolveTypeTo - A brand new type was just declared. This means that (if
// name is not null) things referencing Name can be resolved. Otherwise, things
// refering to the number can be resolved. Do this now.
@@ -641,12 +633,13 @@ Module *RunVMAsmParser(const string &Filename, FILE *F) {
PATypeHolder<Type> *TypeVal;
Value *ValueVal;
- list<MethodArgument*> *MethodArgList;
- vector<Value*> *ValueList;
- list<PATypeHolder<Type> > *TypeList;
- list<pair<Value*, BasicBlock*> > *PHIList; // Represent the RHS of PHI node
- list<pair<Constant*, BasicBlock*> > *JumpTable;
- vector<Constant*> *ConstVector;
+ std::list<MethodArgument*> *MethodArgList;
+ std::vector<Value*> *ValueList;
+ std::list<PATypeHolder<Type> > *TypeList;
+ std::list<std::pair<Value*,
+ BasicBlock*> > *PHIList; // Represent the RHS of PHI node
+ std::list<std::pair<Constant*, BasicBlock*> > *JumpTable;
+ std::vector<Constant*> *ConstVector;
int64_t SInt64Val;
uint64_t UInt64Val;
@@ -812,8 +805,8 @@ UpRTypes : '\\' EUINT64VAL { // Type UpReference
}
| UpRTypesV '(' ArgTypeListI ')' { // Method derived type?
vector<const Type*> Params;
- mapto($3->begin(), $3->end(), back_inserter(Params),
- mem_fun_ref(&PATypeHandle<Type>::get));
+ mapto($3->begin(), $3->end(), std::back_inserter(Params),
+ std::mem_fun_ref(&PATypeHandle<Type>::get));
bool isVarArg = Params.size() && Params.back() == Type::VoidTy;
if (isVarArg) Params.pop_back();
@@ -827,8 +820,8 @@ UpRTypes : '\\' EUINT64VAL { // Type UpReference
}
| '{' TypeListI '}' { // Structure type?
vector<const Type*> Elements;
- mapto($2->begin(), $2->end(), back_inserter(Elements),
- mem_fun_ref(&PATypeHandle<Type>::get));
+ mapto($2->begin(), $2->end(), std::back_inserter(Elements),
+ std::mem_fun_ref(&PATypeHandle<Type>::get));
$$ = newTH<Type>(HandleUpRefs(StructType::get(Elements)));
delete $2;