nickdesaulniers added inline comments.
================ Comment at: llvm/lib/Transforms/Instrumentation/KCFI.cpp:48-49 + SmallVector<CallInst *, 8> KCFICalls; + for (inst_iterator I = inst_begin(F), E = inst_end(F); I != E; ++I) { + if (auto *CI = dyn_cast<CallInst>(&*I)) + if (CI->getOperandBundle(LLVMContext::OB_kcfi)) ---------------- samitolvanen wrote: > nickdesaulniers wrote: > > prefer a range-for here > > ``` > > for (Instruction &I : F) > > if (auto &CI = dyn_cast<CallInst>(I); > > ``` > `Function` doesn't directly support iterating through instructions. I used > `inst_iterator` here to avoid looping through basic blocks as well. Your > example results in: > ``` > error: non-const lvalue reference to type 'llvm::Instruction' cannot bind to > a value of unrelated type 'llvm::BasicBlock' > ``` That's right, sorry, you'd need either a double-nested for loop for BB : F for I : BB or for I : instructions(F) Please use that ^. Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D135411/new/ https://reviews.llvm.org/D135411 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits