Static Value-Flow Analysis
Loading...
Searching...
No Matches
SVF::LeakChecker Class Reference

#include <LeakChecker.h>

Inheritance diagram for SVF::LeakChecker:
SVF::SrcSnkDDA SVF::GraphReachSolver< SVFG *, CxtDPItem > SVF::DoubleFreeChecker SVF::FileChecker

Public Types

enum  LEAK_TYPE { NEVER_FREE_LEAK , CONTEXT_LEAK , PATH_LEAK , GLOBAL_LEAK }
typedef Map< const SVFGNode *, const CallICFGNode * > SVFGNodeToCSIDMap
typedef FIFOWorkList< const CallICFGNode * > CSWorkList
typedef ProgSlice::VFWorkList WorkList
typedef NodeBS SVFGNodeBS
Public Types inherited from SVF::SrcSnkDDA
typedef ProgSlice::SVFGNodeSet SVFGNodeSet
typedef Map< const SVFGNode *, ProgSlice * > SVFGNodeToSliceMap
typedef SVFGNodeSet::const_iterator SVFGNodeSetIter
typedef CxtDPItem DPIm
typedef Set< DPIm > DPImSet
 dpitem set
typedef Map< const SVFGNode *, DPImSet > SVFGNodeToDPItemsMap
 map a SVFGNode to its visited dpitems
typedef Set< const CallICFGNode * > CallSiteSet
typedef NodeBS SVFGNodeBS
typedef ProgSlice::VFWorkList WorkList
Public Types inherited from SVF::GraphReachSolver< SVFG *, CxtDPItem >
typedef SVF::GenericGraphTraits< SVFG * > GTraits
 Define the GTraits and node iterator.
typedef GTraits::NodeType GNODE
typedef GTraits::EdgeType GEDGE
typedef GTraits::nodes_iterator node_iterator
typedef GTraits::ChildIteratorType child_iterator
typedef SVF::GenericGraphTraits< SVF::Inverse< GNODE * > > InvGTraits
 Define inverse GTraits and note iterator.
typedef InvGTraits::ChildIteratorType inv_child_iterator
typedef FIFOWorkList< CxtDPItem > WorkList
 Define worklist.

Public Member Functions

 LeakChecker ()
 Constructor.
virtual ~LeakChecker ()
 Destructor.
virtual bool runOnModule (SVFIR *pag)
 We start from here.
virtual void initSrcs () override
 Initialize sources and sinks.
virtual void initSnks () override
virtual bool isSourceLikeFun (const FunObjVar *fun) override
 Whether the function is a heap allocator/reallocator (allocate memory).
virtual bool isSinkLikeFun (const FunObjVar *fun) override
 Whether the function is a heap deallocator (free/release memory).
Public Member Functions inherited from SVF::SrcSnkDDA
 SrcSnkDDA ()
 Bug Reporter.
 ~SrcSnkDDA () override
 Destructor.
virtual void analyze ()
 Start analysis here.
virtual void initialize ()
 Initialize analysis.
virtual void finalize ()
 Finalize analysis.
SVFIR * getPAG () const
 Get SVFIR.
const SVFG * getSVFG () const
 Get SVFG.
CallGraph * getCallgraph () const
 Get Callgraph.
bool isGlobalSVFGNode (const SVFGNode *node) const
 Whether this svfg node may access global variable.
virtual void setCurSlice (const SVFGNode *src)
 Slice operations.
ProgSlice * getCurSlice () const
void addSinkToCurSlice (const SVFGNode *node)
bool isInCurForwardSlice (const SVFGNode *node)
bool isInCurBackwardSlice (const SVFGNode *node)
void addToCurForwardSlice (const SVFGNode *node)
void addToCurBackwardSlice (const SVFGNode *node)
bool isInAWrapper (const SVFGNode *src, CallSiteSet &csIdSet)
 Identify allocation wrappers.
const SVFGNodeSet & getSources () const
 Get sources/sinks.
SVFGNodeSetIter sourcesBegin () const
SVFGNodeSetIter sourcesEnd () const
void addToSources (const SVFGNode *node)
const SVFGNodeSet & getSinks () const
SVFGNodeSetIter sinksBegin () const
SVFGNodeSetIter sinksEnd () const
void addToSinks (const SVFGNode *node)
SaberCondAllocator * getSaberCondAllocator () const
 Get saber condition allocator.
const SVFBugReport & getBugReport () const
bool isSource (const SVFGNode *node) const
bool isSink (const SVFGNode *node) const

