From 3983b23eac93b0e6f28ffba4b626401c5280c10f Mon Sep 17 00:00:00 2001 From: Lukas Zaoral Date: Sat, 12 Sep 2020 11:02:29 +0200 Subject: Replace llvm::CallSite with llvm::CallBase on LLVM 8+ This is in preparation for LLVM 11 as the llvm:CallSite class has been removed. --- lib/Core/StatsTracker.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) (limited to 'lib/Core/StatsTracker.cpp') diff --git a/lib/Core/StatsTracker.cpp b/lib/Core/StatsTracker.cpp index 4b4dc47c..a94bad9e 100644 --- a/lib/Core/StatsTracker.cpp +++ b/lib/Core/StatsTracker.cpp @@ -29,8 +29,10 @@ #include "llvm/ADT/SmallBitVector.h" #include "llvm/IR/BasicBlock.h" -#include "llvm/IR/CFG.h" +#if LLVM_VERSION_CODE < LLVM_VERSION(8, 0) #include "llvm/IR/CallSite.h" +#endif +#include "llvm/IR/CFG.h" #include "llvm/IR/Function.h" #include "llvm/IR/InlineAsm.h" #include "llvm/IR/Instructions.h" @@ -137,8 +139,13 @@ static bool instructionIsCoverable(Instruction *i) { } else { Instruction *prev = &*(--it); if (isa(prev) || isa(prev)) { - Function *target = - getDirectCallTarget(CallSite(prev), /*moduleIsFullyLinked=*/true); + Function *target = getDirectCallTarget( +#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0) + cast(*prev), +#else + CallSite(prev), +#endif + /*moduleIsFullyLinked=*/true); if (target && target->doesNotReturn()) return false; } @@ -788,7 +795,11 @@ void StatsTracker::computeReachableUncovered() { it != ie; ++it) { Instruction *inst = &*it; if (isa(inst) || isa(inst)) { - CallSite cs(inst); +#if LLVM_VERSION_CODE >= LLVM_VERSION(8, 0) + const CallBase &cs = cast(*inst); +#else + const CallSite cs(inst); +#endif if (isa(cs.getCalledValue())) { // We can never call through here so assume no targets // (which should be correct anyhow). -- cgit 1.4.1