lib/range-analysis/src/OverflowDetect/OverflowDetect.cpp
/*
 * Creates a Basic Block that will be executed when an overflow occurs.
 * It receives an argument that tells what is the next basic block to be executed.
 */
Creates a Basic Block that will be executed when an overflow occurs.
It receives an argument that tells what is the next basic block to be executed.
Creates a Basic Block that will be executed when an overflow occurs . It receives an argument that tells what is the next basic block to be executed .
BasicBlock* OverflowDetect::NewOverflowOccurrenceBlock(Instruction* I, BasicBlock* NextBlock, Value *messagePtr){
	Constant* SourceFile = getSourceFile(I);
	Constant* LineNumber = getLineNumber(I);
	BasicBlock* result = BasicBlock::Create(*context, "", I->getParent()->getParent(), NextBlock);
	BranchInst* branch = BranchInst::Create(NextBlock, result);
	if (InsertFprintfs){
		Value* vStderr = new LoadInst(GVstderr, "loadstderr", branch);
		std::vector<Value*> args;
		args.push_back(vStderr);
		args.push_back(messagePtr);
		args.push_back(SourceFile);
		args.push_back(LineNumber);
		CallInst::Create(FPrintF, args, "", branch);
	}
	return result;
}
BasicBlock * OverflowDetect :: NewOverflowOccurrenceBlock ( Instruction * I , BasicBlock * NextBlock , Value * messagePtr ) { Constant * SourceFile = getSourceFile ( I ) ; Constant * LineNumber = getLineNumber ( I ) ; BasicBlock * result = BasicBlock :: Create ( * context , " " , I -> getParent ( ) -> getParent ( ) , NextBlock ) ; BranchInst * branch = BranchInst :: Create ( NextBlock , result ) ; if ( InsertFprintfs ) { Value * vStderr = new LoadInst ( GVstderr , " " , branch ) ; std :: vector < Value * > args ; args . push_back ( vStderr ) ; args . push_back ( messagePtr ) ; args . push_back ( SourceFile ) ; args . push_back ( LineNumber ) ; CallInst :: Create ( FPrintF , args , " " , branch ) ; } return result ; }
Creates a Basic Block that will be executed when an overflow occurs.
Creates a Basic Block that will be executed when an overflow occurs .