[llvm] 40df1b1 - [ORC][C-bindings] Replace LLVMOrcJITTargetMachineBuilderDisposeTargetTriple.
Lang Hames via llvm-commits
llvm-commits at lists.llvm.org
Fri May 21 17:38:19 PDT 2021
Author: Lang Hames
Date: 2021-05-21T17:38:06-07:00
New Revision: 40df1b15b4f718d203272290cc831c7b174c1a55
URL: https://github.com/llvm/llvm-project/commit/40df1b15b4f718d203272290cc831c7b174c1a55
DIFF: https://github.com/llvm/llvm-project/commit/40df1b15b4f718d203272290cc831c7b174c1a55.diff
LOG: [ORC][C-bindings] Replace LLVMOrcJITTargetMachineBuilderDisposeTargetTriple.
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.
Patch by Mats Larsen -- thanks Mats!
Reviewed By: lhames
Differential Revision: https://reviews.llvm.org/D102957
Added:
Modified:
llvm/include/llvm-c/Orc.h
llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
Removed:
################################################################################
diff --git a/llvm/include/llvm-c/Orc.h b/llvm/include/llvm-c/Orc.h
index 17e9dab6ea9e5..612c80bae6611 100644
--- a/llvm/include/llvm-c/Orc.h
+++ b/llvm/include/llvm-c/Orc.h
@@ -652,7 +652,7 @@ void LLVMOrcDisposeJITTargetMachineBuilder(
* 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 @@ char *LLVMOrcJITTargetMachineBuilderGetTargetTriple(
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.
*
diff --git a/llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp b/llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
index dd81ba14e2957..3c6bd8fa4ac05 100644
--- a/llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
+++ b/llvm/lib/ExecutionEngine/Orc/OrcV2CBindings.cpp
@@ -486,11 +486,6 @@ void LLVMOrcJITTargetMachineBuilderSetTargetTriple(
unwrap(JTMB)->getTargetTriple() = Triple(TargetTriple);
}
-void LLVMOrcJITTargetMachineBuilderDisposeTargetTriple(
- LLVMOrcJITTargetMachineBuilderRef JTMB, char *TargetTriple) {
- free(TargetTriple);
-}
-
LLVMErrorRef LLVMOrcObjectLayerAddObjectFile(LLVMOrcObjectLayerRef ObjLayer,
LLVMOrcJITDylibRef JD,
LLVMMemoryBufferRef ObjBuffer) {
diff --git a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
index 8b208d8082382..ceadebf811c7d 100644
--- a/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
+++ b/llvm/unittests/ExecutionEngine/Orc/OrcCAPITest.cpp
@@ -63,7 +63,7 @@ class OrcCAPITestBase : public testing::Test {
// 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.
More information about the llvm-commits
mailing list