本文整理汇总了C++中module::iterator::doesNotAccessMemory方法的典型用法代码示例。如果您正苦于以下问题:C++ iterator::doesNotAccessMemory方法的具体用法?C++ iterator::doesNotAccessMemory怎么用?C++ iterator::doesNotAccessMemory使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类module::iterator
的用法示例。
在下文中一共展示了iterator::doesNotAccessMemory方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: init
bool
StdLibDataStructures::runOnModule (Module &M) {
//
// Get the results from the local pass.
//
init (&getAnalysis<LocalDataStructures>(), true, true, false, false);
AllocWrappersAnalysis = &getAnalysis<AllocIdentify>();
//
// Fetch the DSGraphs for all defined functions within the module.
//
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
if (!I->isDeclaration())
getOrCreateGraph(&*I);
//
// Erase direct calls to functions that don't return a pointer and are marked
// with the readnone annotation.
//
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
if (I->isDeclaration() && I->doesNotAccessMemory() &&
!isa<PointerType>(I->getReturnType()))
eraseCallsTo(I);
//
// Erase direct calls to external functions that are not varargs, do not
// return a pointer, and do not take pointers.
//
for (Module::iterator I = M.begin(), E = M.end(); I != E; ++I)
if (I->isDeclaration() && !I->isVarArg() &&
!isa<PointerType>(I->getReturnType())) {
bool hasPtr = false;
for (Function::arg_iterator ii = I->arg_begin(), ee = I->arg_end();
ii != ee;
++ii)
if (isa<PointerType>(ii->getType())) {
hasPtr = true;
break;
}
if (!hasPtr)
eraseCallsTo(I);
}
if(!DisableStdLib) {
//
// Scan through the function summaries and process functions by summary.
//
for (int x = 0; recFuncs[x].name; ++x)
if (Function* F = M.getFunction(recFuncs[x].name))
if (F->isDeclaration()) {
processFunction(x, F);
}
std::set<std::string>::iterator ai = AllocWrappersAnalysis->alloc_begin();
std::set<std::string>::iterator ae = AllocWrappersAnalysis->alloc_end();
int x;
for (x = 0; recFuncs[x].name; ++x) {
if(recFuncs[x].name == std::string("malloc"))
break;
}
for(;ai != ae; ++ai) {
if(Function* F = M.getFunction(*ai))
processFunction(x, F);
}
ai = AllocWrappersAnalysis->dealloc_begin();
ae = AllocWrappersAnalysis->dealloc_end();
for (x = 0; recFuncs[x].name; ++x) {
if(recFuncs[x].name == std::string("free"))
break;
}
for(;ai != ae; ++ai) {
if(Function* F = M.getFunction(*ai))
processFunction(x, F);
}
//
// Merge return values and checked pointer values for SAFECode run-time
// checks.
//
processRuntimeCheck (M, "boundscheck", 2);
processRuntimeCheck (M, "boundscheckui", 2);
processRuntimeCheck (M, "exactcheck2", 1);
processRuntimeCheck (M, "boundscheck_debug", 2);
processRuntimeCheck (M, "boundscheckui_debug", 2);
processRuntimeCheck (M, "exactcheck2_debug", 1);
processRuntimeCheck (M, "pchk_getActualValue", 1);
}
//
// In the Local DSA Pass, we marked nodes passed to/returned from 'StdLib'
// functions as External because, at that point, they were. However, they no
// longer are necessarily External, and we need to update accordingly.
//
GlobalsGraph->maskIncompleteMarkers();
//.........这里部分代码省略.........