34using namespace SVFUtil;
79 for (CallSiteSet::iterator
it =
csSet.begin(),
eit =
122 assert(!
arglist.empty() &&
"no actual parameter at deallocation site?");
124 for (SVFIR::SVFVarList::const_iterator
ait =
arglist.begin(),
138 if(SVFUtil::isa<DummyValVar>(
ld->getDstNode()))
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!!");
242 assert(
false &&
"test case failed!");
253 if(fun->
getName() ==
"NFRLEAKFP")
258 else if(fun->
getName() ==
"PLKLEAKFP")
263 else if(fun->
getName() ==
"LEAKFN")
268 else if(fun->
getName() ==
"SAFEMALLOC" || fun->
getName() ==
"NFRMALLOC"
269 || fun->
getName() ==
"PLKMALLOC" || fun->
getName() ==
"CLKLEAKFN")
275 writeWrnMsg(
"\t can not validate, check function not found, please put it at the right place!!");
290 <<
" check <src id:" <<
source->getId()
293 assert(
false &&
"test case failed!");
const RetICFGNode * getRetICFGNode() const
Return callsite.
const std::string getSourceLoc() const override
const SVFFunction * getCalledFunction() const
std::vector< SVFBugEvent > EventStack
WorkList worklist
Worklist for resolution.
virtual const SVFFunction * getFun() const
Return the function of this ICFGNode.
virtual const SVFBasicBlock * getBB() const
Return the basic block of this ICFGNode.
void validateSuccessTests(const SVFGNode *source, const SVFFunction *fun)
void addSrcToCSID(const SVFGNode *src, const CallICFGNode *cs)
Record a source to its callsite.
virtual void initSrcs() override
Initialize sources and sinks.
virtual void initSnks() override
FIFOWorkList< const CallICFGNode * > CSWorkList
virtual bool isSinkLikeFun(const SVFFunction *fun) override
Whether the function is a heap deallocator (free/release memory)
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 SVFFunction *fun)
virtual bool isSourceLikeFun(const SVFFunction *fun) override
Whether the function is a heap allocator/reallocator (allocate memory)
static const Option< bool > ValidateTests
void getCallees(const CallICFGNode *cs, FunctionSet &callees)
Get all callees for a callsite.
Set< const SVFFunction * > FunctionSet
const CallICFGNode * getCallICFGNode() const
virtual const SVFType * getType() const
NodeID getId() const
Get ID.
const SVFFunction * getParent() const
void addSaberBug(GenericBug::BugType bugType, const GenericBug::EventStack &eventStack)
bool isUncalledFunction() const
const SVFGNode * getDefSVFGNode(const PAGNode *pagNode) const
Given a pagNode, return its definition site.
CSToArgsListMap & getCallSiteArgsMap()
Get callsite argument list.
std::vector< const SVFVar * > SVFVarList
CSToRetMap & getCallSiteRets()
Get callsite return.
const SVFVar * getCallSiteRet(const RetICFGNode *cs) const
Get callsite return.
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
const std::string & getName() const
bool test(unsigned Idx) const
virtual bool isSomePathReachable()
Whether it is some path reachable from a source.
SVFIR * getPAG() const
Get SVFIR.
Set< const CallICFGNode * > CallSiteSet
PTACallGraph * getCallgraph() const
Get Callgraph.
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.
ActualParmVFGNode * getActualParmVFGNode(const PAGNode *aparm, const CallICFGNode *cs) const
StmtVFGNode * getStmtVFGNode(const PAGEdge *pagEdge) const
Get an VFGNode.
std::string sucMsg(const std::string &msg)
Returns successful message by converting a string into green string output.
bool isExtCall(const SVFFunction *fun)
std::string errMsg(const std::string &msg)
Print error message by converting a string into red string output.
std::ostream & errs()
Overwrite llvm::errs()
void writeWrnMsg(const std::string &msg)
Writes a message run through wrnMsg.
std::ostream & outs()
Overwrite llvm::outs()
llvm::IRBuilder IRBuilder