Static Value-Flow Analysis
Loading...
Searching...
No Matches
DDAClient.h
Go to the documentation of this file.
1//===- DDAClient.h -- Clients of demand-driven analysis-------------//
2//
3// SVF: Static Value-Flow Analysis
4//
5// Copyright (C) <2013-> <Yulei Sui>
6//
7
8// This program is free software: you can redistribute it and/or modify
9// it under the terms of the GNU Affero General Public License as published by
10// the Free Software Foundation, either version 3 of the License, or
11// (at your option) any later version.
12
13// This program is distributed in the hope that it will be useful,
14// but WITHOUT ANY WARRANTY; without even the implied warranty of
15// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16// GNU Affero General Public License for more details.
17
18// You should have received a copy of the GNU Affero General Public License
19// along with this program. If not, see <http://www.gnu.org/licenses/>.
20//
21//===----------------------------------------------------------------------===//
22
23
24/*
25 * @file: DDAClient.h
26 * @author: yesen
27 * @date: 4 Feb 2015
28 *
29 * LICENSE
30 *
31 */
32
33
34#ifndef DDACLIENT_H_
35#define DDACLIENT_H_
36
37#include "SVFIR/SVFIR.h"
39#include "Graphs/SVFG.h"
40#include "SVFIR/SVFValue.h"
41
42namespace SVF
43{
44
49{
50public:
52
53 virtual ~DDAClient() {}
54
55 virtual inline void initialise(SVFModule*) {}
56
59 {
60 setPAG(p);
61 if (solveAll)
63 else
64 {
65 for (OrderedNodeSet::iterator it = userInput.begin(), eit = userInput.end(); it != eit; ++it)
67 }
68 return candidateQueries;
69 }
71 inline const OrderedNodeSet& getCandidateQueries() const
72 {
73 return candidateQueries;
74 }
75
77 virtual inline void handleStatement(const SVFGNode*, NodeID) {}
79 inline void setPAG(SVFIR* g)
80 {
81 pag = g;
82 }
85 {
86 curPtr = ptr;
87 }
90 {
91 userInput.insert(ptr);
92 solveAll = false;
93 }
95 inline SVFModule* getModule() const
96 {
97 return module;
98 }
99 virtual void answerQueries(PointerAnalysis* pta);
100
101 virtual inline void performStat(PointerAnalysis*) {}
102
103 virtual inline void collectWPANum(SVFModule*) {}
104protected:
106 {
108 candidateQueries.insert(id);
109 }
110
112 SVFModule* module;
115
116private:
118 bool solveAll;
119};
120
121
138
139
140
165
166} // End namespace SVF
167
168#endif /* DDACLIENT_H_ */
cJSON * p
Definition cJSON.cpp:2559
#define true
Definition cJSON.cpp:65
VTablePtrToCallSiteMap vtableToCallSiteMap
Definition DDAClient.h:160
OrderedMap< NodeID, const CallICFGNode * > VTablePtrToCallSiteMap
Definition DDAClient.h:159
virtual OrderedNodeSet & collectCandidateQueries(SVFIR *pag)
Only collect function pointers as query candidates.
PAGNodeSet loadSrcNodes
Definition DDAClient.h:161
OrderedSet< const PAGNode * > PAGNodeSet
Definition DDAClient.h:148
virtual void performStat(PointerAnalysis *pta)
PAGNodeSet storeDstNodes
Definition DDAClient.h:162
PAGNodeSet gepSrcNodes
Definition DDAClient.h:163
AliasDDAClient(SVFModule *module)
Definition DDAClient.h:150
virtual ~DDAClient()
Definition DDAClient.h:53
DDAClient(SVFModule *mod)
Definition DDAClient.h:51
SVFModule *NodeID curPtr
< LLVM module
Definition DDAClient.h:113
void setPAG(SVFIR *g)
Set SVFIR graph.
Definition DDAClient.h:79
OrderedNodeSet userInput
User input queries.
Definition DDAClient.h:117
virtual void answerQueries(PointerAnalysis *pta)
Definition DDAClient.cpp:46
void setQuery(NodeID ptr)
Set pointer to be queried by DDA analysis.
Definition DDAClient.h:89
void setCurrentQueryPtr(NodeID ptr)
Set the pointer being queried.
Definition DDAClient.h:84
virtual void initialise(SVFModule *)
Definition DDAClient.h:55
SVFIR * pag
SVFIR graph used by current DDA analysis.
Definition DDAClient.h:111
SVFModule * getModule() const
Get LLVM module.
Definition DDAClient.h:95
const OrderedNodeSet & getCandidateQueries() const
Get candidate queries.
Definition DDAClient.h:71
virtual void collectWPANum(SVFModule *)
Definition DDAClient.h:103
void addCandidate(NodeID id)
Definition DDAClient.h:105
OrderedNodeSet candidateQueries
store all candidate pointers to be queried
Definition DDAClient.h:114
bool solveAll
TRUE if all top level pointers are being queried.
Definition DDAClient.h:118
virtual OrderedNodeSet & collectCandidateQueries(SVFIR *p)
Collect candidate pointers for query.
Definition DDAClient.h:58
virtual void handleStatement(const SVFGNode *, NodeID)
Call back used by DDAVFSolver.
Definition DDAClient.h:77
virtual void performStat(PointerAnalysis *)
Definition DDAClient.h:101
VTablePtrToCallSiteMap vtableToCallSiteMap
Definition DDAClient.h:129
FunptrDDAClient(SVFModule *module)
Definition DDAClient.h:131
virtual OrderedNodeSet & collectCandidateQueries(SVFIR *p)
Only collect function pointers as query candidates.
Definition DDAClient.cpp:78
virtual void performStat(PointerAnalysis *pta)
OrderedMap< NodeID, const CallICFGNode * > VTablePtrToCallSiteMap
Definition DDAClient.h:128
NodeType * getGNode(NodeID id) const
Get a node.
bool isValidTopLevelPtr(const SVFVar *node)
Definition SVFIR.cpp:685
OrderedNodeSet & getAllValidPtrs()
Return valid pointers.
Definition SVFIR.h:140
for isBitcode
Definition BasicTypes.h:68
OrderedSet< NodeID > OrderedNodeSet
u32_t NodeID
Definition GeneralType.h:55
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74