Fix #include broken by iMemory.h not including DerivedTypes.h
[oota-llvm.git] / lib / ExecutionEngine / Interpreter / Support.cpp
index a619304c62b5afe67dfc88b1d118db2cac8c753f..aa97621214a1cb4bb7ff0086f973ce6b57382e45 100644 (file)
@@ -7,14 +7,16 @@
 #include "Interpreter.h"
 #include "llvm/SymbolTable.h"
 #include "llvm/Assembly/Writer.h"
+#include <iostream>
+using std::cout;
 
 //===----------------------------------------------------------------------===//
 //
 // LookupMatchingNames helper - Search a symbol table for values matching Name.
 //
-static inline void LookupMatchingNames(const string &Name, SymTabValue &STV,
-                                      vector<Value*> &Results) {
-  SymbolTable *SymTab = STV.getSymbolTable();
+static inline void LookupMatchingNames(const std::string &Name,
+                                       SymbolTable *SymTab,
+                                      std::vector<Value*> &Results) {
   if (SymTab == 0) return;                         // No symbolic values :(
 
   // Loop over all of the type planes in the symbol table...
@@ -29,17 +31,17 @@ static inline void LookupMatchingNames(const string &Name, SymTabValue &STV,
   }
 }
 
-// LookupMatchingNames - Search the current method namespace, then the global
+// LookupMatchingNames - Search the current function namespace, then the global
 // namespace looking for values that match the specified name.  Return ALL
 // matches to that name.  This is obviously slow, and should only be used for
 // user interaction.
 //
-vector<Value*> Interpreter::LookupMatchingNames(const string &Name) {
-  vector<Value*> Results;
-  Method *CurMeth = getCurrentMethod();
+std::vector<Value*> Interpreter::LookupMatchingNames(const std::string &Name) {
+  std::vector<Value*> Results;
+  Function *CurMeth = getCurrentMethod();
   
-  if (CurMeth) ::LookupMatchingNames(Name, *CurMeth, Results);
-  if (CurMod ) ::LookupMatchingNames(Name, *CurMod , Results);
+  if (CurMeth) ::LookupMatchingNames(Name, CurMeth->getSymbolTable(), Results);
+  if (CurMod ) ::LookupMatchingNames(Name, CurMod ->getSymbolTable(), Results);
   return Results;
 }
 
@@ -47,8 +49,8 @@ vector<Value*> Interpreter::LookupMatchingNames(const string &Name) {
 // pick one value.  If no options are provided, emit an error.  If a single 
 // option is provided, just return that option.
 //
-Value *Interpreter::ChooseOneOption(const string &Name,
-                                   const vector<Value*> &Opts) {
+Value *Interpreter::ChooseOneOption(const std::string &Name,
+                                   const std::vector<Value*> &Opts) {
   switch (Opts.size()) {
   case 1: return Opts[0];
   case 0: 
@@ -61,16 +63,16 @@ Value *Interpreter::ChooseOneOption(const string &Name,
   cout << "  0. Cancel operation\n";
   for (unsigned i = 0; i < Opts.size(); ++i) {
     cout << "  " << (i+1) << ".";
-    WriteAsOperand(cout, Opts[i]) << endl;
+    WriteAsOperand(cout, Opts[i]) << "\n";
   }
 
   unsigned Option;
   do {
-    cout << "lli> " << flush;
-    cin >> Option;
+    cout << "lli> " << std::flush;
+    std::cin >> Option;
     if (Option > Opts.size())
       cout << "Invalid selection: Please choose from 0 to " << Opts.size()
-          << endl;
+          << "\n";
   } while (Option > Opts.size());
 
   if (Option == 0) return 0;