diff options
author | Lang Hames <lhames@gmail.com> | 2021-09-15 10:45:19 +1000 |
---|---|---|
committer | Lang Hames <lhames@gmail.com> | 2021-09-16 14:36:05 +1000 |
commit | a01f772d19d53976a6d6e0eed684440e4f2cc9da (patch) | |
tree | f4d6628674e0cf984916493f8684d8022b02c21e /llvm/lib/Bitcode/Writer/BitcodeWriter.cpp | |
parent | 03c8b24ace911912892f225cce16498b6f71bf3f (diff) | |
download | llvm-a01f772d19d53976a6d6e0eed684440e4f2cc9da.zip llvm-a01f772d19d53976a6d6e0eed684440e4f2cc9da.tar.gz llvm-a01f772d19d53976a6d6e0eed684440e4f2cc9da.tar.bz2 |
[ORC] Add MethodWrapperHandler utility for WrapperFunction.
MethodWrapperHandler removes some of the boilerplate when writing wrapper
functions to wrap method calls. It can be used as a handler for wrapper
functions whose first argument is an ExecutorAddress: the address is cast to a
pointer of the given class type, then the given method function pointer is
called on that object pointer (passing the rest of the arguments).
E.g.
class MyClass {
public:
void myMethod(uint32_t, bool) { ... }
};
// SPS Method signature for myMethod -- note MyClass object address as first
// argument.
using SPSMyMethodWrapperSignature =
SPSTuple<SPSExecutorAddress, uint32_t, bool>;
// Wrapper function for myMethod.
WrapperFunctionResult
myMethodCallWrapper(const char *ArgData, size_t ArgSize) {
return WrapperFunction<SPSMyMethodWrapperSignature>::handle(
ArgData, ArgSize, makeMethodWrapperHandler(&MyClass::myMethod));
}
Diffstat (limited to 'llvm/lib/Bitcode/Writer/BitcodeWriter.cpp')
0 files changed, 0 insertions, 0 deletions