Protected Member Functions

virtual void reportBug (ProgSlice *slice) override
 Report leaks.
void testsValidation (const ProgSlice *slice)
 Validate test cases for regression test purpose.
void validateSuccessTests (const SVFGNode *source, const FunObjVar *fun)
void validateExpectedFailureTests (const SVFGNode *source, const FunObjVar *fun)
void addSrcToCSID (const SVFGNode *src, const CallICFGNode *cs)
 Record a source to its callsite.
const CallICFGNode * getSrcCSID (const SVFGNode *src)
Protected Member Functions inherited from SVF::SrcSnkDDA
void FWProcessCurNode (const DPIm &item) override
 Forward traverse.
void BWProcessCurNode (const DPIm &item) override
 Backward traverse.
void FWProcessOutgoingEdge (const DPIm &item, SVFGEdge *edge) override
 Propagate information forward by matching context.
void BWProcessIncomingEdge (const DPIm &item, SVFGEdge *edge) override
 Propagate information backward without matching context, as forward analysis already did it.
bool forwardVisited (const SVFGNode *node, const DPIm &item)
 Whether has been visited or not, in order to avoid recursion on SVFG.
void addForwardVisited (const SVFGNode *node, const DPIm &item)
bool backwardVisited (const SVFGNode *node)
void addBackwardVisited (const SVFGNode *node)
void clearVisitedMap ()
virtual bool isAllPathReachable ()
 Whether it is all path reachable from a source.
virtual bool isSomePathReachable ()
 Whether it is some path reachable from a source.
void dumpSlices ()
 Dump SVFG with annotated slice information.
void annotateSlice (ProgSlice *slice)
void printZ3Stat ()
Protected Member Functions inherited from SVF::GraphReachSolver< SVFG *, CxtDPItem >
 GraphReachSolver ()
 Constructor.
virtual ~GraphReachSolver ()
 Destructor.
const SVFG * graph () const
 Get/Set graph methods.
void setGraph (SVFG *g)
GNODE * getNode (NodeID id) const
virtual NodeID getNodeIDFromItem (const CxtDPItem &item) const
virtual void forwardTraverse (CxtDPItem &it)
 CFL forward traverse solve.
virtual void backwardTraverse (CxtDPItem &it)
 CFL forward traverse solve.
virtual void FWProcessOutgoingEdge (const CxtDPItem &item, GEDGE *edge)
 Propagation for the solving, to be implemented in the child class.
virtual void BWProcessIncomingEdge (const CxtDPItem &item, GEDGE *edge)
CxtDPItem popFromWorklist ()
 Worklist operations.
bool pushIntoWorklist (CxtDPItem &item)
bool isWorklistEmpty ()
bool isInWorklist (CxtDPItem &item)

Private Attributes

SVFGNodeToCSIDMap srcToCSIDMap

Additional Inherited Members

Protected Attributes inherited from SVF::SrcSnkDDA
SaberSVFGBuilder memSSA
SVFG * svfg
CallGraph * callgraph
SVFBugReport report

Detailed Description

Static Memory Leak Detector

Definition at line 42 of file LeakChecker.h.

Member Typedef Documentation

◆ CSWorkList

Definition at line 47 of file LeakChecker.h.

◆ SVFGNodeBS

Definition at line 49 of file LeakChecker.h.

◆ SVFGNodeToCSIDMap

Definition at line 46 of file LeakChecker.h.

◆ WorkList

Member Enumeration Documentation

◆ LEAK_TYPE

Enumerator
NEVER_FREE_LEAK 
CONTEXT_LEAK 
PATH_LEAK 
GLOBAL_LEAK 

Definition at line 50 of file LeakChecker.h.

Constructor & Destructor Documentation

◆ LeakChecker()

SVF::LeakChecker::LeakChecker ( )
inline

Constructor.

Definition at line 59 of file LeakChecker.h.

60 {
61 }

◆ ~LeakChecker()

virtual SVF::LeakChecker::~LeakChecker ( )
inlinevirtual

Destructor.

Definition at line 63 of file LeakChecker.h.

64 {
65 }

Member Function Documentation

◆ addSrcToCSID()

void SVF::LeakChecker::addSrcToCSID ( const SVFGNode * src,
const CallICFGNode * cs )
inlineprotected

Record a source to its callsite.

Definition at line 105 of file LeakChecker.h.

106 {
107 srcToCSIDMap[src] = cs;
108 }
SVFGNodeToCSIDMap srcToCSIDMap

