This is an archive of the discontinued LLVM Phabricator instance.

Expand clang-interpreter with example of throwing in and from the JIT for Windows64.
ClosedPublic

Authored by marsupial on Jul 6 2017, 9:11 PM.

Details

Summary

Getting this to work is not particularly obvious, and having it as an example should be helpful.
Portions of this could be placed into LLVM, but as a whole it seems necessary to do this a higher level.

Diff Detail

Repository
rC Clang

Event Timeline

marsupial created this revision.Jul 6 2017, 9:11 PM

Just 2 small nits.

examples/clang-interpreter/main.cpp
165

255 -> Res ?

173

255 -> Res

martell added inline comments.Jul 13 2017, 1:28 PM
examples/clang-interpreter/Manager.cpp
19

windows.h with lower case w to not break mingw

marsupial updated this revision to Diff 106548.Jul 13 2017, 3:22 PM

Blocked Win64 SEH for MingW entirely.
Theoretically it should be possible to throw a SEH from within mingw, but but I'm thinking clang may be generating exception handlers for the gcc runtime in that case.
I'll leave it up to someone with interest in such a mixture to figure that tout.

marsupial marked 3 inline comments as done.Jul 13 2017, 3:24 PM

Done, and changed to 'windows.h', but blocked mingw from even attempting SEH for now.

lhames accepted this revision.Jul 25 2017, 11:48 AM

Otherwise this looks good to me.

examples/clang-interpreter/CMakeLists.txt
74

These debugging messages (this and the one below) should probably be stripped.

examples/clang-interpreter/Invoke.h
11

I believe you should use include guards in LLVM headers. Pragma once should work, but I don't think it's standard (and it doesn't seem to be used anywhere else in the codebase).

examples/clang-interpreter/Manager.h
11

Ditto here.

This revision is now accepted and ready to land.Jul 25 2017, 11:48 AM

Use include guards, not pragma once and remove commented CMake debug lines.

marsupial marked 3 inline comments as done.Jul 28 2017, 10:25 AM

Done, thanks. Would it be possible to look at D30709 as this depends on that. (ELF does not like Windows exceptions).

This revision was automatically updated to reflect the committed changes.