[llvm] 24a72dc - [llvm-c] Avoid use of deprecated APIs in unit tests
Nikita Popov via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 6 07:01:39 PST 2021
Author: Nikita Popov
Date: 2021-12-06T16:01:29+01:00
New Revision: 24a72dc070b36d9e62d6b84abe5f1912c5a49581
URL: https://github.com/llvm/llvm-project/commit/24a72dc070b36d9e62d6b84abe5f1912c5a49581
DIFF: https://github.com/llvm/llvm-project/commit/24a72dc070b36d9e62d6b84abe5f1912c5a49581.diff
LOG: [llvm-c] Avoid use of deprecated APIs in unit tests
As pointed out in https://reviews.llvm.org/D114936#3173327,
unit tests were still using deprecated C APIs.
Added:
Modified:
llvm/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp
Removed:
################################################################################
diff --git a/llvm/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp b/llvm/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp
index 09c48dfc865f6..085e8f801db4a 100644
--- a/llvm/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp
+++ b/llvm/unittests/ExecutionEngine/MCJIT/MCJITCAPITest.cpp
@@ -188,9 +188,10 @@ class MCJITCAPITest : public testing::Test, public MCJITTestAPICommon {
LLVMSetTarget(Module, HostTriple.c_str());
LLVMTypeRef stackmapParamTypes[] = { LLVMInt64Type(), LLVMInt32Type() };
+ LLVMTypeRef stackmapTy =
+ LLVMFunctionType(LLVMVoidType(), stackmapParamTypes, 2, 1);
LLVMValueRef stackmap = LLVMAddFunction(
- Module, "llvm.experimental.stackmap",
- LLVMFunctionType(LLVMVoidType(), stackmapParamTypes, 2, 1));
+ Module, "llvm.experimental.stackmap", stackmapTy);
LLVMSetLinkage(stackmap, LLVMExternalLinkage);
Function = LLVMAddFunction(Module, "simple_function",
@@ -203,7 +204,7 @@ class MCJITCAPITest : public testing::Test, public MCJITTestAPICommon {
LLVMConstInt(LLVMInt64Type(), 0, 0), LLVMConstInt(LLVMInt32Type(), 5, 0),
LLVMConstInt(LLVMInt32Type(), 42, 0)
};
- LLVMBuildCall(builder, stackmap, stackmapArgs, 3, "");
+ LLVMBuildCall2(builder, stackmapTy, stackmap, stackmapArgs, 3, "");
LLVMBuildRet(builder, LLVMConstInt(LLVMInt32Type(), 42, 0));
LLVMVerifyModule(Module, LLVMAbortProcessAction, &Error);
@@ -230,7 +231,8 @@ class MCJITCAPITest : public testing::Test, public MCJITTestAPICommon {
LLVMBuilderRef Builder = LLVMCreateBuilder();
LLVMPositionBuilderAtEnd(Builder, Entry);
- LLVMValueRef IntVal = LLVMBuildLoad(Builder, GlobalVar, "intVal");
+ LLVMValueRef IntVal =
+ LLVMBuildLoad2(Builder, LLVMInt32Type(), GlobalVar, "intVal");
LLVMBuildRet(Builder, IntVal);
LLVMVerifyModule(Module, LLVMAbortProcessAction, &Error);
@@ -489,7 +491,8 @@ TEST_F(MCJITCAPITest, addGlobalMapping) {
LLVMBasicBlockRef Entry = LLVMAppendBasicBlock(Function, "");
LLVMBuilderRef Builder = LLVMCreateBuilder();
LLVMPositionBuilderAtEnd(Builder, Entry);
- LLVMValueRef RetVal = LLVMBuildCall(Builder, MappedFn, nullptr, 0, "");
+ LLVMValueRef RetVal =
+ LLVMBuildCall2(Builder, FunctionType, MappedFn, nullptr, 0, "");
LLVMBuildRet(Builder, RetVal);
LLVMDisposeBuilder(Builder);
More information about the llvm-commits
mailing list