[PATCH] D102957: [Orc][C-bindings] remove LLVMOrcJITTargetMachineBuilderDisposeTargetTriple in favor of LLVMDisposeMessage
Mats Larsen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri May 21 16:32:24 PDT 2021
supergrecko created this revision.
supergrecko added a reviewer: lhames.
Herald added a reviewer: deadalnix.
Herald added a subscriber: hiraditya.
supergrecko requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
The implementation and intent behind freeing the triple string here is the same as LLVMGetDefaultTargetTriple (and any other owned c string returned from the C API), so we should use LLVMDisposeMessage for to free the string for consistency.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D102957
Files:
llvm/include/llvm-c/Orc.h
llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
Index: llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
===================================================================
--- llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
+++ llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
@@ -63,7 +63,7 @@
// the case that it fails anyway.
char *TT = LLVMOrcJITTargetMachineBuilderGetTargetTriple(JTMB);
TargetTriple = TT;
- LLVMOrcJITTargetMachineBuilderDisposeTargetTriple(JTMB, TT);
+ LLVMDisposeMessage(TT);
if (!isSupported(TargetTriple)) {
// If this triple isn't supported then bail out.
Index: llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
===================================================================
--- llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
+++ llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
@@ -486,11 +486,6 @@
unwrap(JTMB)->getTargetTriple() = Triple(TargetTriple);
}
-void LLVMOrcJITTargetMachineBuilderDisposeTargetTriple(
- LLVMOrcJITTargetMachineBuilderRef JTMB, char *TargetTriple) {
- free(TargetTriple);
-}
-
LLVMErrorRef LLVMOrcObjectLayerAddObjectFile(LLVMOrcObjectLayerRef ObjLayer,
LLVMOrcJITDylibRef JD,
LLVMMemoryBufferRef ObjBuffer) {
Index: llvm/include/llvm-c/Orc.h
===================================================================
--- llvm/include/llvm-c/Orc.h
+++ llvm/include/llvm-c/Orc.h
@@ -652,7 +652,7 @@
* Returns the target triple for the given JITTargetMachineBuilder as a string.
*
* The caller owns the resulting string as must dispose of it by calling
- * LLVMOrcJITTargetMachineBuilderDisposeTargetTriple.
+ * LLVMDisposeMessage
*/
char *LLVMOrcJITTargetMachineBuilderGetTargetTriple(
LLVMOrcJITTargetMachineBuilderRef JTMB);
@@ -664,13 +664,6 @@
void LLVMOrcJITTargetMachineBuilderSetTargetTriple(
LLVMOrcJITTargetMachineBuilderRef JTMB, const char *TargetTriple);
-/**
- * Destroy a triple string returned by
- * LLVMOrcJITTargetMachineBuilderGetTargetTriple.
- */
-void LLVMOrcJITTargetMachineBuilderDisposeTargetTriple(
- LLVMOrcJITTargetMachineBuilderRef JTMB, char *TargetTriple);
-
/**
* Add an object to an ObjectLayer to the given JITDylib.
*
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D102957.347151.patch
Type: text/x-patch
Size: 2233 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210521/6a10f089/attachment.bin>
More information about the llvm-commits
mailing list