aboutsummaryrefslogtreecommitdiff
path: root/odb/plugin.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2010-03-30 11:05:46 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2010-03-30 11:05:46 +0200
commitb143a4a1a028d3147b9b603e77866780b34ee828 (patch)
tree521e0d3602a08970cf477e3f139cc40f9dd01af2 /odb/plugin.cxx
parentcf80396f8b6147e9048c1f3bd50b3086f754d037 (diff)
Add code generator infrastructure
Diffstat (limited to 'odb/plugin.cxx')
-rw-r--r--odb/plugin.cxx25
1 files changed, 22 insertions, 3 deletions
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 <options.hxx>
#include <semantics.hxx>
+#include <generator.hxx>
#ifndef LOCATION_COLUMN
#define LOCATION_COLUMN(LOC) (expand_location (LOC).column)
@@ -1500,13 +1501,31 @@ auto_ptr<options const> 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<unit> u (p.parse (global_namespace, path (main_input_filename)));
+ path file (main_input_filename);
+ auto_ptr<unit> 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