[ORC][C-bindings] Re-order object transform function arguments.

ObjInOut is an in-out parameter not a return value argument, so by convention
it should come after the context value (Ctx).
This commit is contained in:
Lang Hames 2021-06-18 22:12:39 +10:00
parent cbfb12469b
commit 8962c68ad0
3 changed files with 3 additions and 3 deletions

View File

@ -51,7 +51,7 @@ LLVMOrcThreadSafeModuleRef createDemoModule() {
return TSM;
}
LLVMErrorRef dumpObjectsTransform(LLVMMemoryBufferRef *ObjInOut, void *Ctx) {
LLVMErrorRef dumpObjectsTransform(void *Ctx, LLVMMemoryBufferRef *ObjInOut) {
LLVMOrcDumpObjectsRef DumpObjects = *(LLVMOrcDumpObjectsRef *)Ctx;
return LLVMOrcDumpObjects_CallOperator(DumpObjects, ObjInOut);
}

View File

@ -328,7 +328,7 @@ typedef struct LLVMOrcOpaqueObjectTransformLayer
* buffer should be disposed of and set to null.
*/
typedef LLVMErrorRef (*LLVMOrcObjectTransformLayerTransformFunction)(
LLVMMemoryBufferRef *ObjInOut, void *Ctx);
void *Ctx, LLVMMemoryBufferRef *ObjInOut);
/**
* A reference to an orc::DumpObjects object.

View File

@ -524,7 +524,7 @@ void LLVMOrcObjectTransformLayerSetTransform(
->setTransform([TransformFunction, Ctx](std::unique_ptr<MemoryBuffer> Obj)
-> Expected<std::unique_ptr<MemoryBuffer>> {
LLVMMemoryBufferRef ObjBuffer = wrap(Obj.release());
if (LLVMErrorRef Err = TransformFunction(&ObjBuffer, Ctx)) {
if (LLVMErrorRef Err = TransformFunction(Ctx, &ObjBuffer)) {
assert(!ObjBuffer && "ObjBuffer was not reset to null on error");
return unwrap(Err);
}