aboutsummaryrefslogtreecommitdiff
path: root/gcc/jit/libgccjit.c
diff options
context:
space:
mode:
authorDavid Malcolm <dmalcolm@redhat.com>2015-01-08 21:52:35 +0000
committerDavid Malcolm <dmalcolm@gcc.gnu.org>2015-01-08 21:52:35 +0000
commit303e1d56c6214940a633c2b8ea7da2d81c15bd4d (patch)
tree66af508dfe03e5522c875f84f66abfeeeabbcd9a /gcc/jit/libgccjit.c
parent204a913bda3c3228723ea13e41c9dd831c362b33 (diff)
downloadgcc-303e1d56c6214940a633c2b8ea7da2d81c15bd4d.zip
gcc-303e1d56c6214940a633c2b8ea7da2d81c15bd4d.tar.gz
gcc-303e1d56c6214940a633c2b8ea7da2d81c15bd4d.tar.bz2
jit: New API entrypoint: gcc_jit_context_get_last_error
gcc/jit/ChangeLog: * docs/topics/contexts.rst (Error-handling): Document new entrypoint gcc_jit_context_get_last_error. * docs/_build/texinfo/libgccjit.texi: Regenerate. * jit-recording.c (gcc::jit::recording::context::context): Initialize new fields "m_last_error_str" and "m_owns_last_error_str". (gcc::jit::recording::context::~context): Clean up m_last_error_str, if needed. (gcc::jit::recording::context::add_error_va): Update m_last_error_str and m_owns_last_error_str, freeing the old value if appropriate. (gcc::jit::recording::context::get_last_error): New function. * jit-recording.h (gcc::jit::recording::context::get_last_error): New function. (gcc::jit::recording::context): New fields m_last_error_str and m_owns_last_error_str. * libgccjit.c (gcc_jit_context_get_last_error): New function. * libgccjit.h (gcc_jit_context_get_last_error): New declaration. * libgccjit.map (gcc_jit_context_get_last_error): New function. gcc/testsuite/ChangeLog: * jit.dg/test-error-block-in-wrong-function.c (verify_code): Verify the result of gcc_jit_context_get_last_error. * jit.dg/test-error-null-passed-to-api.c (verify_code): Likewise. From-SVN: r219363
Diffstat (limited to 'gcc/jit/libgccjit.c')
-rw-r--r--gcc/jit/libgccjit.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/gcc/jit/libgccjit.c b/gcc/jit/libgccjit.c
index c0439617..34f201e 100644
--- a/gcc/jit/libgccjit.c
+++ b/gcc/jit/libgccjit.c
@@ -2164,6 +2164,20 @@ gcc_jit_context_get_first_error (gcc_jit_context *ctxt)
/* Public entrypoint. See description in libgccjit.h.
After error-checking, the real work is done by the
+ gcc::jit::recording::context::get_last_error method in
+ jit-recording.c. */
+
+const char *
+gcc_jit_context_get_last_error (gcc_jit_context *ctxt)
+{
+ RETURN_NULL_IF_FAIL (ctxt, NULL, NULL, "NULL context");
+
+ return ctxt->get_last_error ();
+}
+
+/* Public entrypoint. See description in libgccjit.h.
+
+ After error-checking, the real work is done by the
gcc::jit::result::get_code method in jit-result.c. */
void *