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
diff --git a/lib/AsmParser/Parser.cpp b/lib/AsmParser/Parser.cpp
index b487042..4b280ef 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 @@
     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 750833f..e1e2c49 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 @@
 // 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 @@
     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 @@
 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 285e78a..aab868a 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 @@
 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 @@
   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 @@
   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 @@
   }
   | 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 @@
   }
   | '{' 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;