diff options
-rw-r--r-- | src/asm2wasm.h | 18 | ||||
-rw-r--r-- | src/support/command-line.cpp | 8 | ||||
-rw-r--r-- | src/support/command-line.h | 2 |
3 files changed, 11 insertions, 17 deletions
diff --git a/src/asm2wasm.h b/src/asm2wasm.h index c4f73b57a..eb1471382 100644 --- a/src/asm2wasm.h +++ b/src/asm2wasm.h @@ -150,7 +150,7 @@ class Asm2WasmBuilder { std::map<CallIndirect*, IString> callIndirects; // track these, as we need to fix them after we know the functionTableStarts. this maps call => its function table bool memoryGrowth; - int debug; + bool debug; public: std::map<IString, MappedGlobal> mappedGlobals; @@ -254,7 +254,7 @@ private: } public: - Asm2WasmBuilder(AllocatingModule& wasm, bool memoryGrowth, int debug) + Asm2WasmBuilder(AllocatingModule& wasm, bool memoryGrowth, bool debug) : wasm(wasm), allocator(wasm.allocator), nextGlobal(8), @@ -729,10 +729,8 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) { if (debug) { std::cout << "\nfunc: " << ast[1]->getIString().str << '\n'; - if (debug >= 2) { - ast->stringify(std::cout); - std::cout << '\n'; - } + ast->stringify(std::cout); + std::cout << '\n'; } auto function = allocator.alloc<Function>(); @@ -802,11 +800,9 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) { std::function<Expression* (Ref)> process = [&](Ref ast) -> Expression* { AstStackHelper astStackHelper(ast); // TODO: only create one when we need it? - if (debug >= 2) { - std::cout << "at: "; - ast->stringify(std::cout); - std::cout << '\n'; - } + std::cout << "at: "; + ast->stringify(std::cout); + std::cout << '\n'; IString what = ast[0]->getIString(); if (what == STAT) { return process(ast[1]); // and drop return value, if any diff --git a/src/support/command-line.cpp b/src/support/command-line.cpp index b4f8a4d62..f3aa4dc08 100644 --- a/src/support/command-line.cpp +++ b/src/support/command-line.cpp @@ -19,7 +19,7 @@ using namespace wasm; Options::Options(const std::string &command, const std::string &description) - : debug(0), positional(Arguments::Zero) { + : debug(false), positional(Arguments::Zero) { add("--help", "-h", "Show this help message and exit", Arguments::Zero, [this, command, description](Options *o, const std::string &) { std::cerr << command; @@ -41,10 +41,8 @@ Options::Options(const std::string &command, const std::string &description) std::cerr << '\n'; exit(EXIT_SUCCESS); }); - add("--debug", "-d", "Print debug information to stderr", Arguments::Optional, - [](Options *o, const std::string &arguments) { - o->debug = arguments.size() ? std::stoi(arguments) : 1; - }); + add("--debug", "-d", "Print debug information to stderr", Arguments::Zero, + [](Options *o, const std::string &arguments) {}); } Options::~Options() {} diff --git a/src/support/command-line.h b/src/support/command-line.h index 6e0af846e..7c3ae528f 100644 --- a/src/support/command-line.h +++ b/src/support/command-line.h @@ -37,7 +37,7 @@ class Options { typedef std::function<void(Options *, const std::string &)> Action; enum class Arguments { Zero, One, N, Optional }; - int debug; + bool debug; std::map<std::string, std::string> extra; Options(const std::string &command, const std::string &description); |