◆ getSrcCSID()

const CallICFGNode * SVF::LeakChecker::getSrcCSID ( const SVFGNode * src)
inlineprotected

Definition at line 109 of file LeakChecker.h.

110 {
111 SVFGNodeToCSIDMap::iterator it =srcToCSIDMap.find(src);
112 assert(it!=srcToCSIDMap.end() && "source node not at a callsite??");
113 return it->second;
114 }

◆ initSnks()

void LeakChecker::initSnks ( )
overridevirtual

Initialize sinks

we only choose pointer parameters among all the actual parameters

Implements SVF::SrcSnkDDA.

Definition at line 105 of file LeakChecker.cpp.

106{
107
108 SVFIR* pag = getPAG();
109
110 for(SVFIR::CSToArgsListMap::iterator it = pag->getCallSiteArgsMap().begin(),
111 eit = pag->getCallSiteArgsMap().end(); it!=eit; ++it)
112 {
113
115 getCallgraph()->getCallees(it->first,callees);
116 for(CallGraph::FunctionSet::const_iterator cit = callees.begin(), ecit = callees.end(); cit!=ecit; cit++)
117 {
118 const FunObjVar* fun = *cit;
119 if (isSinkLikeFun(fun))
120 {
121 SVFIR::ValVarList &arglist = it->second;
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)
126 {
127 const SVFVar *svfVar = *ait;
128 if (svfVar->isPointer())
129 {
130 const SVFGNode *snk = getSVFG()->getActualParmVFGNode(svfVar, it->first);
131 addToSinks(snk);
132
133 // For any multi-level pointer e.g., XFree(void** svfVar) that passed into a ExtAPI::EFT_FREE_MULTILEVEL function (e.g., XFree),
134 // we will add the DstNode of a load edge, i.e., dummy = *svfVar
135 SVFStmt::SVFStmtSetTy& loads = const_cast<SVFVar*>(svfVar)->getOutgoingEdges(SVFStmt::Load);
136 for(const SVFStmt* ld : loads)
137 {
138 if(SVFUtil::isa<DummyValVar>(ld->getDstNode()))
139 addToSinks(getSVFG()->getStmtVFGNode(ld));
140 }
141 }
142 }
143 }
144 }
145 }
146}
void getCallees(const CallICFGNode *cs, FunctionSet &callees)
Get all callees for a callsite.
Definition CallGraph.h:426
Set< const FunObjVar * > FunctionSet
Definition CallGraph.h:247
virtual bool isSinkLikeFun(const FunObjVar *fun) override
Whether the function is a heap deallocator (free/release memory).
Definition LeakChecker.h:86
CSToArgsListMap & getCallSiteArgsMap()
Get callsite argument list.
Definition SVFIR.h:391
std::vector< const ValVar * > ValVarList
Definition SVFIR.h:60
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
virtual bool isPointer() const
Check if this variable represents a pointer.
CallGraph * getCallgraph() const
Get Callgraph.
Definition SrcSnkDDA.h:132
SVFIR * getPAG() const
Get SVFIR.
Definition SrcSnkDDA.h:120
void addToSinks(const SVFGNode *node)
Definition SrcSnkDDA.h:234
const SVFG * getSVFG() const
Get SVFG.
Definition SrcSnkDDA.h:126
ActualParmVFGNode * getActualParmVFGNode(const SVFVar *aparm, const CallICFGNode *cs) const
Definition VFG.h:297
LLVM_NODISCARD bool isa(const Y &Val)
Definition Casting.h:241
VFGNode SVFGNode
Definition SVFG.h:43

◆ initSrcs()

void LeakChecker::initSrcs ( )
overridevirtual

Initialize sources and sinks.

Initialize sources and sinks

Initialize sources

if this callsite return reside in a dead function then we do not care about its leaks for example instruction int* p = malloc(size) is in a dead function, then program won't allocate this memory for example a customized malloc int p = malloc() returns an integer value, then program treat it as a system malloc

Implements SVF::SrcSnkDDA.

Definition at line 40 of file LeakChecker.cpp.

