#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...
}
}
-// 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;
}
// 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:
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;