Static Value-Flow Analysis
SVFVariables.h
Go to the documentation of this file.
1 //===- SVFSymbols.h -- SVF Variables------------------------//
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  * SVFVariables.h
25  *
26  * Created on: Nov 11, 2013
27  * Author: Yulei Sui
28  */
29 
30 #ifndef INCLUDE_SVFIR_SVFVARIABLE_H_
31 #define INCLUDE_SVFIR_SVFVARIABLE_H_
32 
33 #include "Graphs/GenericGraph.h"
34 #include "SVFIR/SymbolTableInfo.h"
35 #include "SVFIR/SVFStatements.h"
36 
37 namespace SVF
38 {
39 
40 class SVFVar;
41 /*
42  * SVFIR program variables (PAGNodes)
43  */
45 class SVFVar : public GenericPAGNodeTy
46 {
47  friend class SVFIRWriter;
48  friend class SVFIRReader;
49  friend class IRGraph;
50  friend class SVFIR;
51  friend class VFG;
52 
53 public:
63  typedef GNodeK PNODEK;
64  typedef s64_t GEdgeKind;
65 
66 protected:
67  const SVFValue* value;
70  bool isPtr;
71 
74 
75 public:
77  SVFVar(const SVFValue* val, NodeID i, PNODEK k);
79  virtual ~SVFVar() {}
80 
82 
83  inline const SVFValue* getValue() const
84  {
85  assert(this->getNodeKind() != DummyValNode &&
86  this->getNodeKind() != DummyObjNode &&
87  "dummy node do not have value!");
89  "blackhole and constant obj do not have value");
90  assert(value &&
91  "value is null (GepObjNode whose basenode is a DummyObj?)");
92  return value;
93  }
94 
96  inline virtual const SVFType* getType() const
97  {
98  return value ? value->getType() : nullptr;
99  }
100 
101  inline bool hasValue() const
102  {
103  return value != nullptr;
104  }
106  virtual inline bool isPointer() const
107  {
108  return isPtr;
109  }
113 
115  bool isIsolatedNode() const;
116 
118  // TODO: (Optimization) Should it return const reference instead of value?
119  virtual const std::string getValueName() const = 0;
120 
122  virtual inline const SVFFunction* getFunction() const
123  {
124  if (value)
125  {
126  if (auto inst = SVFUtil::dyn_cast<SVFInstruction>(value))
127  return inst->getParent()->getParent();
128  else if (auto arg = SVFUtil::dyn_cast<SVFArgument>(value))
129  return arg->getParent();
130  else if (auto fun = SVFUtil::dyn_cast<SVFFunction>(value))
131  return fun;
132  }
133  return nullptr;
134  }
135 
138  {
139  return InEdgeKindToSetMap[kind];
140  }
143  {
144  return OutEdgeKindToSetMap[kind];
145  }
147  inline bool hasIncomingEdges(SVFStmt::PEDGEK kind) const
148  {
149  SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
150  if (it != InEdgeKindToSetMap.end())
151  return (!it->second.empty());
152  else
153  return false;
154  }
156  inline bool hasOutgoingEdges(SVFStmt::PEDGEK kind) const
157  {
158  SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
159  if (it != OutEdgeKindToSetMap.end())
160  return (!it->second.empty());
161  else
162  return false;
163  }
164 
166  inline SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesBegin(SVFStmt::PEDGEK kind) const
167  {
168  SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
169  assert(it!=InEdgeKindToSetMap.end() && "The node does not have such kind of edge");
170  return it->second.begin();
171  }
172 
174  inline SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesEnd(SVFStmt::PEDGEK kind) const
175  {
176  SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
177  assert(it!=InEdgeKindToSetMap.end() && "The node does not have such kind of edge");
178  return it->second.end();
179  }
180 
182  inline SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesBegin(SVFStmt::PEDGEK kind) const
183  {
184  SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
185  assert(it!=OutEdgeKindToSetMap.end() && "The node does not have such kind of edge");
186  return it->second.begin();
187  }
188 
190  inline SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesEnd(SVFStmt::PEDGEK kind) const
191  {
192  SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
193  assert(it!=OutEdgeKindToSetMap.end() && "The node does not have such kind of edge");
194  return it->second.end();
195  }
197 
198  static inline bool classof(const SVFVar *)
199  {
200  return true;
201  }
202 
203  static inline bool classof(const GenericPAGNodeTy * node)
204  {
205  return isSVFVarKind(node->getNodeKind());
206  }
207 
208  static inline bool classof(const SVFBaseNode* node)
209  {
210  return isSVFVarKind(node->getNodeKind());
211  }
212 
213 private:
215 
216  inline void addInEdge(SVFStmt* inEdge)
217  {
218  GEdgeKind kind = inEdge->getEdgeKind();
219  InEdgeKindToSetMap[kind].insert(inEdge);
220  addIncomingEdge(inEdge);
221  }
222 
223  inline void addOutEdge(SVFStmt* outEdge)
224  {
225  GEdgeKind kind = outEdge->getEdgeKind();
226  OutEdgeKindToSetMap[kind].insert(outEdge);
227  addOutgoingEdge(outEdge);
228  }
230  inline bool hasIncomingVariantGepEdge() const
231  {
232  SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(SVFStmt::Gep);
233  if (it != InEdgeKindToSetMap.end())
234  {
235  for(auto gep : it->second)
236  {
237  if(SVFUtil::cast<GepStmt>(gep)->isVariantFieldGep())
238  return true;
239  }
240  }
241  return false;
242  }
243 
244 public:
245  virtual const std::string toString() const;
246 
248  void dump() const;
249 
251 
253  friend OutStream& operator<< (OutStream &o, const SVFVar &node)
254  {
255  o << node.toString();
256  return o;
257  }
259 };
260 
261 
262 
263 /*
264  * Value (Pointer) variable
265  */
266 class ValVar: public SVFVar
267 {
268  friend class SVFIRWriter;
269  friend class SVFIRReader;
270 
271 private:
272  const SVFBaseNode* gNode; // constant, gepValvar, retPN, dummy could be null
273 protected:
275  ValVar(NodeID i, PNODEK ty = ValNode) : SVFVar(i, ty), gNode(nullptr) {}
276 
277 public:
279 
280  static inline bool classof(const ValVar*)
281  {
282  return true;
283  }
284  static inline bool classof(const SVFVar* node)
285  {
286  return isValVarKinds(node->getNodeKind());
287  }
288  static inline bool classof(const GenericPAGNodeTy* node)
289  {
290  return isValVarKinds(node->getNodeKind());
291  }
292  static inline bool classof(const SVFBaseNode* node)
293  {
294  return isValVarKinds(node->getNodeKind());
295  }
297 
299  ValVar(const SVFValue* val, NodeID i, PNODEK ty = ValNode, const SVFBaseNode* node = nullptr)
300  : SVFVar(val, i, ty), gNode(node)
301  {
302  }
304  inline const std::string getValueName() const
305  {
306  if (value)
307  return value->getName();
308  return "";
309  }
310 
311  const SVFBaseNode* getGNode() const
312  {
313  return gNode;
314  }
315 
316  virtual const std::string toString() const;
317 };
318 
319 /*
320  * Memory Object variable
321  */
322 class ObjVar: public SVFVar
323 {
324  friend class SVFIRWriter;
325  friend class SVFIRReader;
326 
327 protected:
328  const MemObj* mem;
330  ObjVar(NodeID i, PNODEK ty = ObjNode) : SVFVar(i, ty), mem{} {}
332  ObjVar(const SVFValue* val, NodeID i, const MemObj* m, PNODEK ty = ObjNode) :
333  SVFVar(val, i, ty), mem(m)
334  {
335  }
336 public:
338 
339  static inline bool classof(const ObjVar*)
340  {
341  return true;
342  }
343  static inline bool classof(const SVFVar* node)
344  {
345  return isObjVarKinds(node->getNodeKind());
346  }
347  static inline bool classof(const GenericPAGNodeTy* node)
348  {
349  return isObjVarKinds(node->getNodeKind());
350  }
351  static inline bool classof(const SVFBaseNode* node)
352  {
353  return isObjVarKinds(node->getNodeKind());
354  }
356 
358  const MemObj* getMemObj() const
359  {
360  return mem;
361  }
362 
364  virtual const std::string getValueName() const
365  {
366  if (value)
367  return value->getName();
368  return "";
369  }
371  inline virtual const SVFType* getType() const
372  {
373  return mem->getType();
374  }
375 
376  virtual const std::string toString() const;
377 };
378 
379 
380 /*
381  * Gep Value (Pointer) variable, this variable can be dynamic generated for field sensitive analysis
382  * e.g. memcpy, temp gep value variable needs to be created
383  * Each Gep Value variable is connected to base value variable via gep edge
384  */
385 class GepValVar: public ValVar
386 {
387  friend class SVFIRWriter;
388  friend class SVFIRReader;
389 
390 private:
391  AccessPath ap; // AccessPath
393 
396 
397 public:
399 
400  static inline bool classof(const GepValVar *)
401  {
402  return true;
403  }
404  static inline bool classof(const ValVar * node)
405  {
406  return node->getNodeKind() == SVFVar::GepValNode;
407  }
408  static inline bool classof(const SVFVar *node)
409  {
410  return node->getNodeKind() == SVFVar::GepValNode;
411  }
412  static inline bool classof(const GenericPAGNodeTy *node)
413  {
414  return node->getNodeKind() == SVFVar::GepValNode;
415  }
417 
419  GepValVar(const SVFValue* val, NodeID i, const AccessPath& ap,
420  const SVFType* ty)
421  : ValVar(val, i, GepValNode), ap(ap), gepValType(ty)
422  {
423  }
424 
427  {
428  return ap.getConstantStructFldIdx();
429  }
430 
432  inline const std::string getValueName() const
433  {
434  if (value)
435  return value->getName() + "_" +
436  std::to_string(getConstantFieldIdx());
437  return "offset_" + std::to_string(getConstantFieldIdx());
438  }
439 
440  inline const SVFType* getType() const
441  {
442  return gepValType;
443  }
444 
445  virtual const std::string toString() const;
446 };
447 
448 
449 /*
450  * Gep Obj variable, this is dynamic generated for field sensitive analysis
451  * Each gep obj variable is one field of a MemObj (base)
452  */
453 class GepObjVar: public ObjVar
454 {
455  friend class SVFIRWriter;
456  friend class SVFIRReader;
457 
458 private:
461 
463  // only for reading from file when we don't have MemObj*
464  GepObjVar(NodeID i, PNODEK ty = GepObjNode) : ObjVar(i, ty) {}
465 
466 public:
468 
469  static inline bool classof(const GepObjVar*)
470  {
471  return true;
472  }
473  static inline bool classof(const ObjVar* node)
474  {
475  return node->getNodeKind() == SVFVar::GepObjNode;
476  }
477  static inline bool classof(const SVFVar* node)
478  {
479  return node->getNodeKind() == SVFVar::GepObjNode;
480  }
481  static inline bool classof(const GenericPAGNodeTy* node)
482  {
483  return node->getNodeKind() == SVFVar::GepObjNode;
484  }
485  static inline bool classof(const SVFBaseNode* node)
486  {
487  return node->getNodeKind() == SVFVar::GepObjNode;
488  }
490 
493  PNODEK ty = GepObjNode)
494  : ObjVar(mem->getValue(), i, mem, ty), apOffset(apOffset)
495  {
496  base = mem->getId();
497  }
498 
501  {
502  return apOffset;
503  }
504 
506  inline void setBaseNode(NodeID bs)
507  {
508  this->base = bs;
509  }
510 
512  inline NodeID getBaseNode(void) const
513  {
514  return base;
515  }
516 
518  inline virtual const SVFType* getType() const
519  {
521  }
522 
524  inline const std::string getValueName() const
525  {
526  if (value)
527  return value->getName() + "_" + std::to_string(apOffset);
528  return "offset_" + std::to_string(apOffset);
529  }
530 
531  virtual const std::string toString() const;
532 };
533 
534 /*
535  * Field-insensitive Gep Obj variable, this is dynamic generated for field sensitive analysis
536  * Each field-insensitive gep obj node represents all fields of a MemObj (base)
537  */
538 class FIObjVar: public ObjVar
539 {
540  friend class SVFIRWriter;
541  friend class SVFIRReader;
542 
543 private:
545  FIObjVar(NodeID i, PNODEK ty = FIObjNode) : ObjVar(i, ty) {}
546 
547 public:
549 
550  static inline bool classof(const FIObjVar*)
551  {
552  return true;
553  }
554  static inline bool classof(const ObjVar* node)
555  {
556  return node->getNodeKind() == SVFVar::FIObjNode;
557  }
558  static inline bool classof(const SVFVar* node)
559  {
560  return node->getNodeKind() == SVFVar::FIObjNode;
561  }
562  static inline bool classof(const GenericPAGNodeTy* node)
563  {
564  return node->getNodeKind() == SVFVar::FIObjNode;
565  }
566  static inline bool classof(const SVFBaseNode* node)
567  {
568  return node->getNodeKind() == SVFVar::FIObjNode;
569  }
571 
573  FIObjVar(const SVFValue* val, NodeID i, const MemObj* mem,
574  PNODEK ty = FIObjNode)
575  : ObjVar(val, i, mem, ty)
576  {
577  }
578 
580  inline const std::string getValueName() const
581  {
582  if (value)
583  return value->getName() + " (base object)";
584  return " (base object)";
585  }
586 
587  virtual const std::string toString() const;
588 };
589 
590 /*
591  * Unique Return node of a procedure
592  */
593 class RetPN: public ValVar
594 {
595  friend class SVFIRWriter;
596  friend class SVFIRReader;
597 
598 private:
601 
602 public:
604  static inline bool classof(const RetPN*)
605  {
606  return true;
607  }
608  static inline bool classof(const SVFVar* node)
609  {
610  return node->getNodeKind() == SVFVar::RetNode;
611  }
612  static inline bool classof(const ValVar* node)
613  {
614  return node->getNodeKind() == SVFVar::RetNode;
615  }
616  static inline bool classof(const GenericPAGNodeTy* node)
617  {
618  return node->getNodeKind() == SVFVar::RetNode;
619  }
620  static inline bool classof(const SVFBaseNode* node)
621  {
622  return node->getNodeKind() == SVFVar::RetNode;
623  }
625 
627  RetPN(const SVFFunction* val, NodeID i) : ValVar(val, i, RetNode) {}
628 
630  const std::string getValueName() const
631  {
632  return value->getName() + "_ret";
633  }
634 
635  virtual const std::string toString() const;
636 };
637 
638 /*
639  * Unique vararg node of a procedure
640  */
641 class VarArgPN: public ValVar
642 {
643  friend class SVFIRWriter;
644  friend class SVFIRReader;
645 
646 private:
649 
650 public:
652  static inline bool classof(const VarArgPN*)
653  {
654  return true;
655  }
656  static inline bool classof(const SVFVar* node)
657  {
658  return node->getNodeKind() == SVFVar::VarargNode;
659  }
660  static inline bool classof(const ValVar* node)
661  {
662  return node->getNodeKind() == SVFVar::VarargNode;
663  }
664  static inline bool classof(const GenericPAGNodeTy* node)
665  {
666  return node->getNodeKind() == SVFVar::VarargNode;
667  }
668  static inline bool classof(const SVFBaseNode* node)
669  {
670  return node->getNodeKind() == SVFVar::VarargNode;
671  }
673 
675  VarArgPN(const SVFFunction* val, NodeID i) : ValVar(val, i, VarargNode) {}
676 
678  inline const std::string getValueName() const
679  {
680  return value->getName() + "_vararg";
681  }
682 
683  virtual const std::string toString() const;
684 };
685 
686 /*
687  * Dummy variable without any LLVM value
688  */
689 class DummyValVar: public ValVar
690 {
691  friend class SVFIRWriter;
692  friend class SVFIRReader;
693 
694 public:
696  static inline bool classof(const DummyValVar*)
697  {
698  return true;
699  }
700  static inline bool classof(const SVFVar* node)
701  {
702  return node->getNodeKind() == SVFVar::DummyValNode;
703  }
704  static inline bool classof(const ValVar* node)
705  {
706  return node->getNodeKind() == SVFVar::DummyValNode;
707  }
708  static inline bool classof(const GenericPAGNodeTy* node)
709  {
710  return node->getNodeKind() == SVFVar::DummyValNode;
711  }
712  static inline bool classof(const SVFBaseNode* node)
713  {
714  return node->getNodeKind() == SVFVar::DummyValNode;
715  }
717 
719  DummyValVar(NodeID i) : ValVar(nullptr, i, DummyValNode) {}
720 
722  inline const std::string getValueName() const
723  {
724  return "dummyVal";
725  }
726 
727  virtual const std::string toString() const;
728 };
729 
730 /*
731  * Dummy object variable
732  */
733 class DummyObjVar: public ObjVar
734 {
735  friend class SVFIRWriter;
736  friend class SVFIRReader;
737 
738 private:
741 
742 public:
744  static inline bool classof(const DummyObjVar*)
745  {
746  return true;
747  }
748  static inline bool classof(const SVFVar* node)
749  {
750  return node->getNodeKind() == SVFVar::DummyObjNode;
751  }
752  static inline bool classof(const ObjVar* node)
753  {
754  return node->getNodeKind() == SVFVar::DummyObjNode;
755  }
756  static inline bool classof(const GenericPAGNodeTy* node)
757  {
758  return node->getNodeKind() == SVFVar::DummyObjNode;
759  }
760 
761  static inline bool classof(const SVFBaseNode* node)
762  {
763  return node->getNodeKind() == SVFVar::DummyObjNode;
764  }
766 
769  : ObjVar(nullptr, i, m, ty)
770  {
771  }
772 
774  inline const std::string getValueName() const
775  {
776  return "dummyObj";
777  }
778 
779  virtual const std::string toString() const;
780 };
781 
782 } // End namespace SVF
783 
784 #endif /* INCLUDE_SVFIR_SVFVARIABLE_H_ */
const char *const string
Definition: cJSON.h:172
APOffset getConstantStructFldIdx() const
Get methods.
Definition: AccessPath.h:100
virtual const std::string toString() const
DummyObjVar(NodeID i, const MemObj *m, PNODEK ty=DummyObjNode)
Constructor.
Definition: SVFVariables.h:768
static bool classof(const DummyObjVar *)
Definition: SVFVariables.h:744
static bool classof(const GenericPAGNodeTy *node)
Definition: SVFVariables.h:756
static bool classof(const SVFBaseNode *node)
Definition: SVFVariables.h:761
static bool classof(const SVFVar *node)
Definition: SVFVariables.h:748
static bool classof(const ObjVar *node)
Definition: SVFVariables.h:752
DummyObjVar(NodeID i)
Constructor to create empty DummyObjVar (for SVFIRReader/deserialization)
Definition: SVFVariables.h:740
const std::string getValueName() const
Return name of this node.
Definition: SVFVariables.h:774
static bool classof(const DummyValVar *)
Definition: SVFVariables.h:696
const std::string getValueName() const
Return name of this node.
Definition: SVFVariables.h:722
DummyValVar(NodeID i)
Constructor.
Definition: SVFVariables.h:719
static bool classof(const ValVar *node)
Definition: SVFVariables.h:704
virtual const std::string toString() const
static bool classof(const GenericPAGNodeTy *node)
Definition: SVFVariables.h:708
static bool classof(const SVFVar *node)
Definition: SVFVariables.h:700
static bool classof(const SVFBaseNode *node)
Definition: SVFVariables.h:712
static bool classof(const ObjVar *node)
Definition: SVFVariables.h:554
static bool classof(const FIObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: SVFVariables.h:550
static bool classof(const SVFVar *node)
Definition: SVFVariables.h:558
FIObjVar(const SVFValue *val, NodeID i, const MemObj *mem, PNODEK ty=FIObjNode)
Constructor.
Definition: SVFVariables.h:573
const std::string getValueName() const
Return name of a LLVM value.
Definition: SVFVariables.h:580
FIObjVar(NodeID i, PNODEK ty=FIObjNode)
Constructor to create empty ObjVar (for SVFIRReader/deserialization)
Definition: SVFVariables.h:545
static bool classof(const GenericPAGNodeTy *node)
Definition: SVFVariables.h:562
static bool classof(const SVFBaseNode *node)
Definition: SVFVariables.h:566
virtual const std::string toString() const
GEdgeKind getEdgeKind() const
Definition: GenericGraph.h:89
bool addIncomingEdge(EdgeType *inEdge)
Add incoming and outgoing edges.
Definition: GenericGraph.h:527
bool addOutgoingEdge(EdgeType *outEdge)
Definition: GenericGraph.h:531
APOffset getConstantFieldIdx() const
offset of the mem object
Definition: SVFVariables.h:500
virtual const SVFType * getType() const
Return the type of this gep object.
Definition: SVFVariables.h:518
GepObjVar(NodeID i, PNODEK ty=GepObjNode)
Constructor to create empty GepObjVar (for SVFIRReader/deserialization)
Definition: SVFVariables.h:464
NodeID getBaseNode(void) const
Return the base object from which this GEP node came from.
Definition: SVFVariables.h:512
void setBaseNode(NodeID bs)
Set the base object from which this GEP node came from.
Definition: SVFVariables.h:506
const std::string getValueName() const
Return name of a LLVM value.
Definition: SVFVariables.h:524
virtual const std::string toString() const
static bool classof(const GepObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: SVFVariables.h:469
static bool classof(const ObjVar *node)
Definition: SVFVariables.h:473
static bool classof(const GenericPAGNodeTy *node)
Definition: SVFVariables.h:481
GepObjVar(const MemObj *mem, NodeID i, const APOffset &apOffset, PNODEK ty=GepObjNode)
Constructor.
Definition: SVFVariables.h:492
static bool classof(const SVFVar *node)
Definition: SVFVariables.h:477
static bool classof(const SVFBaseNode *node)
Definition: SVFVariables.h:485
APOffset apOffset
Definition: SVFVariables.h:459
AccessPath ap
Definition: SVFVariables.h:391
static bool classof(const GenericPAGNodeTy *node)
Definition: SVFVariables.h:412
const SVFType * getType() const
Return type of the value.
Definition: SVFVariables.h:440
static bool classof(const GepValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: SVFVariables.h:400
const SVFType * gepValType
Definition: SVFVariables.h:392
GepValVar(const SVFValue *val, NodeID i, const AccessPath &ap, const SVFType *ty)
Constructor.
Definition: SVFVariables.h:419
static bool classof(const SVFVar *node)
Definition: SVFVariables.h:408
GepValVar(NodeID i)
Constructor to create empty GeValVar (for SVFIRReader/deserialization)
Definition: SVFVariables.h:395
virtual const std::string toString() const
APOffset getConstantFieldIdx() const
offset of the base value variable
Definition: SVFVariables.h:426
const std::string getValueName() const
Return name of a LLVM value.
Definition: SVFVariables.h:432
static bool classof(const ValVar *node)
Definition: SVFVariables.h:404
const SVFType * getType() const
Get obj type.
SymID getId() const
Get the memory object id.
ObjVar(NodeID i, PNODEK ty=ObjNode)
Constructor to create an empty ObjVar (for SVFIRReader/deserialization)
Definition: SVFVariables.h:330
virtual const std::string toString() const
virtual const SVFType * getType() const
Return type of the value.
Definition: SVFVariables.h:371
const MemObj * mem
Definition: SVFVariables.h:328
static bool classof(const GenericPAGNodeTy *node)
Definition: SVFVariables.h:347
const MemObj * getMemObj() const
Return memory object.
Definition: SVFVariables.h:358
static bool classof(const SVFVar *node)
Definition: SVFVariables.h:343
static bool classof(const SVFBaseNode *node)
Definition: SVFVariables.h:351
ObjVar(const SVFValue *val, NodeID i, const MemObj *m, PNODEK ty=ObjNode)
Constructor.
Definition: SVFVariables.h:332
static bool classof(const ObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: SVFVariables.h:339
virtual const std::string getValueName() const
Return name of a LLVM value.
Definition: SVFVariables.h:364
const std::string getValueName() const
Return name of a LLVM value.
Definition: SVFVariables.h:630
static bool classof(const SVFVar *node)
Definition: SVFVariables.h:608
static bool classof(const GenericPAGNodeTy *node)
Definition: SVFVariables.h:616
static bool classof(const ValVar *node)
Definition: SVFVariables.h:612
virtual const std::string toString() const
static bool classof(const SVFBaseNode *node)
Definition: SVFVariables.h:620
RetPN(NodeID i)
Constructor to create empty RetPN (for SVFIRReader/deserialization)
Definition: SVFVariables.h:600
RetPN(const SVFFunction *val, NodeID i)
Constructor.
Definition: SVFVariables.h:627
static bool classof(const RetPN *)
Definition: SVFVariables.h:604
static bool isObjVarKinds(GNodeK n)
Definition: GenericGraph.h:331
static bool isValVarKinds(GNodeK n)
Definition: GenericGraph.h:323
GNodeK getNodeKind() const
Get node kind.
Definition: GenericGraph.h:266
NodeID getId() const
Get ID.
Definition: GenericGraph.h:260
static bool isSVFVarKind(GNodeK n)
Definition: GenericGraph.h:314
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
PAGEdgeToSetMapTy KindToSVFStmtMapTy
virtual const SVFType * getType() const
Definition: SVFValue.h:256
const std::string & getName() const
Definition: SVFValue.h:243
bool isConstDataOrAggDataButNotNullPtr() const
SVFStmt::KindToSVFStmtMapTy InEdgeKindToSetMap
Definition: SVFVariables.h:68
bool hasValue() const
Definition: SVFVariables.h:101
void addOutEdge(SVFStmt *outEdge)
Definition: SVFVariables.h:223
SVFStmt::KindToSVFStmtMapTy OutEdgeKindToSetMap
Definition: SVFVariables.h:69
virtual bool isPointer() const
Whether it is a pointer.
Definition: SVFVariables.h:106
SVFVar(NodeID i, PNODEK k)
whether it is a pointer (top-level or address-taken)
Definition: SVFVariables.h:73
virtual const std::string getValueName() const =0
Get name of the LLVM value.
bool hasIncomingVariantGepEdge() const
Has incoming VariantGepEdges.
Definition: SVFVariables.h:230
bool hasIncomingEdges(SVFStmt::PEDGEK kind) const
Has incoming SVFIR statements (edges)
Definition: SVFVariables.h:147
SVFStmt::SVFStmtSetTy & getIncomingEdges(SVFStmt::PEDGEK kind)
Get incoming SVFIR statements (edges)
Definition: SVFVariables.h:137
virtual const SVFFunction * getFunction() const
Return the function that this SVFVar resides in. Return nullptr if it is a global or constantexpr nod...
Definition: SVFVariables.h:122
GNodeK PNODEK
Definition: SVFVariables.h:63
SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesBegin(SVFStmt::PEDGEK kind) const
Get incoming SVFStmt iterator.
Definition: SVFVariables.h:166
SVFStmt::SVFStmtSetTy & getOutgoingEdges(SVFStmt::PEDGEK kind)
Get outgoing SVFIR statements (edges)
Definition: SVFVariables.h:142
void addInEdge(SVFStmt *inEdge)
add methods of the components
Definition: SVFVariables.h:216
bool hasOutgoingEdges(SVFStmt::PEDGEK kind) const
Has outgoing SVFIR statements (edges)
Definition: SVFVariables.h:156
SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesBegin(SVFStmt::PEDGEK kind) const
Get outgoing SVFStmt iterator.
Definition: SVFVariables.h:182
void dump() const
Dump to console for debugging.
SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesEnd(SVFStmt::PEDGEK kind) const
Get outgoing SVFStmt iterator.
Definition: SVFVariables.h:190
const SVFValue * value
value of this SVFIR node
Definition: SVFVariables.h:67
virtual const SVFType * getType() const
Return type of the value.
Definition: SVFVariables.h:96
virtual ~SVFVar()
Destructor.
Definition: SVFVariables.h:79
const SVFValue * getValue() const
Get/has methods of the components.
Definition: SVFVariables.h:83
static bool classof(const SVFVar *)
Definition: SVFVariables.h:198
bool isIsolatedNode() const
Whether this is an isolated node on the SVFIR graph.
static bool classof(const SVFBaseNode *node)
Definition: SVFVariables.h:208
virtual const std::string toString() const
s64_t GEdgeKind
Definition: SVFVariables.h:64
friend OutStream & operator<<(OutStream &o, const SVFVar &node)
Overloading operator << for dumping SVFVar value.
Definition: SVFVariables.h:253
SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesEnd(SVFStmt::PEDGEK kind) const
Get incoming SVFStmt iterator.
Definition: SVFVariables.h:174
static bool classof(const GenericPAGNodeTy *node)
Definition: SVFVariables.h:203
static SymbolTableInfo * SymbolInfo()
Singleton design here to make sure we only have one instance during any analysis.
static bool isBlkObjOrConstantObj(NodeID id)
const SVFType * getFlatternedElemType(const SVFType *baseType, u32_t flatten_idx)
Return the type of a flattened element given a flattened index.
Definition: VFG.h:51
static bool classof(const GenericPAGNodeTy *node)
Definition: SVFVariables.h:288
virtual const std::string toString() const
ValVar(NodeID i, PNODEK ty=ValNode)
Constructor to create an empty ValVar (for SVFIRReader/deserialization)
Definition: SVFVariables.h:275
const SVFBaseNode * gNode
Definition: SVFVariables.h:272
static bool classof(const SVFVar *node)
Definition: SVFVariables.h:284
const SVFBaseNode * getGNode() const
Definition: SVFVariables.h:311
ValVar(const SVFValue *val, NodeID i, PNODEK ty=ValNode, const SVFBaseNode *node=nullptr)
Constructor.
Definition: SVFVariables.h:299
static bool classof(const SVFBaseNode *node)
Definition: SVFVariables.h:292
static bool classof(const ValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition: SVFVariables.h:280
const std::string getValueName() const
Return name of a LLVM value.
Definition: SVFVariables.h:304
static bool classof(const SVFVar *node)
Definition: SVFVariables.h:656
static bool classof(const ValVar *node)
Definition: SVFVariables.h:660
virtual const std::string toString() const
static bool classof(const SVFBaseNode *node)
Definition: SVFVariables.h:668
static bool classof(const GenericPAGNodeTy *node)
Definition: SVFVariables.h:664
static bool classof(const VarArgPN *)
Definition: SVFVariables.h:652
VarArgPN(const SVFFunction *val, NodeID i)
Constructor.
Definition: SVFVariables.h:675
VarArgPN(NodeID i)
Constructor to create empty VarArgPN (for SVFIRReader/deserialization)
Definition: SVFVariables.h:648
const std::string getValueName() const
Return name of a LLVM value.
Definition: SVFVariables.h:678
for isBitcode
Definition: BasicTypes.h:68
GenericNode< SVFVar, SVFStmt > GenericPAGNodeTy
Definition: SVFVariables.h:40
u32_t NodeID
Definition: GeneralType.h:55
s64_t APOffset
Definition: GeneralType.h:60
std::ostream OutStream
Definition: GeneralType.h:45
signed long long s64_t
Definition: GeneralType.h:49