summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/main.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 7e0d1188..2ad64c4c 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -26,6 +26,7 @@
#include "expand/cfg.hpp"
int g_debug_indent_level = 0;
+bool g_debug_enabled = true;
::std::string g_cur_phase;
::std::set< ::std::string> g_debug_disable_map;
@@ -83,8 +84,7 @@ void init_debug_list()
}
}
}
-bool debug_enabled()
-{
+bool debug_enabled_update() {
if( g_debug_disable_map.count(g_cur_phase) != 0 ) {
return false;
}
@@ -92,6 +92,10 @@ bool debug_enabled()
return true;
}
}
+bool debug_enabled()
+{
+ return g_debug_enabled;
+}
::std::ostream& debug_output(int indent, const char* function)
{
return ::std::cout << g_cur_phase << "- " << RepeatLitStr { " ", indent } << function << ": ";
@@ -125,10 +129,12 @@ template <typename Rv, typename Fcn>
Rv CompilePhase(const char *name, Fcn f) {
::std::cout << name << ": V V V" << ::std::endl;
g_cur_phase = name;
+ g_debug_enabled = debug_enabled_update();
auto start = clock();
auto rv = f();
auto end = clock();
g_cur_phase = "";
+ g_debug_enabled = debug_enabled_update();
::std::cout <<"(" << ::std::fixed << ::std::setprecision(2) << static_cast<double>(end - start) / static_cast<double>(CLOCKS_PER_SEC) << " s) ";
::std::cout << name << ": DONE";