Lines Matching full:cb
98 /// \param CB indirect call to instrument.
99 void insertCFGuardCheck(CallBase *CB);
139 /// \param CB indirect call to instrument.
140 void insertCFGuardDispatch(CallBase *CB);
172 void CFGuardImpl::insertCFGuardCheck(CallBase *CB) {
174 assert(Triple(CB->getModule()->getTargetTriple()).isOSWindows() &&
176 assert(CB->isIndirectCall() &&
179 IRBuilder<> B(CB);
180 Value *CalledOperand = CB->getCalledOperand();
185 if (auto Bundle = CB->getOperandBundle(LLVMContext::OB_funclet))
201 void CFGuardImpl::insertCFGuardDispatch(CallBase *CB) {
203 assert(Triple(CB->getModule()->getTargetTriple()).isOSWindows() &&
205 assert(CB->isIndirectCall() &&
208 IRBuilder<> B(CB);
209 Value *CalledOperand = CB->getCalledOperand();
217 CB->getOperandBundlesAsDefs(Bundles);
221 assert((isa<CallInst>(CB) || isa<InvokeInst>(CB)) &&
223 CallBase *NewCB = CallBase::Create(CB, Bundles, CB->getIterator());
229 CB->replaceAllUsesWith(NewCB);
232 CB->eraseFromParent();
277 auto *CB = dyn_cast<CallBase>(&I);
278 if (CB && CB->isIndirectCall() && !CB->hasFnAttr("guard_nocf")) {
279 IndirectCalls.push_back(CB);
292 for (CallBase *CB : IndirectCalls) {
293 insertCFGuardDispatch(CB);
296 for (CallBase *CB : IndirectCalls) {
297 insertCFGuardCheck(CB);