41{
42
43 SVFIR* pag = getPAG();
44 for(SVFIR::CSToRetMap::iterator it = pag->getCallSiteRets().begin(),
45 eit = pag->getCallSiteRets().end(); it!=eit; ++it)
46 {
47 const RetICFGNode* cs = it->first;
51 if(cs->getFun()->isUncalledFunction() || !cs->getType()->isPointerTy())
52 continue;
53
55 getCallgraph()->getCallees(cs->getCallICFGNode(),callees);
56 for(CallGraph::FunctionSet::const_iterator cit = callees.begin(), ecit = callees.end(); cit!=ecit; cit++)
57 {
58 const FunObjVar* fun = *cit;
59 if (isSourceLikeFun(fun))
60 {
62 SVFGNodeBS visited;
63 worklist.push(it->first->getCallICFGNode());
64 while (!worklist.empty())
65 {
66 const CallICFGNode* cs = worklist.pop();
67 const RetICFGNode* retBlockNode = cs->getRetICFGNode();
68 const ValVar* svfVar = pag->getCallSiteRet(retBlockNode);
69 const SVFGNode* node = getSVFG()->getDefSVFGNode(svfVar);
70 if (visited.test(node->getId()) == 0)
71 visited.set(node->getId());
72 else
73 continue;
74
75 CallSiteSet csSet;
76 // if this node is in an allocation wrapper, find all its call nodes
77 if (isInAWrapper(node, csSet))
78 {
79 for (CallSiteSet::iterator it = csSet.begin(), eit =
80 csSet.end(); it != eit; ++it)
81 {
82 worklist.push(*it);
83 }
84 }
85 // otherwise, this is the source we are interested
86 else
87 {
88 // exclude sources in dead functions or sources in functions that have summary
89 if (!cs->getFun()->isUncalledFunction() && !isExtCall(cs->getBB()->getParent()))
90 {
91 addToSources(node);
92 addSrcToCSID(node, cs);
93 }
94 }
95 }
96 }
97 }
98 }
99
100}
const RetICFGNode * getRetICFGNode() const
Return callsite.
Definition ICFGNode.h:440
bool isUncalledFunction() const
virtual const FunObjVar * getFun() const
Return the function of this ICFGNode.
Definition ICFGNode.h:75
virtual const SVFBasicBlock * getBB() const
Return the basic block of this ICFGNode.
Definition ICFGNode.h:81
void addSrcToCSID(const SVFGNode *src, const CallICFGNode *cs)
Record a source to its callsite.
FIFOWorkList< const CallICFGNode * > CSWorkList
Definition LeakChecker.h:47
virtual bool isSourceLikeFun(const FunObjVar *fun) override
Whether the function is a heap allocator/reallocator (allocate memory).
Definition LeakChecker.h:81
const CallICFGNode * getCallICFGNode() const
Definition ICFGNode.h:620
const FunObjVar * getParent() const
const SVFGNode * getDefSVFGNode(const ValVar *valVar) const
Given a valVar, return its definition site.
Definition SVFG.h:171
const ValVar * getCallSiteRet(const RetICFGNode *cs) const
Get callsite return.
Definition SVFIR.h:408
CSToRetMap & getCallSiteRets()
Get callsite return.
Definition SVFIR.h:403
bool isPointerTy() const
Definition SVFType.h:292
NodeID getId() const
Get ID.
Definition SVFValue.h:158
virtual const SVFType * getType() const
Definition SVFValue.h:169
Set< const CallICFGNode * > CallSiteSet
Definition SrcSnkDDA.h:64
void addToSources(const SVFGNode *node)
Definition SrcSnkDDA.h:218
bool isInAWrapper(const SVFGNode *src, CallSiteSet &csIdSet)
Identify allocation wrappers.
bool isExtCall(const FunObjVar *fun)
Definition SVFUtil.cpp:526

◆ isSinkLikeFun()

virtual bool SVF::LeakChecker::isSinkLikeFun ( const FunObjVar * fun)
inlineoverridevirtual

Whether the function is a heap deallocator (free/release memory).

Reimplemented from SVF::SrcSnkDDA.

Reimplemented in SVF::FileChecker.

Definition at line 86 of file LeakChecker.h.

87 {
89 }
bool isMemDealloc(const FunObjVar *fun) const
Return true if this call is a memory deallocation.
static SaberCheckerAPI * getCheckerAPI()
Return a static reference.

◆ isSourceLikeFun()

virtual bool SVF::LeakChecker::isSourceLikeFun ( const FunObjVar * fun)
inlineoverridevirtual

Whether the function is a heap allocator/reallocator (allocate memory).

Reimplemented from SVF::SrcSnkDDA.

Reimplemented in SVF::FileChecker.

Definition at line 81 of file LeakChecker.h.

82 {
84 }
bool isMemAlloc(const FunObjVar *fun) const
Return true if this call is a memory allocation.

