Example #1
0
bool LowerSwitchPass::runOnFunction(Function &F) {
    bool changed = false;

    for (Function::iterator I = F.begin(), E = F.end(); I != E; ) {
        BasicBlock *cur = I++; // Advance over block so we don't traverse new blocks

        if (SwitchInst *SI = dyn_cast<SwitchInst>(cur->getTerminator())) {
            changed = true;
            processSwitchInst(SI);
        }
    }

    return changed;
}
Example #2
0
bool LowerSwitchPass::runOnFunction(Function &F) {
  bool changed = false;

  for (Function::iterator I = F.begin(), E = F.end(); I != E; ) {
#if LLVM_VERSION_CODE >= LLVM_VERSION(3, 8)
    auto *cur = static_cast<BasicBlock *>(I);
#else
    BasicBlock *cur = I;
#endif
    I++; // Advance over block so we don't traverse new blocks

    if (SwitchInst *SI = dyn_cast<SwitchInst>(cur->getTerminator())) {
      changed = true;
      processSwitchInst(SI);
    }
  }

  return changed;
}