aboutsummaryrefslogtreecommitdiff
path: root/gcc/jit/dummy-frontend.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/jit/dummy-frontend.c')
-rw-r--r--gcc/jit/dummy-frontend.c34
1 files changed, 34 insertions, 0 deletions
diff --git a/gcc/jit/dummy-frontend.c b/gcc/jit/dummy-frontend.c
index 7194ba68ac4..26311536186 100644
--- a/gcc/jit/dummy-frontend.c
+++ b/gcc/jit/dummy-frontend.c
@@ -25,6 +25,7 @@ along with GCC; see the file COPYING3. If not see
#include "debug.h"
#include "langhooks.h"
#include "langhooks-def.h"
+#include "diagnostic.h"
#include <mpfr.h>
@@ -90,6 +91,35 @@ struct ggc_root_tab jit_root_tab[] =
LAST_GGC_ROOT_TAB
};
+/* JIT-specific implementation of diagnostic callbacks. */
+
+/* Implementation of "begin_diagnostic". */
+
+static void
+jit_begin_diagnostic (diagnostic_context */*context*/,
+ diagnostic_info */*diagnostic*/)
+{
+ gcc_assert (gcc::jit::active_playback_ctxt);
+ JIT_LOG_SCOPE (gcc::jit::active_playback_ctxt->get_logger ());
+
+ /* No-op (apart from logging); the real error-handling is done in the
+ "end_diagnostic" hook. */
+}
+
+/* Implementation of "end_diagnostic". */
+
+static void
+jit_end_diagnostic (diagnostic_context *context,
+ diagnostic_info *diagnostic)
+{
+ gcc_assert (gcc::jit::active_playback_ctxt);
+ JIT_LOG_SCOPE (gcc::jit::active_playback_ctxt->get_logger ());
+
+ /* Delegate to the playback context (and thence to the
+ recording context). */
+ gcc::jit::active_playback_ctxt->add_diagnostic (context, diagnostic);
+}
+
/* Language hooks. */
static bool
@@ -105,6 +135,10 @@ jit_langhook_init (void)
registered_root_tab = true;
}
+ gcc_assert (global_dc);
+ global_dc->begin_diagnostic = jit_begin_diagnostic;
+ global_dc->end_diagnostic = jit_end_diagnostic;
+
build_common_tree_nodes (false);
/* I don't know why this has to be done explicitly. */