◆ reportBug()

void LeakChecker::reportBug ( ProgSlice * slice)
overrideprotectedvirtual

Report leaks.

Implements SVF::SrcSnkDDA.

Reimplemented in SVF::DoubleFreeChecker, and SVF::FileChecker.

Definition at line 148 of file LeakChecker.cpp.

149{
150
151 if(isAllPathReachable() == false && isSomePathReachable() == false)
152 {
153 // full leakage
154 GenericBug::EventStack eventStack =
155 {
156 SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource()))
157 };
158 report.addSaberBug(GenericBug::NEVERFREE, eventStack);
159 }
160 else if (isAllPathReachable() == false && isSomePathReachable() == true)
161 {
162 // partial leakage
163 GenericBug::EventStack eventStack;
164 slice->evalFinalCond2Event(eventStack);
165 eventStack.push_back(
166 SVFBugEvent(SVFBugEvent::SourceInst, getSrcCSID(slice->getSource())));
167 report.addSaberBug(GenericBug::PARTIALLEAK, eventStack);
168 }
169
171 testsValidation(slice);
172}
std::vector< SVFBugEvent > EventStack
void testsValidation(const ProgSlice *slice)
Validate test cases for regression test purpose.
const CallICFGNode * getSrcCSID(const SVFGNode *src)
static const Option< bool > ValidateTests
Definition Options.h:164
void evalFinalCond2Event(GenericBug::EventStack &eventStack) const
Add final condition to eventStack.
const SVFGNode * getSource() const
root and sink operations
Definition ProgSlice.h:122
virtual bool isSomePathReachable()
Whether it is some path reachable from a source.
Definition SrcSnkDDA.h:312
virtual bool isAllPathReachable()
Whether it is all path reachable from a source.
Definition SrcSnkDDA.h:307
SVFBugReport report
Definition SrcSnkDDA.h:80

◆ runOnModule()

virtual bool SVF::LeakChecker::runOnModule ( SVFIR * pag)
inlinevirtual

We start from here.

start analysis

Reimplemented in SVF::DoubleFreeChecker, and SVF::FileChecker.

Definition at line 68 of file LeakChecker.h.

69 {
71 analyze();
72 return false;
73 }
virtual void analyze()
Start analysis here.
Definition SrcSnkDDA.cpp:61

◆ testsValidation()

void LeakChecker::testsValidation ( const ProgSlice * slice)
protected

Validate test cases for regression test purpose.

Validate test cases for regression test purpose

Definition at line 178 of file LeakChecker.cpp.

179{
180 const SVFGNode* source = slice->getSource();
181 const CallICFGNode* cs = getSrcCSID(source);
182 const FunObjVar* fun = cs->getCalledFunction();
183 if(fun==nullptr)
184 return;
185
186 validateSuccessTests(source,fun);
188}
const FunObjVar * getCalledFunction() const
Definition ICFGNode.h:501
void validateSuccessTests(const SVFGNode *source, const FunObjVar *fun)
void validateExpectedFailureTests(const SVFGNode *source, const FunObjVar *fun)

◆ validateExpectedFailureTests()

void LeakChecker::validateExpectedFailureTests ( const SVFGNode * source,
const FunObjVar * fun )
protected

Definition at line 261 of file LeakChecker.cpp.

