From b143a4a1a028d3147b9b603e77866780b34ee828 Mon Sep 17 00:00:00 2001 From: Boris Kolpackov Date: Tue, 30 Mar 2010 11:05:46 +0200 Subject: Add code generator infrastructure --- odb/plugin.cxx | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'odb/plugin.cxx') diff --git a/odb/plugin.cxx b/odb/plugin.cxx index 35e6ab6..f381251 100644 --- a/odb/plugin.cxx +++ b/odb/plugin.cxx @@ -15,6 +15,7 @@ #include #include +#include #ifndef LOCATION_COLUMN #define LOCATION_COLUMN(LOC) (expand_location (LOC).column) @@ -1500,13 +1501,31 @@ auto_ptr options_; extern "C" void gate_callback (void* gcc_data, void*) { - if (!errorcount && !sorrycount) + // If there were errors during compilation, let GCC handle the + // exit. + // + if (errorcount || sorrycount) + return; + + int r (0); + + try { parser p (*options_); - auto_ptr u (p.parse (global_namespace, path (main_input_filename))); + path file (main_input_filename); + auto_ptr u (p.parse (global_namespace, file)); + + generator g; + g.generate (*options_, *u, file); + } + catch (generator::failed const&) + { + // Diagnostics has aready been issued. + // + r = 1; } - exit (0); + exit (r); } extern "C" int -- cgit v1.1