diff options
author | David Malcolm <dmalcolm@redhat.com> | 2015-01-08 21:52:35 +0000 |
---|---|---|
committer | David Malcolm <dmalcolm@gcc.gnu.org> | 2015-01-08 21:52:35 +0000 |
commit | 303e1d56c6214940a633c2b8ea7da2d81c15bd4d (patch) | |
tree | 66af508dfe03e5522c875f84f66abfeeeabbcd9a /gcc/jit/libgccjit.h | |
parent | 204a913bda3c3228723ea13e41c9dd831c362b33 (diff) | |
download | gcc-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.h')
-rw-r--r-- | gcc/jit/libgccjit.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h index 91ca409..953c665 100644 --- a/gcc/jit/libgccjit.h +++ b/gcc/jit/libgccjit.h @@ -279,6 +279,16 @@ gcc_jit_context_set_logfile (gcc_jit_context *ctxt, extern const char * gcc_jit_context_get_first_error (gcc_jit_context *ctxt); +/* To be called after a compile, this gives the last error message + that occurred on the context. + + The returned string is valid for the rest of the lifetime of the + context. + + If no errors occurred, this will be NULL. */ +extern const char * +gcc_jit_context_get_last_error (gcc_jit_context *ctxt); + /* Locate a given function within the built machine code. This will need to be cast to a function pointer of the correct type before it can be called. */ |