Skip to content

Commit ad18049

Browse files
author
Martin Mory
committed
add LLVM 14 support, fix API change breakage
1 parent eb80ede commit ad18049

20 files changed

Lines changed: 30 additions & 29 deletions

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -179,7 +179,7 @@ include_directories(${SQLITE3_INCLUDE_DIR})
179179
# LLVM
180180
if (NOT PHASAR_IN_TREE)
181181
# Only search for LLVM if we build out of tree
182-
find_package(LLVM 13 REQUIRED CONFIG)
182+
find_package(LLVM 14 REQUIRED CONFIG)
183183
include_directories(${LLVM_INCLUDE_DIRS})
184184
link_directories(${LLVM_LIB_PATH} ${LLVM_LIBRARY_DIRS})
185185
endif()

Config.cmake.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ foreach(component ${phasar_FIND_COMPONENTS})
99
endforeach()
1010

1111
function(phasar_config executable)
12-
find_package(LLVM 13 REQUIRED CONFIG)
12+
find_package(LLVM 14 REQUIRED CONFIG)
1313
include_directories(${LLVM_INCLUDE_DIRS})
1414
link_directories(${LLVM_LIB_PATH} ${LLVM_LIBRARY_DIRS})
1515
find_library(LLVM_LIBRARY NAMES LLVM HINTS ${LLVM_LIBRARY_DIRS})

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ PhASAR requires C++-17.
2020

2121
Currently supported version of LLVM
2222
-----------------------------------
23-
PhASAR is currently set up to support LLVM-13.0.
23+
PhASAR is currently set up to support LLVM-14.0.
2424

2525
What is PhASAR?
2626
---------------

bootstrap.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,10 @@ source ./utils/safeCommandsSet.sh
55

66
readonly PHASAR_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null 2>&1 && pwd )"
77
readonly PHASAR_INSTALL_DIR="/usr/local/phasar"
8-
readonly LLVM_INSTALL_DIR="/usr/local/llvm-13"
8+
readonly LLVM_INSTALL_DIR="/usr/local/llvm-14"
99

1010
NUM_THREADS=$(nproc)
11-
LLVM_RELEASE=llvmorg-13.0.0
11+
LLVM_RELEASE=llvmorg-14.0.0
1212
DO_UNIT_TEST=true
1313

1414

lib/PhasarLLVM/ControlFlow/Resolver/OTFResolver.cpp

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -261,12 +261,11 @@ std::vector<std::pair<const llvm::Value *, const llvm::Value *>>
261261
OTFResolver::getActualFormalPointerPairs(const llvm::CallBase *CallSite,
262262
const llvm::Function *CalleeTarget) {
263263
std::vector<std::pair<const llvm::Value *, const llvm::Value *>> Pairs;
264-
Pairs.reserve(CallSite->getNumArgOperands());
264+
Pairs.reserve(CallSite->arg_size());
265265
// ordinary case
266266

267267
unsigned Idx = 0;
268-
for (; Idx < CallSite->getNumArgOperands() && Idx < CalleeTarget->arg_size();
269-
++Idx) {
268+
for (; Idx < CallSite->arg_size() && Idx < CalleeTarget->arg_size(); ++Idx) {
270269
// only collect pointer typed pairs
271270
if (CallSite->getArgOperand(Idx)->getType()->isPointerTy() &&
272271
CalleeTarget->getArg(Idx)->getType()->isPointerTy()) {
@@ -297,7 +296,7 @@ OTFResolver::getActualFormalPointerPairs(const llvm::CallBase *CallSite,
297296
}
298297

299298
if (VarArgs) {
300-
for (; Idx < CallSite->getNumArgOperands(); ++Idx) {
299+
for (; Idx < CallSite->arg_size(); ++Idx) {
301300
if (CallSite->getArgOperand(Idx)->getType()->isPointerTy()) {
302301
Pairs.emplace_back(CallSite->getArgOperand(Idx), VarArgs);
303302
}

lib/PhasarLLVM/DataFlowSolver/IfdsIde/IFDSFieldSensTaintAnalysis/Utils/DataFlowUtils.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,7 +758,7 @@ DataFlowUtils::getSanitizedArgList(const llvm::CallInst *CallInst,
758758
const llvm::Value *>>
759759
SanitizedArgList;
760760

761-
for (unsigned I = 0; I < CallInst->getNumArgOperands(); ++I) {
761+
for (unsigned I = 0; I < CallInst->arg_size(); ++I) {
762762
auto *const Arg = CallInst->getOperand(I);
763763
const auto *const Param = getNthFunctionArgument(DestFun, I);
764764

lib/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDEExtendedTaintAnalysis.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -440,8 +440,7 @@ IDEExtendedTaintAnalysis::getRetFlowFunction(n_t CallSite, f_t CalleeFun,
440440
const auto *Call = llvm::cast<llvm::CallBase>(CallSite);
441441
return makeLambdaFlow<d_t>([this, Call, CalleeFun,
442442
ExitStmt{llvm::cast<llvm::ReturnInst>(ExitStmt)},
443-
PTC{ArgPointsToCache(PT,
444-
Call->getNumArgOperands(),
443+
PTC{ArgPointsToCache(PT, Call->arg_size(),
445444
HasPrecisePointsToInfo)}](
446445
d_t Source) -> std::set<d_t> {
447446
if (isZeroValue(Source)) {

lib/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDEGeneralizedLCA/IDEGeneralizedLCA.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -398,8 +398,8 @@ IDEGeneralizedLCA::getCallEdgeFunction(IDEGeneralizedLCA::n_t CallStmt,
398398
IDEGeneralizedLCA::d_t DestNode) {
399399
const auto *CallSite = llvm::cast<llvm::CallBase>(CallStmt);
400400
if (isZeroValue(SrcNode)) {
401-
auto Len = std::min<size_t>(CallSite->getNumArgOperands(),
402-
DestinationMethod->arg_size());
401+
auto Len =
402+
std::min<size_t>(CallSite->arg_size(), DestinationMethod->arg_size());
403403
for (size_t I = 0; I < Len; ++I) {
404404
const auto *FormalArg = getNthFunctionArgument(DestinationMethod, I);
405405
if (DestNode == FormalArg) {

lib/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDEGeneralizedLCA/MapFactsToCalleeFlowFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ namespace psr {
2323
MapFactsToCalleeFlowFunction::MapFactsToCalleeFlowFunction(
2424
const llvm::CallBase *CallSite, const llvm::Function *Callee)
2525
: CallSite(CallSite), Callee(Callee) {
26-
for (unsigned Idx = 0; Idx < CallSite->getNumArgOperands(); ++Idx) {
26+
for (unsigned Idx = 0; Idx < CallSite->arg_size(); ++Idx) {
2727
Actuals.push_back(CallSite->getArgOperand(Idx));
2828
}
2929
// Set up the formal parameters

lib/PhasarLLVM/DataFlowSolver/IfdsIde/Problems/IDEGeneralizedLCA/MapFactsToCallerFlowFunction.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ MapFactsToCallerFlowFunction::MapFactsToCallerFlowFunction(
2222
const llvm::Function *Callee)
2323
: CallSite(CallSite), ExitStmt(llvm::cast<llvm::ReturnInst>(ExitStmt)),
2424
Callee(Callee) {
25-
for (unsigned Idx = 0; Idx < CallSite->getNumArgOperands(); ++Idx) {
25+
for (unsigned Idx = 0; Idx < CallSite->arg_size(); ++Idx) {
2626
Actuals.push_back(CallSite->getArgOperand(Idx));
2727
}
2828
// Set up the formal parameters

0 commit comments

Comments
 (0)