summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohn Hodge <tpg@mutabah.net>2016-09-22 11:22:19 +0800
committerJohn Hodge <tpg@mutabah.net>2016-09-22 11:22:19 +0800
commit87f4af1ccabae6e64e3411eb60f6e4e8a51310b6 (patch)
tree40110f0045b121e95947a3370f665bc518ea34fe
parent099cc89cc8640121b7be1be4c8ba460e3ada7723 (diff)
downloadmrust-87f4af1ccabae6e64e3411eb60f6e4e8a51310b6.tar.gz
main - Add a hacky MRUSTC_DEBUG environment variable to enable debug for passes
-rw-r--r--src/main.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/main.cpp b/src/main.cpp
index 85916db5..b3425e0d 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -31,6 +31,7 @@ int g_debug_indent_level = 0;
void init_debug_list()
{
+ // TODO: Mutate this map using an environment variable
g_debug_disable_map.insert( "Parse" );
g_debug_disable_map.insert( "LoadCrates" );
g_debug_disable_map.insert( "Expand" );
@@ -61,6 +62,25 @@ void init_debug_list()
g_debug_disable_map.insert( "Dump MIR" );
g_debug_disable_map.insert( "HIR Serialise" );
+
+ const char* debug_string = ::std::getenv("MRUSTC_DEBUG");
+ if( debug_string )
+ {
+ while( debug_string[0] )
+ {
+ const char* end = strchr(debug_string, ':');
+
+ if( end ) {
+ ::std::string s { debug_string, end };
+ g_debug_disable_map.erase( s );
+ debug_string = end + 1;
+ }
+ else {
+ g_debug_disable_map.erase( debug_string );
+ break;
+ }
+ }
+ }
}
bool debug_enabled()
{