demo.cpp
/* Print the basic blick location in source code.
 */
Print the basic blick location in source code.
Print the basic blick location in source code .
void Support::printSrcCodeInfo(BasicBlock * BB)
{
	for (BasicBlock::iterator II = BB->begin(); II != BB->end(); II++) {
	    Instruction *I = &*II;
		const DILocation * DIL = I->getDebugLoc();
		if(!DIL){
			continue;
		}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";
			break;
		}
	}
	return;
}
void Support :: printSrcCodeInfo ( BasicBlock * BB ) { for ( BasicBlock :: iterator II = BB -> begin ( ) ; II != BB -> end ( ) ; II ++ ) { Instruction * I = & * II ; const DILocation * DIL = I -> getDebugLoc ( ) ; if ( ! DIL ) { continue ; } 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 " ; break ; } } return ; }
Print the basic blick location in source code.
Print the basic blick location in source code .