demo.cpp
/* Print the instruction location in source code.
 */
Print the instruction location in source code.
Print the instruction location in source code .
void Support::printSrcCodeInfo(Instruction * Ins)
{
	Instruction *I = &*Ins;
	const DILocation * DIL = I->getDebugLoc();
	if(!DIL){
		return;
	}else{
		char pPath[200];
		string sFileName;
		if(DIL->getFilename().str().substr(0,5) == "/home"){
			sFileName = DIL->getFilename().str();
		}else{
			sFileName = DIL->getDirectory().str() + "/" + DIL->getFilename().str();
		}
		realpath(sFileName.c_str(), pPath);
		sFileName = string(sFileName);
		unsigned int numLine = DIL->getLine();
		errs() << "//---" << sFileName << ": " << numLine << "\n";
	}
	return;
}
void Support :: printSrcCodeInfo ( Instruction * Ins ) { Instruction * I = & * Ins ; const DILocation * DIL = I -> getDebugLoc ( ) ; if ( ! DIL ) { return ; } else { char pPath [ 200 ] ; string sFileName ; if ( DIL -> getFilename ( ) . str ( ) . substr ( 0 , 5 ) == " " ) { sFileName = DIL -> getFilename ( ) . str ( ) ; } else { sFileName = DIL -> getDirectory ( ) . str ( ) + " " + DIL -> getFilename ( ) . str ( ) ; } realpath ( sFileName . c_str ( ) , pPath ) ; sFileName = string ( sFileName ) ; unsigned int numLine = DIL -> getLine ( ) ; errs ( ) << " " << sFileName << " " << numLine << " \n " ; } return ; }
Print the instruction location in source code.
Print the instruction location in source code .