Skip to content

Commit

Permalink
Remove getPointerElementType()
Browse files Browse the repository at this point in the history
The getPointerElementType will be deprecated in future versions of LLVM. Considering compatibility, avoid using getPointerElementType()->isIntegerTy(8) to determine if the arguments and return values are of the void * type.
  • Loading branch information
shuangxiangkan committed Dec 18, 2023
1 parent 5b66c99 commit 8f21529
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions svf-llvm/lib/LLVMModule.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -982,10 +982,12 @@ void LLVMModuleSet::buildFunToFunMap()
Type* returnType1 = appfunc->getReturnType();
Type* returnType2 = owfunc->getReturnType();

// Check if the return types are compatible: (1) The types are exactly the same, (2) Both are pointer types, and at least one of them is a void*.
if (!(returnType1 == returnType2 ||
(returnType1->isPointerTy() && returnType2->isPointerTy() &&
(returnType1->getPointerElementType()->isIntegerTy(8) || returnType2->getPointerElementType()->isIntegerTy(8)))))
// Check if the return types are compatible:
// (1) The types are exactly the same,
// (2) Both are pointer types, and at least one of them is a void*.
// Note that getPointerElementType() will be deprecated in the future versions of LLVM.
// Considering compatibility, avoid using getPointerElementType()->isIntegerTy(8) to determine if it is a void * type.
if (!(returnType1 == returnType2 || (returnType1->isPointerTy() && returnType2->isPointerTy())))
{
continue;

Check warning on line 992 in svf-llvm/lib/LLVMModule.cpp

View check run for this annotation

Codecov / codecov/patch

svf-llvm/lib/LLVMModule.cpp#L992

Added line #L992 was not covered by tests
}
Expand All @@ -1002,9 +1004,7 @@ void LLVMModuleSet::buildFunToFunMap()
Type* argType2 = argIter2->getType();

// Check if the parameters types are compatible: (1) The types are exactly the same, (2) Both are pointer types, and at least one of them is a void*.
if (!(argType1 == argType2 ||
(argType1->isPointerTy() && argType2->isPointerTy() &&
(argType1->getPointerElementType()->isIntegerTy(8) || argType2->getPointerElementType()->isIntegerTy(8)))))
if (!(argType1 == argType2 || (argType1->isPointerTy() && argType2->isPointerTy())))
{
argMismatch = true;
break;
Expand Down

0 comments on commit 8f21529

Please sign in to comment.