Fix bug in LLVM bytecode runtime

Fixes a bug in the PtrVerifier pass when using LLVM >= v3.5 for the
bytecode signature runtime.

LLVM 3.5 changed the meaning of "use" and introduced "user". This fix
swaps out "use" keywords for "user" so the code functions correctly when
using LLVM 3.5+.
pull/119/head
Jonas Zaddach (jzaddach) 6 years ago committed by Micah Snyder (micasnyd)
parent c6f6b9e67b
commit 965d7cc82e
  1. 10
      libclamav/c++/ClamBCRTChecks.cpp

@ -778,8 +778,13 @@ namespace llvm {
bool checkCond(Instruction *ICI, Instruction *I, bool equal)
{
#if LLVM_VERSION < 35
for (Value::use_iterator JU=ICI->use_begin(),JUE=ICI->use_end();
JU != JUE; ++JU) {
#else
for (Value::user_iterator JU=ICI->user_begin(),JUE=ICI->user_end();
JU != JUE; ++JU) {
#endif
Value *JU_V = *JU;
if (BranchInst *BI = dyn_cast<BranchInst>(JU_V)) {
if (!BI->isConditional())
@ -802,8 +807,13 @@ namespace llvm {
bool checkCondition(Instruction *CI, Instruction *I)
{
#if LLVM_VERSION < 35
for (Value::use_iterator U=CI->use_begin(),UE=CI->use_end();
U != UE; ++U) {
#else
for (Value::user_iterator U=CI->user_begin(),UE=CI->user_end();
U != UE; ++U) {
#endif
Value *U_V = *U;
if (ICmpInst *ICI = dyn_cast<ICmpInst>(U_V)) {
if (ICI->getOperand(0)->stripPointerCasts() == CI &&

Loading…
Cancel
Save