[llvm] 8962c68 - [ORC][C-bindings] Re-order object transform function arguments.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 18 05:16:51 PDT 2021
Author: Lang Hames
Date: 2021-06-18T22:12:39+10:00
New Revision: 8962c68ad007a525f9daa987c99eda57e0d0069a
URL: https://github.com/llvm/llvm-project/commit/8962c68ad007a525f9daa987c99eda57e0d0069a
DIFF: https://github.com/llvm/llvm-project/commit/8962c68ad007a525f9daa987c99eda57e0d0069a.diff
LOG: [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).
Added:
Modified:
llvm/examples/OrcV2Examples/OrcV2CBindingsDumpObjects/OrcV2CBindingsDumpObjects.c
llvm/include/llvm-c/Orc.h
llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
Removed:
################################################################################
diff --git a/llvm/examples/OrcV2Examples/OrcV2CBindingsDumpObjects/OrcV2CBindingsDumpObjects.c b/llvm/examples/OrcV2Examples/OrcV2CBindingsDumpObjects/OrcV2CBindingsDumpObjects.c
index 1a90138d2036..bc063488f74b 100644
--- a/llvm/examples/OrcV2Examples/OrcV2CBindingsDumpObjects/OrcV2CBindingsDumpObjects.c
+++ b/llvm/examples/OrcV2Examples/OrcV2CBindingsDumpObjects/OrcV2CBindingsDumpObjects.c
@@ -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);
}
diff --git a/llvm/include/llvm-c/Orc.h b/llvm/include/llvm-c/Orc.h
index 4b942b2d12d2..6c7c9c9ee1f6 100644
--- a/llvm/include/llvm-c/Orc.h
+++ b/llvm/include/llvm-c/Orc.h
@@ -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.
diff --git a/llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp b/llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
index 71e260f8caf0..39e722f8358f 100644
--- a/llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
@@ -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);
}
More information about the llvm-commits
mailing list