Don't cast the iterator directly.

LLVM 2.8 doesn't allow this, first dereference, then cast.
This is compatible with 2.7.
0.96
Török Edvin 15 years ago
parent e25293055d
commit 1300b00244
  1. 8
      libclamav/c++/ClamBCRTChecks.cpp
  2. 5
      libclamav/c++/bytecode2llvm.cpp

@ -553,14 +553,15 @@ namespace {
{
for (Value::use_iterator JU=ICI->use_begin(),JUE=ICI->use_end();
JU != JUE; ++JU) {
if (BranchInst *BI = dyn_cast<BranchInst>(JU)) {
Value *JU_V = *JU;
if (BranchInst *BI = dyn_cast<BranchInst>(JU_V)) {
if (!BI->isConditional())
continue;
BasicBlock *S = BI->getSuccessor(equal);
if (DT->dominates(S, I->getParent()))
return true;
}
if (BinaryOperator *BI = dyn_cast<BinaryOperator>(JU)) {
if (BinaryOperator *BI = dyn_cast<BinaryOperator>(JU_V)) {
if (BI->getOpcode() == Instruction::Or &&
checkCond(BI, I, equal))
return true;
@ -576,7 +577,8 @@ namespace {
{
for (Value::use_iterator U=CI->use_begin(),UE=CI->use_end();
U != UE; ++U) {
if (ICmpInst *ICI = dyn_cast<ICmpInst>(U)) {
Value *U_V = *U;
if (ICmpInst *ICI = dyn_cast<ICmpInst>(U_V)) {
if (ICI->getOperand(0)->stripPointerCasts() == CI &&
isa<ConstantPointerNull>(ICI->getOperand(1))) {
if (checkCond(ICI, I, ICI->getPredicate() == ICmpInst::ICMP_EQ))

@ -819,11 +819,12 @@ public:
StoreInst *SI = 0;
for (Value::use_iterator I=VI->use_begin(),
E=VI->use_end(); I != E; ++I) {
if (StoreInst *S = dyn_cast<StoreInst>(I)) {
Value *I_V = *I;
if (StoreInst *S = dyn_cast<StoreInst>(I_V)) {
if (SI)
return V;
SI = S;
} else if (!isa<LoadInst>(I))
} else if (!isa<LoadInst>(I_V))
return V;
}
V = SI->getOperand(0);

Loading…
Cancel
Save