56 for(CallGraph::FunctionSet::const_iterator cit = callees.begin(), ecit = callees.end(); cit!=ecit; cit++)
63 worklist.push(it->first->getCallICFGNode());
79 for (CallSiteSet::iterator it = csSet.begin(), eit =
80 csSet.end(); it != eit; ++it)
116 for(CallGraph::FunctionSet::const_iterator cit = callees.begin(), ecit = callees.end(); cit!=ecit; cit++)
122 assert(!arglist.empty() &&
"no actual parameter at deallocation site?");
124 for (SVFIR::ValVarList::const_iterator ait = arglist.begin(),
125 aeit = arglist.end(); ait != aeit; ++ait)
127 const SVFVar *svfVar = *ait;
165 eventStack.push_back(
196 bool success =
false;
198 if(fun->
getName() ==
"SAFEMALLOC")
203 else if(fun->
getName() ==
"NFRMALLOC")
208 else if(fun->
getName() ==
"PLKMALLOC")
213 else if(fun->
getName() ==
"CLKMALLOC")
218 else if(fun->
getName() ==
"NFRLEAKFP" || fun->
getName() ==
"PLKLEAKFP"
225 writeWrnMsg(
"\t can not validate, check function not found, please put it at the right place!!");
235 outs() <<
sucMsg(
"\t SUCCESS :") << funName <<
" check <src id:" << source->
getId()
236 <<
", cs id:" << (
getSrcCSID(source))->valueOnlyToString() <<
"> at ("
241 outs() <<
sucMsg(
"\t SUCCESS :") << funName<<
"\n";
249 <<
", cs id:" << (
getSrcCSID(source))->valueOnlyToString() <<
"> at ("
251 assert(
false &&
"test case failed!");
256 assert(
false &&
"test case failed!");
266 bool expectedFailure =
false;
268 if(fun->
getName() ==
"NFRLEAKFP")
271 expectedFailure =
true;
273 else if(fun->
getName() ==
"PLKLEAKFP")
276 expectedFailure =
true;
278 else if(fun->
getName() ==
"LEAKFN")
281 expectedFailure =
true;
283 else if(fun->
getName() ==
"SAFEMALLOC" || fun->
getName() ==
"NFRMALLOC"
284 || fun->
getName() ==
"PLKMALLOC" || fun->
getName() ==
"CLKLEAKFN")
290 writeWrnMsg(
"\t can not validate, check function not found, please put it at the right place!!");
300 outs() <<
sucMsg(
"\t EXPECTED-FAILURE :") << funName <<
"\n";
303 outs() <<
sucMsg(
"\t EXPECTED-FAILURE :") << funName <<
" check <src id:" << source->
getId()
304 <<
", cs id:" << (
getSrcCSID(source))->valueOnlyToString() <<
"> at ("
312 assert(
false &&
"test case failed!");
316 <<
" check <src id:" << source->
getId()
317 <<
", cs id:" << (
getSrcCSID(source))->valueOnlyToString() <<
"> at ("
319 assert(
false &&
"test case failed!");
void getCallees(const CallICFGNode *cs, FunctionSet &callees)
Get all callees for a callsite.
Set< const FunObjVar * > FunctionSet
const FunObjVar * getCalledFunction() const
const RetICFGNode * getRetICFGNode() const
Return callsite.
const std::string getSourceLoc() const override
bool isUncalledFunction() const
std::vector< SVFBugEvent > EventStack
virtual const FunObjVar * getFun() const
Return the function of this ICFGNode.
virtual const SVFBasicBlock * getBB() const
Return the basic block of this ICFGNode.
void addSrcToCSID(const SVFGNode *src, const CallICFGNode *cs)
Record a source to its callsite.
virtual void initSrcs() override
Initialize sources and sinks.
void validateSuccessTests(const SVFGNode *source, const FunObjVar *fun)
virtual void initSnks() override
virtual bool isSinkLikeFun(const FunObjVar *fun) override
Whether the function is a heap deallocator (free/release memory).
FIFOWorkList< const CallICFGNode * > CSWorkList
virtual void reportBug(ProgSlice *slice) override
Report leaks.
void testsValidation(const ProgSlice *slice)
Validate test cases for regression test purpose.
const CallICFGNode * getSrcCSID(const SVFGNode *src)
void validateExpectedFailureTests(const SVFGNode *source, const FunObjVar *fun)
virtual bool isSourceLikeFun(const FunObjVar *fun) override
Whether the function is a heap allocator/reallocator (allocate memory).
static const Option< bool > ValidateTests
void evalFinalCond2Event(GenericBug::EventStack &eventStack) const
Add final condition to eventStack.
const SVFGNode * getSource() const
root and sink operations
const CallICFGNode * getCallICFGNode() const
const FunObjVar * getParent() const
const SVFGNode * getDefSVFGNode(const ValVar *valVar) const
Given a valVar, return its definition site.
CSToArgsListMap & getCallSiteArgsMap()
Get callsite argument list.
const ValVar * getCallSiteRet(const RetICFGNode *cs) const
Get callsite return.
std::vector< const ValVar * > ValVarList
CSToRetMap & getCallSiteRets()
Get callsite return.
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
NodeID getId() const
Get ID.
virtual const SVFType * getType() const
virtual const std::string & getName() const
virtual bool isPointer() const
Check if this variable represents a pointer.
bool test(unsigned Idx) const
CallGraph * getCallgraph() const
Get Callgraph.
virtual bool isSomePathReachable()
Whether it is some path reachable from a source.
SVFIR * getPAG() const
Get SVFIR.
Set< const CallICFGNode * > CallSiteSet
virtual bool isAllPathReachable()
Whether it is all path reachable from a source.
void addToSinks(const SVFGNode *node)
void addToSources(const SVFGNode *node)
const SVFG * getSVFG() const
Get SVFG.
bool isInAWrapper(const SVFGNode *src, CallSiteSet &csIdSet)
Identify allocation wrappers.
virtual const FunObjVar * getFun() const
Get the function of this SVFGNode.
ActualParmVFGNode * getActualParmVFGNode(const SVFVar *aparm, const CallICFGNode *cs) const
std::string sucMsg(const std::string &msg)
Returns successful message by converting a string into green string output.
LLVM_NODISCARD bool isa(const Y &Val)
std::string errMsg(const std::string &msg)
Print error message by converting a string into red string output.
std::ostream & errs()
Overwrite llvm::errs().
bool isExtCall(const FunObjVar *fun)
void writeWrnMsg(const std::string &msg)
Writes a message run through wrnMsg.
std::ostream & outs()
Overwrite llvm::outs().