Construction uses static graphs and points-to results, not AE state.
32{
33
35 for (
auto it = svfg.
begin(); it != svfg.
end(); ++it)
36 {
37 const VFGNode* vfg = it->second;
39
40
41 if (location && location->
getFun())
42 {
43
44
45
46
48 {
50 {
51 const ICFGNode* caller = call->getSrcNode()->getICFGNode();
52 if (caller)
53 {
54 for (
NodeID obj : call->getPointsTo())
55 {
57 {
59 eventsByBase[base].insert(caller);
60 eventsByBase[base].insert(location);
61 addEdge(base, caller, location,
nullptr);
62 }
63 }
64 }
65 }
66 }
67
68
69
70 const ValVar* pointer = nullptr;
72 {
73 for (
NodeID obj : memory->getPointsTo())
74 {
76 {
78 eventsByBase[base].insert(location);
80 }
81 }
82 }
84 pointer = store->getLHSVar();
86 pointer = load->getRHSVar();
87
88
89
90
91 if (pointer)
92 {
94 {
96 {
98 eventsByBase[base].insert(location);
100 }
101 }
102 }
103 }
104 }
105
106
107
108
109 for (
auto it =
icfg.begin(); it !=
icfg.end(); ++it)
110 {
112 {
113 for (const VFGNode* target : ret->getVFGNodes())
114 {
115 for (const VFGEdge* edge : target->getInEdges())
116 {
118 {
119 const ICFGNode* source = output->getSrcNode()->getICFGNode();
120 if (source)
121 {
122 for (
NodeID obj : output->getPointsTo())
123 {
125 {
130 eventsByBase[base].insert(ret);
132 eventsByBase[base].insert(source);
133 addEdge(base, source, ret,
nullptr);
134 }
135 }
136 }
137 }
138 }
139 }
140 }
141 }
142
143
144
145
146
147 for (const auto& [base, events] : eventsByBase)
148 {
150 for (const ICFGNode* event : events)
151 sources.insert(
icfg.getFunEntryICFGNode(event->getFun()));
152
153
155 {
156 const ICFGNode* global =
icfg.getGlobalICFGNode();
158 {
159 const ICFGNode* entry = edge->getDstNode();
161 addEdge(base, global, entry,
nullptr);
162 }
163 }
164
165
166
167 std::vector<const ICFGNode*> pending(sources.begin(), sources.end());
168 for (size_t i = 0; i < pending.size(); ++i)
169 {
172 for (const ICFGNode* event : newSources)
173 {
174 if (sources.insert(event).second)
175 pending.push_back(event);
176 }
177 }
178 }
179
180}
NodeID getId() const
Get the memory object id.
iterator begin()
Iterators.
const GEdgeSetTy & getOutEdges() const
const GEdgeSetTy & getInEdges() const
virtual const FunObjVar * getFun() const
Return the function of this ICFGNode.
static bool isNullOrBlkObj(NodeID id)
Check a decoded NodeID, not an AE virtual memory address.
virtual const PointsTo & getPts(NodeID ptr)=0
Get points-to targets of a pointer. It needs to be implemented in child class.
const BaseObjVar * getBaseObject(NodeID id) const
NodeID getId() const
Get ID.
Node * getOrCreateBaseObjNode(NodeID baseObjId, const ICFGNode *location)
Map< const ICFGNode *, Set< NodeID > > returnedGroups
void connectFrom(NodeID base, const ICFGNode *source, const Set< const ICFGNode * > &events, Set< const ICFGNode * > &newSources)
Map< const ICFGNode *, Map< const FunObjVar *, Set< NodeID > > > returnedGroupsByCallee
void addEdge(NodeID base, const ICFGNode *source, const ICFGNode *target, const IntraCFGEdge *branch)
virtual const ICFGNode * getICFGNode() const
Return corresponding ICFG node.
LLVM_NODISCARD bool isa(const Y &Val)
LLVM_NODISCARD std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > dyn_cast(const Y &Val)
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
std::unordered_map< Key, Value, Hash, KeyEqual, Allocator > Map