262{
263
264 const CallICFGNode* cs = getSrcCSID(source);
265
266 bool expectedFailure = false;
267
268 if(fun->getName() == "NFRLEAKFP")
269 {
270 if(isAllPathReachable() == false && isSomePathReachable() == false)
271 expectedFailure = true;
272 }
273 else if(fun->getName() == "PLKLEAKFP")
274 {
275 if(isAllPathReachable() == false && isSomePathReachable() == true)
276 expectedFailure = true;
277 }
278 else if(fun->getName() == "LEAKFN")
279 {
280 if(isAllPathReachable() == true && isSomePathReachable() == true)
281 expectedFailure = true;
282 }
283 else if(fun->getName() == "SAFEMALLOC" || fun->getName() == "NFRMALLOC"
284 || fun->getName() == "PLKMALLOC" || fun->getName() == "CLKLEAKFN")
285 {
286 return;
287 }
288 else
289 {
290 writeWrnMsg("\t can not validate, check function not found, please put it at the right place!!");
291 return;
292 }
293
294 std::string funName = source->getFun()->getName();
295
296 if (expectedFailure)
297 {
298 if (!(getSrcCSID(source))->hasLLVMValue())
299 {
300 outs() << sucMsg("\t EXPECTED-FAILURE :") << funName <<"\n";
301 return;
302 }
303 outs() << sucMsg("\t EXPECTED-FAILURE :") << funName << " check <src id:" << source->getId()
304 << ", cs id:" << (getSrcCSID(source))->valueOnlyToString() << "> at ("
305 << cs->getSourceLoc() << ")\n";
306 }
307 else
308 {
309 if (!(getSrcCSID(source))->hasLLVMValue())
310 {
311 SVFUtil::errs() << errMsg("\t UNEXPECTED FAILURE :") << funName <<"\n";
312 assert(false && "test case failed!");
313 return;
314 }
315 SVFUtil::errs() << errMsg("\t UNEXPECTED FAILURE :") << funName
316 << " check <src id:" << source->getId()
317 << ", cs id:" << (getSrcCSID(source))->valueOnlyToString() << "> at ("
318 << cs->getSourceLoc() << ")\n";
319 assert(false && "test case failed!");
320 }
321}
const std::string getSourceLoc() const override
Definition ICFGNode.h:571
virtual const std::string & getName() const
Definition SVFValue.h:184
virtual const FunObjVar * getFun() const
Get the function of this SVFGNode.
Definition VFGNode.h:79
std::string sucMsg(const std::string &msg)
Returns successful message by converting a string into green string output.
Definition SVFUtil.cpp:75
std::string errMsg(const std::string &msg)
Print error message by converting a string into red string output.
Definition SVFUtil.cpp:98
std::ostream & errs()
Overwrite llvm::errs().
Definition SVFUtil.h:64
void writeWrnMsg(const std::string &msg)
Writes a message run through wrnMsg.
Definition SVFUtil.cpp:88
std::ostream & outs()
Overwrite llvm::outs().
Definition SVFUtil.h:58

◆ validateSuccessTests()

void LeakChecker::validateSuccessTests ( const SVFGNode * source,
const FunObjVar * fun )
protected

Definition at line 191 of file LeakChecker.cpp.

192{
193
194 const CallICFGNode* cs = getSrcCSID(source);
195
196 bool success = false;
197
198 if(fun->getName() == "SAFEMALLOC")
199 {
200 if(isAllPathReachable() == true && isSomePathReachable() == true)
201 success = true;
202 }
203 else if(fun->getName() == "NFRMALLOC")
204 {
205 if(isAllPathReachable() == false && isSomePathReachable() == false)
206 success = true;
207 }
208 else if(fun->getName() == "PLKMALLOC")
209 {
210 if(isAllPathReachable() == false && isSomePathReachable() == true)
211 success = true;
212 }
213 else if(fun->getName() == "CLKMALLOC")
214 {
215 if(isAllPathReachable() == false && isSomePathReachable() == false)
216 success = true;
217 }
218 else if(fun->getName() == "NFRLEAKFP" || fun->getName() == "PLKLEAKFP"
219 || fun->getName() == "LEAKFN")
220 {
221 return;
222 }
223 else
224 {
225 writeWrnMsg("\t can not validate, check function not found, please put it at the right place!!");
226 return;
227 }
228
229 std::string funName = source->getFun()->getName();
230
231 if (success)
232 {
233 if ((getSrcCSID(source))->hasLLVMValue())
234 {
235 outs() << sucMsg("\t SUCCESS :") << funName << " check <src id:" << source->getId()
236 << ", cs id:" << (getSrcCSID(source))->valueOnlyToString() << "> at ("
237 << cs->getSourceLoc() << ")\n";
238 }
239 else
240 {
241 outs() << sucMsg("\t SUCCESS :") << funName<<"\n";
242 }
243 }
244 else
245 {
246 if ((getSrcCSID(source))->hasLLVMValue())
247 {
248 SVFUtil::errs() << errMsg("\t FAILURE :") << funName << " check <src id:" << source->getId()
249 << ", cs id:" << (getSrcCSID(source))->valueOnlyToString() << "> at ("
250 << cs->getSourceLoc() << ")\n";
251 assert(false && "test case failed!");
252 }
253 else
254 {
255 SVFUtil::errs() << errMsg("\t FAILURE :") << funName << "\n";
256 assert(false && "test case failed!");
257 }
258 }
259}

Member Data Documentation

◆ srcToCSIDMap

SVFGNodeToCSIDMap SVF::LeakChecker::srcToCSIDMap
private

Definition at line 117 of file LeakChecker.h.


The documentation for this class was generated from the following files: