Static Value-Flow Analysis
Loading...
Searching...
No Matches
SVFVariables.h
Go to the documentation of this file.
1//===- SVFVariables.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 * Refactored on: Nov 30, 2024
29 * Author: Xiao Cheng, Yulei Sui
30 */
31
32#ifndef INCLUDE_SVFIR_SVFVARIABLE_H_
33#define INCLUDE_SVFIR_SVFVARIABLE_H_
34
35#include "Graphs/GenericGraph.h"
36#include "SVFIR/ObjTypeInfo.h"
37#include "SVFIR/SVFStatements.h"
38
39namespace SVF
40{
41
42class SVFVar;
43/*
44 * Program variables in SVFIR (based on PAG nodes)
45 * These represent variables in the program analysis graph
46 */
49{
50
51 friend class SVFIRBuilder;
52 friend class IRGraph;
53 friend class SVFIR;
54 friend class VFG;
55 friend class GraphDBClient;
56
57public:
67 typedef GNodeK PNODEK;
69
70protected:
74
76 {
77 return InEdgeKindToSetMap;
78 }
79
80
85
86
87public:
90
92 virtual ~SVFVar() {}
93
95 virtual inline bool isPointer() const
96 {
97 assert(type && "type is null?");
98 return type->isPointerTy();
99 }
100
103 {
104 return false;
105 }
106
108 virtual bool isIsolatedNode() const;
109
111 virtual const std::string getValueName() const = 0;
112
114 virtual inline const FunObjVar* getFunction() const
115 {
116 return nullptr;
117 }
118
120
125
130
131 inline bool hasIncomingEdges(SVFStmt::PEDGEK kind) const
132 {
133 SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
134 if (it != InEdgeKindToSetMap.end())
135 return (!it->second.empty());
136 else
137 return false;
138 }
139
140 inline bool hasOutgoingEdges(SVFStmt::PEDGEK kind) const
141 {
142 SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
143 if (it != OutEdgeKindToSetMap.end())
144 return (!it->second.empty());
145 else
146 return false;
147 }
148
150 inline SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesBegin(SVFStmt::PEDGEK kind) const
151 {
152 SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
153 assert(it!=InEdgeKindToSetMap.end() && "Edge kind not found");
154 return it->second.begin();
155 }
156
157 inline SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesEnd(SVFStmt::PEDGEK kind) const
158 {
159 SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
160 assert(it!=InEdgeKindToSetMap.end() && "Edge kind not found");
161 return it->second.end();
162 }
163
164 inline SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesBegin(SVFStmt::PEDGEK kind) const
165 {
166 SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
167 assert(it!=OutEdgeKindToSetMap.end() && "Edge kind not found");
168 return it->second.begin();
169 }
170
171 inline SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesEnd(SVFStmt::PEDGEK kind) const
172 {
173 SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
174 assert(it!=OutEdgeKindToSetMap.end() && "Edge kind not found");
175 return it->second.end();
176 }
178
180 static inline bool classof(const SVFVar *)
181 {
182 return true;
183 }
184
185 static inline bool classof(const GenericPAGNodeTy * node)
186 {
187 return isSVFVarKind(node->getNodeKind());
188 }
189
190 static inline bool classof(const SVFValue* node)
191 {
192 return isSVFVarKind(node->getNodeKind());
193 }
194
196 virtual bool ptrInUncalledFunction() const;
197
199 virtual bool isConstDataOrAggData() const
200 {
201 return false;
202 }
203
204
205private:
207
209 {
210 GEdgeKind kind = inEdge->getEdgeKind();
211 InEdgeKindToSetMap[kind].insert(inEdge);
213 }
214
216 {
217 GEdgeKind kind = outEdge->getEdgeKind();
218 OutEdgeKindToSetMap[kind].insert(outEdge);
220 }
221
223 inline bool hasIncomingVariantGepEdge() const
224 {
225 SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(SVFStmt::Gep);
226 if (it != InEdgeKindToSetMap.end())
227 {
228 for(auto gep : it->second)
229 {
230 if(SVFUtil::cast<GepStmt>(gep)->isVariantFieldGep())
231 return true;
232 }
233 }
234 return false;
235 }
236
237public:
239 virtual const std::string toString() const;
240
242 void dump() const;
243
245 friend OutStream& operator<< (OutStream &o, const SVFVar &node)
246 {
247 o << node.toString();
248 return o;
249 }
250};
251
252
253
254/*
255 * Value (Pointer) variable
256 */
257class ValVar: public SVFVar
258{
259 friend class GraphDBClient;
260
261private:
262 const ICFGNode* icfgNode; // icfgnode related to valvar
263
264public:
266
267 static inline bool classof(const ValVar*)
268 {
269 return true;
270 }
271 static inline bool classof(const SVFVar* node)
272 {
273 return isValVarKinds(node->getNodeKind());
274 }
275 static inline bool classof(const GenericPAGNodeTy* node)
276 {
277 return isValVarKinds(node->getNodeKind());
278 }
279 static inline bool classof(const SVFValue* node)
280 {
281 return isValVarKinds(node->getNodeKind());
282 }
284
286 ValVar(NodeID i, const SVFType* svfType, const ICFGNode* node, PNODEK ty = ValNode);
288 inline const std::string getValueName() const
289 {
290 return getName();
291 }
292
293 const ICFGNode* getICFGNode() const
294 {
295 return icfgNode;
296 }
297
298 virtual const FunObjVar* getFunction() const;
299
300 virtual const std::string toString() const;
301
302 std::string getValVarNodeFieldsStmt() const;
303
304};
305
306/*
307 * Memory Object variable
308 */
309class ObjVar: public SVFVar
310{
311 friend class GraphDBClient;
312
313protected:
316 SVFVar(i, svfType, ty)
317 {
318 }
319public:
321
322 static inline bool classof(const ObjVar*)
323 {
324 return true;
325 }
326 static inline bool classof(const SVFVar* node)
327 {
328 return isObjVarKinds(node->getNodeKind());
329 }
330 static inline bool classof(const GenericPAGNodeTy* node)
331 {
332 return isObjVarKinds(node->getNodeKind());
333 }
334 static inline bool classof(const SVFValue* node)
335 {
336 return isObjVarKinds(node->getNodeKind());
337 }
339
341 virtual const std::string getValueName() const
342 {
343 return getName();
344 }
345
346 virtual const std::string toString() const;
347
348 std::string getObjVarNodeFieldsStmt() const;
349
350};
351
352
359class ArgValVar: public ValVar
360{
361 friend class GraphDBClient;
362
363private:
366
367public:
369
370 static inline bool classof(const ArgValVar*)
371 {
372 return true;
373 }
374 static inline bool classof(const ValVar* node)
375 {
376 return node->getNodeKind() == ArgValNode;
377 }
378 static inline bool classof(const SVFVar* node)
379 {
380 return node->getNodeKind() == ArgValNode;
381 }
382 static inline bool classof(const GenericPAGNodeTy* node)
383 {
384 return node->getNodeKind() == ArgValNode;
385 }
386 static inline bool classof(const SVFValue* node)
387 {
388 return node->getNodeKind() == ArgValNode;
389 }
391
393 ArgValVar(NodeID i, u32_t argNo, const ICFGNode* icn, const FunObjVar* callGraphNode,
394 const SVFType* svfType);
395
397 inline const std::string getValueName() const
398 {
399 return getName() + " (argument valvar)";
400 }
401
402 inline void addCGNodeFromDB(const FunObjVar* cgNode)
403 {
404 this->cgNode = cgNode;
405 }
406
407 virtual const FunObjVar* getFunction() const;
408
409 const FunObjVar* getParent() const;
410
413 inline u32_t getArgNo() const
414 {
415 return argNo;
416 }
417
418 bool isArgOfUncalledFunction() const;
419
420 virtual bool isPointer() const;
421
422 virtual const std::string toString() const;
423};
424
425
426/*
427 * Gep Value (Pointer) variable, this variable can be dynamic generated for field sensitive analysis
428 * e.g. memcpy, temp gep value variable needs to be created
429 * Each Gep Value variable is connected to base value variable via gep edge
430 */
431class GepValVar: public ValVar
432{
433 friend class GraphDBClient;
434
435private:
436 AccessPath ap; // AccessPath
437 const ValVar* base; // base node
440
441
442public:
444
445 static inline bool classof(const GepValVar *)
446 {
447 return true;
448 }
449 static inline bool classof(const ValVar * node)
450 {
451 return node->getNodeKind() == SVFVar::GepValNode;
452 }
453 static inline bool classof(const SVFVar *node)
454 {
455 return node->getNodeKind() == SVFVar::GepValNode;
456 }
457 static inline bool classof(const GenericPAGNodeTy *node)
458 {
459 return node->getNodeKind() == SVFVar::GepValNode;
460 }
461 static inline bool classof(const SVFValue* node)
462 {
463 return node->getNodeKind() == SVFVar::GepValNode;
464 }
465
466 inline const AccessPath& getAccessPath() const
467 {
468 return ap;
469 }
470
471 inline const void setAccessPath(const AccessPath* ap)
472 {
473 this->ap = *ap;
474 }
476
478 GepValVar(const ValVar* baseNode, NodeID i, const AccessPath& ap,
479 const SVFType* ty, const ICFGNode* node);
480
483 {
485 }
486
488 inline const ValVar* getBaseNode(void) const
489 {
490 return base;
491 }
492 inline void setBaseNode(const ValVar* baseNode)
493 {
494 base = baseNode;
495 }
496
498 inline const std::string getValueName() const
499 {
500 return getName() + "_" +
501 std::to_string(getConstantFieldIdx());
502 }
503
504 virtual bool isPointer() const
505 {
506 return base->isPointer();
507 }
508
509 inline const SVFType* getType() const
510 {
511 return gepValType;
512 }
513
514 virtual const FunObjVar* getFunction() const
515 {
516 return base->getFunction();
517 }
518
519 virtual const std::string toString() const;
520
522 {
524 }
525 virtual inline bool ptrInUncalledFunction() const
526 {
527 return base->ptrInUncalledFunction();
528 }
529
530 virtual inline bool isConstDataOrAggData() const
531 {
532 return base->isConstDataOrAggData();
533 }
534
537 {
538 return llvmVarID;
539 }
540
542 inline void setLLVMVarInstID(NodeID id)
543 {
544 llvmVarID = id;
545 }
546};
547
548/*
549 * Base memory object variable (address-taken variables in LLVM-based languages)
550 */
551class BaseObjVar : public ObjVar
552{
553 friend class SVFIRBuilder;
554 friend class GraphDBClient;
555
556private:
558
560
561public:
563
564 static inline bool classof(const BaseObjVar*)
565 {
566 return true;
567 }
568 static inline bool classof(const ObjVar* node)
569 {
570 return isBaseObjVarKinds(node->getNodeKind());
571 }
572 static inline bool classof(const SVFVar* node)
573 {
574 return isBaseObjVarKinds(node->getNodeKind());
575 }
576 static inline bool classof(const GenericPAGNodeTy* node)
577 {
578 return isBaseObjVarKinds(node->getNodeKind());
579 }
580 static inline bool classof(const SVFValue* node)
581 {
582 return isBaseObjVarKinds(node->getNodeKind());
583 }
585
588 : ObjVar(i, ti->getType(), ty), typeInfo(ti), icfgNode(node)
589 {
590 }
591
592 virtual const BaseObjVar* getBaseMemObj() const
593 {
594 return this;
595 }
596
597 inline const ObjTypeInfo* getTypeInfo() const
598 {
599 return typeInfo;
600 }
602 {
603 return typeInfo;
604 }
605
607 inline const ICFGNode* getICFGNode() const
608 {
609 return icfgNode;
610 }
611
613 inline const std::string getValueName() const
614 {
615 return getName() + " (base object)";
616 }
617
618 virtual const std::string toString() const;
619
621 inline NodeID getId() const
622 {
623 return id;
624 }
625
627 const SVFType* getType() const
628 {
629 return typeInfo->getType();
630 }
631
634 {
635 return typeInfo->getNumOfElements();
636 }
637
640 {
642 }
643
649
650
653 {
654 return getMaxFieldOffsetLimit() == 0;
655 }
656
662
663
669
671 bool isBlackHoleObj() const;
672
675 {
676 return typeInfo->getByteSizeOfObj();
677 }
678
681 {
683 }
684
685
687
688 bool isFunction() const
689 {
690 return typeInfo->isFunction();
691 }
692 bool isGlobalObj() const
693 {
694 return typeInfo->isGlobalObj();
695 }
696 bool isStaticObj() const
697 {
698 return typeInfo->isStaticObj();
699 }
700 bool isStack() const
701 {
702 return typeInfo->isStack();
703 }
704 bool isHeap() const
705 {
706 return typeInfo->isHeap();
707 }
708 bool isStruct() const
709 {
710 return typeInfo->isStruct();
711 }
712 bool isArray() const
713 {
714 return typeInfo->isArray();
715 }
716 bool isVarStruct() const
717 {
718 return typeInfo->isVarStruct();
719 }
720 bool isVarArray() const
721 {
722 return typeInfo->isVarArray();
723 }
724 bool isConstantStruct() const
725 {
726 return typeInfo->isConstantStruct();
727 }
728 bool isConstantArray() const
729 {
730 return typeInfo->isConstantArray();
731 }
733 {
735 }
736 virtual inline bool isConstDataOrAggData() const
737 {
739 }
741
743 void destroy()
744 {
745 delete typeInfo;
746 typeInfo = nullptr;
747 }
748
749 virtual const FunObjVar* getFunction() const;
750
751};
752
753
754/*
755 * Gep Obj variable, this is dynamic generated for field sensitive analysis
756 * Each gep obj variable is one field of a BaseObjVar (base)
757 */
758class GepObjVar: public ObjVar
759{
760 friend class GraphDBClient;
761
762
763private:
765
767
768public:
770
771 static inline bool classof(const GepObjVar*)
772 {
773 return true;
774 }
775 static inline bool classof(const ObjVar* node)
776 {
777 return node->getNodeKind() == SVFVar::GepObjNode;
778 }
779 static inline bool classof(const SVFVar* node)
780 {
781 return node->getNodeKind() == SVFVar::GepObjNode;
782 }
783 static inline bool classof(const GenericPAGNodeTy* node)
784 {
785 return node->getNodeKind() == SVFVar::GepObjNode;
786 }
787 static inline bool classof(const SVFValue* node)
788 {
789 return node->getNodeKind() == SVFVar::GepObjNode;
790 }
792
799
802 {
803 return apOffset;
804 }
805
807 inline NodeID getBaseNode(void) const
808 {
809 return base->getId();
810 }
811
812 inline const BaseObjVar* getBaseObj() const
813 {
814 return base;
815 }
816
818 inline virtual const SVFType* getType() const;
819
820
822 inline const std::string getValueName() const
823 {
824 return getName() + "_" + std::to_string(apOffset);
825 }
826
827 virtual const FunObjVar* getFunction() const
828 {
829 return base->getFunction();
830 }
831
832 virtual const std::string toString() const;
833
834 virtual inline bool ptrInUncalledFunction() const
835 {
836 return base->ptrInUncalledFunction();
837 }
838
839 virtual inline bool isConstDataOrAggData() const
840 {
841 return base->isConstDataOrAggData();
842 }
843
845 {
847 }
848
849 virtual bool isPointer() const
850 {
851 return base->isPointer();
852 }
853};
854
855
856
864{
865
866 friend class GraphDBClient;
867
868public:
870
871 static inline bool classof(const HeapObjVar*)
872 {
873 return true;
874 }
875 static inline bool classof(const BaseObjVar* node)
876 {
877 return node->getNodeKind() == HeapObjNode;
878 }
879 static inline bool classof(const ObjVar* node)
880 {
881 return node->getNodeKind() == HeapObjNode;
882 }
883 static inline bool classof(const SVFVar* node)
884 {
885 return node->getNodeKind() == HeapObjNode;
886 }
887 static inline bool classof(const GenericPAGNodeTy* node)
888 {
889 return node->getNodeKind() == HeapObjNode;
890 }
891 static inline bool classof(const SVFValue* node)
892 {
893 return node->getNodeKind() == HeapObjNode;
894 }
896
899 BaseObjVar(i, ti, node, HeapObjNode)
900 {
901 }
902
904 inline const std::string getValueName() const
905 {
906 return " (heap base object)";
907 }
908
909 virtual const std::string toString() const;
910};
911
912
922{
923
924 friend class GraphDBClient;
925
926
927public:
929
930 static inline bool classof(const StackObjVar*)
931 {
932 return true;
933 }
934 static inline bool classof(const BaseObjVar* node)
935 {
936 return node->getNodeKind() == StackObjNode;
937 }
938 static inline bool classof(const ObjVar* node)
939 {
940 return node->getNodeKind() == StackObjNode;
941 }
942 static inline bool classof(const SVFVar* node)
943 {
944 return node->getNodeKind() == StackObjNode;
945 }
946 static inline bool classof(const GenericPAGNodeTy* node)
947 {
948 return node->getNodeKind() == StackObjNode;
949 }
950 static inline bool classof(const SVFValue* node)
951 {
952 return node->getNodeKind() == StackObjNode;
953 }
955
958 BaseObjVar(i, ti, node, StackObjNode)
959 {
960 }
961
963 inline const std::string getValueName() const
964 {
965 return " (stack base object)";
966 }
967
968 virtual const std::string toString() const;
969};
970
971
972class CallGraphNode;
973
974class FunObjVar : public BaseObjVar
975{
976 friend class SVFIRBuilder;
977 friend class LLVMModuleSet;
978 friend class GraphDBClient;
979
980protected:
981
983 {
984 exitBlock = bb;
985 }
986
988 {
989 loopAndDom = ld;
990 }
991 inline bool getIsNotRet() const
992 {
993 return isNotRet;
994 }
995 inline const std::vector<const ArgValVar*> &getArgs() const
996 {
997 return allArgs;
998 }
999
1000public:
1004
1005 typedef BasicBlockGraph::IDToNodeMapTy::const_iterator const_bb_iterator;
1006
1007
1008private:
1009 bool isDecl;
1019 std::vector<const ArgValVar*> allArgs;
1021
1022
1023public:
1025
1026 static inline bool classof(const FunObjVar*)
1027 {
1028 return true;
1029 }
1030 static inline bool classof(const BaseObjVar* node)
1031 {
1032 return node->getNodeKind() == FunObjNode;
1033 }
1034 static inline bool classof(const ObjVar* node)
1035 {
1036 return node->getNodeKind() == FunObjNode;
1037 }
1038 static inline bool classof(const SVFVar* node)
1039 {
1040 return node->getNodeKind() == FunObjNode;
1041 }
1042 static inline bool classof(const GenericPAGNodeTy* node)
1043 {
1044 return node->getNodeKind() == FunObjNode;
1045 }
1046 static inline bool classof(const SVFValue* node)
1047 {
1048 return node->getNodeKind() == FunObjNode;
1049 }
1051
1053 FunObjVar(NodeID i, ObjTypeInfo* ti, const ICFGNode* node);
1054
1055
1056 virtual ~FunObjVar()
1057 {
1058 delete loopAndDom;
1059 delete bbGraph;
1060 }
1061
1062 void initFunObjVar(bool decl, bool intrinc, bool addr, bool uncalled, bool notret, bool vararg, const SVFFunctionType *ft,
1064 const std::vector<const ArgValVar *> &allarg, const SVFBasicBlock *exit);
1065
1067 {
1068 realDefFun = real;
1069 }
1070
1071 virtual const FunObjVar*getFunction() const;
1072
1073 inline void addArgument(const ArgValVar *arg)
1074 {
1075 allArgs.push_back(arg);
1076 }
1077 inline bool isDeclaration() const
1078 {
1079 return isDecl;
1080 }
1081
1082 inline bool isIntrinsic() const
1083 {
1084 return intrinsic;
1085 }
1086
1087 inline bool hasAddressTaken() const
1088 {
1089 return isAddrTaken;
1090 }
1091
1092 inline bool isVarArg() const
1093 {
1094 return supVarArg;
1095 }
1096
1097 inline bool isUncalledFunction() const
1098 {
1099 return isUncalled;
1100 }
1101
1102 inline bool hasReturn() const
1103 {
1104 return !isNotRet;
1105 }
1106
1108 inline const SVFFunctionType* getFunctionType() const
1109 {
1110 return funcType;
1111 }
1112
1114 inline const SVFType* getReturnType() const
1115 {
1116 return funcType->getReturnType();
1117 }
1118
1120 {
1121 return loopAndDom;
1122 }
1123
1124 inline const std::vector<const SVFBasicBlock*>& getReachableBBs() const
1125 {
1126 return loopAndDom->getReachableBBs();
1127 }
1128
1129 inline void getExitBlocksOfLoop(const SVFBasicBlock* bb, BBList& exitbbs) const
1130 {
1132 }
1133
1134 inline bool hasLoopInfo(const SVFBasicBlock* bb) const
1135 {
1136 return loopAndDom->hasLoopInfo(bb);
1137 }
1138
1139 const LoopBBs& getLoopInfo(const SVFBasicBlock* bb) const
1140 {
1141 return loopAndDom->getLoopInfo(bb);
1142 }
1143
1144 inline const SVFBasicBlock* getLoopHeader(const BBList& lp) const
1145 {
1146 return loopAndDom->getLoopHeader(lp);
1147 }
1148
1149 inline bool loopContainsBB(const BBList& lp, const SVFBasicBlock* bb) const
1150 {
1151 return loopAndDom->loopContainsBB(lp,bb);
1152 }
1153
1155 {
1156 return loopAndDom->getDomTreeMap();
1157 }
1158
1160 {
1161 return loopAndDom->getDomFrontierMap();
1162 }
1163
1164 inline bool isLoopHeader(const SVFBasicBlock* bb) const
1165 {
1166 return loopAndDom->isLoopHeader(bb);
1167 }
1168
1169 inline bool dominate(const SVFBasicBlock* bbKey, const SVFBasicBlock* bbValue) const
1170 {
1172 }
1173
1174 inline bool postDominate(const SVFBasicBlock* bbKey, const SVFBasicBlock* bbValue) const
1175 {
1177 }
1178
1180 {
1181 if(realDefFun==nullptr)
1182 return this;
1183 return realDefFun;
1184 }
1185
1187 {
1188 this->bbGraph = graph;
1189 }
1190
1192 {
1193 return bbGraph;
1194 }
1195
1197 {
1198 return bbGraph;
1199 }
1200
1201 inline bool hasBasicBlock() const
1202 {
1203 return bbGraph && bbGraph->begin() != bbGraph->end();
1204 }
1205
1206 inline const SVFBasicBlock* getEntryBlock() const
1207 {
1208 assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
1209 assert(bbGraph->begin()->second->getInEdges().size() == 0 && "the first basic block is not entry block");
1210 return bbGraph->begin()->second;
1211 }
1212
1213 inline const SVFBasicBlock* getExitBB() const
1214 {
1215 assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
1216 assert(exitBlock && "must have an exitBlock");
1217 return exitBlock;
1218 }
1219
1221 {
1222 assert(!exitBlock && "have already set exit Basicblock!");
1223 exitBlock = bb;
1224 }
1225
1226
1227 u32_t inline arg_size() const
1228 {
1229 return allArgs.size();
1230 }
1231
1232 inline const ArgValVar* getArg(u32_t idx) const
1233 {
1234 assert (idx < allArgs.size() && "getArg() out of range!");
1235 return allArgs[idx];
1236 }
1237 inline const SVFBasicBlock* front() const
1238 {
1239 return getEntryBlock();
1240 }
1241
1242 inline const SVFBasicBlock* back() const
1243 {
1244 assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
1248 return std::prev(bbGraph->end())->second;
1249 }
1250
1252 {
1253 return bbGraph->begin();
1254 }
1255
1256 inline const_bb_iterator end() const
1257 {
1258 return bbGraph->end();
1259 }
1260
1261 virtual bool isIsolatedNode() const;
1262
1263 virtual const std::string toString() const;
1264};
1265class FunValVar : public ValVar
1266{
1267
1268 friend class GraphDBClient;
1269
1270protected:
1271 inline void setFunction(const FunObjVar* cgn)
1272 {
1273 funObjVar = cgn;
1274 }
1275
1276private:
1278
1279public:
1281
1282 static inline bool classof(const FunValVar*)
1283 {
1284 return true;
1285 }
1286 static inline bool classof(const ValVar* node)
1287 {
1288 return node->getNodeKind() == FunValNode;
1289 }
1290 static inline bool classof(const SVFVar* node)
1291 {
1292 return node->getNodeKind() == FunValNode;
1293 }
1294 static inline bool classof(const GenericPAGNodeTy* node)
1295 {
1296 return node->getNodeKind() == FunValNode;
1297 }
1298 static inline bool classof(const SVFValue* node)
1299 {
1300 return node->getNodeKind() == FunValNode;
1301 }
1303
1304 inline virtual const FunObjVar* getFunction() const
1305 {
1306 return funObjVar->getFunction();
1307 }
1308
1310 FunValVar(NodeID i, const ICFGNode* icn, const FunObjVar* cgn, const SVFType* svfType);
1311
1312
1313 virtual bool isPointer() const
1314 {
1315 return true;
1316 }
1317
1318 virtual const std::string toString() const;
1319};
1320
1321
1322
1323class GlobalValVar : public ValVar
1324{
1325 friend class GraphDBClient;
1326
1327
1328public:
1330
1331 static inline bool classof(const GlobalValVar*)
1332 {
1333 return true;
1334 }
1335 static inline bool classof(const ValVar* node)
1336 {
1337 return node->getNodeKind() == GlobalValNode;
1338 }
1339 static inline bool classof(const SVFVar* node)
1340 {
1341 return node->getNodeKind() == GlobalValNode;
1342 }
1343 static inline bool classof(const GenericPAGNodeTy* node)
1344 {
1345 return node->getNodeKind() == GlobalValNode;
1346 }
1347 static inline bool classof(const SVFValue* node)
1348 {
1349 return node->getNodeKind() == GlobalValNode;
1350 }
1352
1356 {
1357 type = svfType;
1358 }
1359
1360
1361 virtual const std::string toString() const;
1362};
1363
1365{
1366 friend class GraphDBClient;
1367
1368
1369public:
1371
1372 static inline bool classof(const ConstAggValVar*)
1373 {
1374 return true;
1375 }
1376 static inline bool classof(const ValVar* node)
1377 {
1378 return node->getNodeKind() == ConstAggValNode;
1379 }
1380 static inline bool classof(const SVFVar* node)
1381 {
1382 return node->getNodeKind() == ConstAggValNode;
1383 }
1384 static inline bool classof(const GenericPAGNodeTy* node)
1385 {
1386 return node->getNodeKind() == ConstAggValNode;
1387 }
1388 static inline bool classof(const SVFValue* node)
1389 {
1390 return node->getNodeKind() == ConstAggValNode;
1391 }
1393
1397 {
1398 type = svfTy;
1399 }
1400
1401
1402 virtual bool isConstDataOrAggData() const
1403 {
1404 return true;
1405 }
1406
1408 {
1409 return true;
1410 }
1411
1412 virtual const std::string toString() const;
1413};
1414
1415
1417{
1418 friend class GraphDBClient;
1419
1420
1421public:
1423
1424 static inline bool classof(const ConstDataValVar*)
1425 {
1426 return true;
1427 }
1428 static inline bool classof(const ValVar* node)
1429 {
1430 return isConstantDataValVar(node->getNodeKind());
1431 }
1432 static inline bool classof(const SVFVar* node)
1433 {
1434 return isConstantDataValVar(node->getNodeKind());
1435 }
1436 static inline bool classof(const GenericPAGNodeTy* node)
1437 {
1438 return isConstantDataValVar(node->getNodeKind());
1439 }
1440 static inline bool classof(const SVFValue* node)
1441 {
1442 return isConstantDataValVar(node->getNodeKind());
1443 }
1445
1449 : ValVar(i, svfType, icn, ty)
1450 {
1451
1452 }
1453
1454 virtual bool isConstDataOrAggData() const
1455 {
1456 return true;
1457 }
1458
1460 {
1461 return true;
1462 }
1463
1464 virtual const std::string toString() const;
1465};
1466
1468{
1469
1470 friend class GraphDBClient;
1471public:
1473
1474 static inline bool classof(const BlackHoleValVar*)
1475 {
1476 return true;
1477 }
1478 static inline bool classof(const ConstDataValVar* node)
1479 {
1480 return node->getNodeKind() == BlackHoleValNode;
1481 }
1482 static inline bool classof(const ValVar* node)
1483 {
1484 return node->getNodeKind() == BlackHoleValNode;
1485 }
1486 static inline bool classof(const SVFVar* node)
1487 {
1488 return node->getNodeKind() == BlackHoleValNode;
1489 }
1490 static inline bool classof(const GenericPAGNodeTy* node)
1491 {
1492 return node->getNodeKind() == BlackHoleValNode;
1493 }
1494 static inline bool classof(const SVFValue* node)
1495 {
1496 return node->getNodeKind() == BlackHoleValNode;
1497 }
1499
1506
1508 {
1509 return false;
1510 }
1511
1512 virtual const std::string toString() const
1513 {
1514 return "BlackHoleValVar";
1515 }
1516};
1517
1519{
1520
1521 friend class GraphDBClient;
1522
1523private:
1524 double dval;
1525
1526public:
1528
1529 static inline bool classof(const ConstFPValVar*)
1530 {
1531 return true;
1532 }
1533 static inline bool classof(const ConstDataValVar* node)
1534 {
1535 return node->getNodeKind() == ConstFPValNode;
1536 }
1537 static inline bool classof(const ValVar* node)
1538 {
1539 return node->getNodeKind() == ConstFPValNode;
1540 }
1541 static inline bool classof(const SVFVar* node)
1542 {
1543 return node->getNodeKind() == ConstFPValNode;
1544 }
1545 static inline bool classof(const GenericPAGNodeTy* node)
1546 {
1547 return node->getNodeKind() == ConstFPValNode;
1548 }
1549 static inline bool classof(const SVFValue* node)
1550 {
1551 return node->getNodeKind() == ConstFPValNode;
1552 }
1554
1555 inline double getFPValue() const
1556 {
1557 return dval;
1558 }
1559
1562 const ICFGNode* icn, const SVFType* svfType)
1564 {
1565 }
1566
1567 virtual const std::string toString() const;
1568};
1569
1571{
1572
1573 friend class GraphDBClient;
1574
1575
1576private:
1579
1580public:
1582
1583 static inline bool classof(const ConstIntValVar*)
1584 {
1585 return true;
1586 }
1587 static inline bool classof(const ConstDataValVar* node)
1588 {
1589 return node->getNodeKind() == ConstIntValNode;
1590 }
1591 static inline bool classof(const ValVar* node)
1592 {
1593 return node->getNodeKind() == ConstIntValNode;
1594 }
1595 static inline bool classof(const SVFVar* node)
1596 {
1597 return node->getNodeKind() == ConstIntValNode;
1598 }
1599 static inline bool classof(const GenericPAGNodeTy* node)
1600 {
1601 return node->getNodeKind() == ConstIntValNode;
1602 }
1603 static inline bool classof(const SVFValue* node)
1604 {
1605 return node->getNodeKind() == ConstIntValNode;
1606 }
1608
1610 {
1611 return sval;
1612 }
1613
1614
1616 {
1617 return zval;
1618 }
1619
1626 virtual const std::string toString() const;
1627};
1628
1630{
1631 friend class GraphDBClient;
1632
1633public:
1635
1636 static inline bool classof(const ConstNullPtrValVar*)
1637 {
1638 return true;
1639 }
1640 static inline bool classof(const ConstDataValVar* node)
1641 {
1642 return node->getNodeKind() == ConstNullptrValNode;
1643 }
1644 static inline bool classof(const ValVar* node)
1645 {
1646 return node->getNodeKind() == ConstNullptrValNode;
1647 }
1648 static inline bool classof(const SVFVar* node)
1649 {
1650 return node->getNodeKind() == ConstNullptrValNode;
1651 }
1652 static inline bool classof(const GenericPAGNodeTy* node)
1653 {
1654 return node->getNodeKind() == ConstNullptrValNode;
1655 }
1656 static inline bool classof(const SVFValue* node)
1657 {
1658 return node->getNodeKind() == ConstNullptrValNode;
1659 }
1661
1668
1670 {
1671 return false;
1672 }
1673
1674 virtual const std::string toString() const;
1675};
1676
1678{
1679 friend class GraphDBClient;
1680
1681
1682public:
1684
1685 static inline bool classof(const GlobalObjVar*)
1686 {
1687 return true;
1688 }
1689 static inline bool classof(const BaseObjVar* node)
1690 {
1691 return node->getNodeKind() == GlobalObjNode;
1692 }
1693 static inline bool classof(const ObjVar* node)
1694 {
1695 return node->getNodeKind() == GlobalObjNode;
1696 }
1697 static inline bool classof(const SVFVar* node)
1698 {
1699 return node->getNodeKind() == GlobalObjNode;
1700 }
1701 static inline bool classof(const GenericPAGNodeTy* node)
1702 {
1703 return node->getNodeKind() == GlobalObjNode;
1704 }
1705 static inline bool classof(const SVFValue* node)
1706 {
1707 return node->getNodeKind() == GlobalObjNode;
1708 }
1710
1713 PNODEK ty = GlobalObjNode): BaseObjVar(i, ti, node, ty)
1714 {
1715
1716 }
1717
1718
1719 virtual const std::string toString() const;
1720};
1721
1723{
1724 friend class GraphDBClient;
1725
1726
1727public:
1729
1730 static inline bool classof(const ConstAggObjVar*)
1731 {
1732 return true;
1733 }
1734 static inline bool classof(const BaseObjVar* node)
1735 {
1736 return node->getNodeKind() == ConstAggObjNode;
1737 }
1738
1739 static inline bool classof(const ObjVar* node)
1740 {
1741 return node->getNodeKind() == ConstAggObjNode;
1742 }
1743 static inline bool classof(const SVFVar* node)
1744 {
1745 return node->getNodeKind() == ConstAggObjNode;
1746 }
1747 static inline bool classof(const GenericPAGNodeTy* node)
1748 {
1749 return node->getNodeKind() == ConstAggObjNode;
1750 }
1751 static inline bool classof(const SVFValue* node)
1752 {
1753 return node->getNodeKind() == ConstAggObjNode;
1754 }
1756
1759 : BaseObjVar(i, ti, node, ConstAggObjNode)
1760 {
1761
1762 }
1763
1764 virtual bool isConstDataOrAggData() const
1765 {
1766 return true;
1767 }
1768
1770 {
1771 return true;
1772 }
1773
1774 virtual const std::string toString() const;
1775};
1776
1778{
1779 friend class GraphDBClient;
1780
1781public:
1783 static inline bool classof(const ConstDataObjVar*)
1784 {
1785 return true;
1786 }
1787 static inline bool classof(const BaseObjVar* node)
1788 {
1789 return isConstantDataObjVarKinds(node->getNodeKind());
1790 }
1791 static inline bool classof(const SVFVar* node)
1792 {
1793 return isConstantDataObjVarKinds(node->getNodeKind());
1794 }
1795 static inline bool classof(const ObjVar* node)
1796 {
1797 return isConstantDataObjVarKinds(node->getNodeKind());
1798 }
1799 static inline bool classof(const GenericPAGNodeTy* node)
1800 {
1801 return isConstantDataObjVarKinds(node->getNodeKind());
1802 }
1803
1804 static inline bool classof(const SVFValue* node)
1805 {
1806 return isConstantDataObjVarKinds(node->getNodeKind());
1807 }
1809
1812 : BaseObjVar(i, ti, node, ty)
1813 {
1814 }
1815
1816 virtual bool isConstDataOrAggData() const
1817 {
1818 return true;
1819 }
1820
1822 {
1823 return true;
1824 }
1825
1826 virtual const std::string toString() const;
1827};
1828
1830{
1831
1832 friend class GraphDBClient;
1833
1834
1835private:
1836 float dval;
1837
1838public:
1840 static inline bool classof(const ConstFPObjVar*)
1841 {
1842 return true;
1843 }
1844 static inline bool classof(const ConstDataObjVar* node)
1845 {
1846 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1847 }
1848 static inline bool classof(const BaseObjVar* node)
1849 {
1850 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1851 }
1852
1853 static inline bool classof(const SVFVar* node)
1854 {
1855 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1856 }
1857
1858 static inline bool classof(const ObjVar* node)
1859 {
1860 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1861 }
1862
1863 static inline bool classof(const GenericPAGNodeTy* node)
1864 {
1865 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1866 }
1867
1868 static inline bool classof(const SVFValue* node)
1869 {
1870 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1871 }
1873
1877 {
1878 }
1879
1880 inline double getFPValue() const
1881 {
1882 return dval;
1883 }
1884
1885
1886 virtual const std::string toString() const;
1887};
1888
1890{
1891
1892 friend class GraphDBClient;
1893
1894
1895
1896private:
1899
1900public:
1902 static inline bool classof(const ConstIntObjVar*)
1903 {
1904 return true;
1905 }
1906
1907 static inline bool classof(const ConstDataObjVar* node)
1908 {
1909 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1910 }
1911
1912 static inline bool classof(const BaseObjVar* node)
1913 {
1914 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1915 }
1916
1917 static inline bool classof(const SVFVar* node)
1918 {
1919 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1920 }
1921 static inline bool classof(const ObjVar* node)
1922 {
1923 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1924 }
1925 static inline bool classof(const GenericPAGNodeTy* node)
1926 {
1927 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1928 }
1929
1930 static inline bool classof(const SVFValue* node)
1931 {
1932 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1933 }
1934
1936 {
1937 return sval;
1938 }
1939
1940
1942 {
1943 return zval;
1944 }
1946
1950 {
1951 }
1952
1953 virtual const std::string toString() const;
1954};
1955
1957{
1958
1959 friend class GraphDBClient;
1960
1961public:
1963 static inline bool classof(const ConstNullPtrObjVar*)
1964 {
1965 return true;
1966 }
1967
1968 static inline bool classof(const ConstDataObjVar* node)
1969 {
1970 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1971 }
1972
1973 static inline bool classof(const BaseObjVar* node)
1974 {
1975 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1976 }
1977
1978 static inline bool classof(const SVFVar* node)
1979 {
1980 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1981 }
1982 static inline bool classof(const ObjVar* node)
1983 {
1984 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1985 }
1986 static inline bool classof(const GenericPAGNodeTy* node)
1987 {
1988 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1989 }
1990
1991 static inline bool classof(const SVFValue* node)
1992 {
1993 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1994 }
1996
2003 {
2004 return false;
2005 }
2006 virtual const std::string toString() const;
2007};
2008/*
2009 * Unique Return node of a procedure
2010 */
2011class RetValPN : public ValVar
2012{
2013 friend class GraphDBClient;
2014
2015protected:
2016 inline void setCallGraphNode(const FunObjVar* node)
2017 {
2018 callGraphNode = node;
2019 }
2020
2021private:
2023
2024public:
2026 static inline bool classof(const RetValPN*)
2027 {
2028 return true;
2029 }
2030 static inline bool classof(const SVFVar* node)
2031 {
2032 return node->getNodeKind() == SVFVar::RetValNode;
2033 }
2034 static inline bool classof(const ValVar* node)
2035 {
2036 return node->getNodeKind() == SVFVar::RetValNode;
2037 }
2038 static inline bool classof(const GenericPAGNodeTy* node)
2039 {
2040 return node->getNodeKind() == SVFVar::RetValNode;
2041 }
2042 static inline bool classof(const SVFValue* node)
2043 {
2044 return node->getNodeKind() == SVFVar::RetValNode;
2045 }
2047
2048
2050 RetValPN(NodeID i, const FunObjVar* node, const SVFType* svfType, const ICFGNode* icn);
2051
2052 inline const FunObjVar* getCallGraphNode() const
2053 {
2054 return callGraphNode;
2055 }
2056
2057 virtual const FunObjVar* getFunction() const;
2058
2059 virtual bool isPointer() const;
2060
2062 const std::string getValueName() const;
2063
2064 virtual const std::string toString() const;
2065};
2066
2067/*
2068 * Unique vararg node of a procedure
2069 */
2070class VarArgValPN : public ValVar
2071{
2072
2073 friend class GraphDBClient;
2074
2075protected:
2076 inline void setCallGraphNode(const FunObjVar* node)
2077 {
2078 callGraphNode = node;
2079 }
2080private:
2082
2083public:
2085 static inline bool classof(const VarArgValPN*)
2086 {
2087 return true;
2088 }
2089 static inline bool classof(const SVFVar* node)
2090 {
2091 return node->getNodeKind() == SVFVar::VarargValNode;
2092 }
2093 static inline bool classof(const ValVar* node)
2094 {
2095 return node->getNodeKind() == SVFVar::VarargValNode;
2096 }
2097 static inline bool classof(const GenericPAGNodeTy* node)
2098 {
2099 return node->getNodeKind() == SVFVar::VarargValNode;
2100 }
2101 static inline bool classof(const SVFValue* node)
2102 {
2103 return node->getNodeKind() == SVFVar::VarargValNode;
2104 }
2106
2108 VarArgValPN(NodeID i, const FunObjVar* node, const SVFType* svfType, const ICFGNode* icn)
2110 {
2111 assert((node->isDeclaration() || icn) &&
2112 "VarArgValPN of a defined function must have a valid ICFGNode");
2113 }
2114
2115 virtual const FunObjVar* getFunction() const;
2116
2118 const std::string getValueName() const;
2119
2120 virtual bool isPointer() const
2121 {
2122 return true;
2123 }
2124 virtual const std::string toString() const;
2125};
2126
2127/*
2128 * Dummy variable without any LLVM value
2129 */
2130class DummyValVar: public ValVar
2131{
2132 friend class GraphDBClient;
2133
2134public:
2136 static inline bool classof(const DummyValVar*)
2137 {
2138 return true;
2139 }
2140 static inline bool classof(const SVFVar* node)
2141 {
2142 return node->getNodeKind() == SVFVar::DummyValNode;
2143 }
2144 static inline bool classof(const ValVar* node)
2145 {
2146 return node->getNodeKind() == SVFVar::DummyValNode;
2147 }
2148 static inline bool classof(const GenericPAGNodeTy* node)
2149 {
2150 return node->getNodeKind() == SVFVar::DummyValNode;
2151 }
2152 static inline bool classof(const SVFValue* node)
2153 {
2154 return node->getNodeKind() == SVFVar::DummyValNode;
2155 }
2157
2160 : ValVar(i, svfType, node, DummyValNode)
2161 {
2162 }
2163
2165 inline const std::string getValueName() const
2166 {
2167 return "dummyVal";
2168 }
2169
2170 virtual bool isPointer() const
2171 {
2172 return true;
2173 }
2174
2175 virtual const std::string toString() const;
2176};
2177
2178/*
2179 * Represents an LLVM intrinsic call instruction (e.g. llvm.dbg.declare).
2180 * These are collected into valSyms but have no corresponding ICFGNode.
2181 */
2183{
2184 friend class GraphDBClient;
2185
2186public:
2188 static inline bool classof(const IntrinsicValVar*)
2189 {
2190 return true;
2191 }
2192 static inline bool classof(const SVFVar* node)
2193 {
2194 return node->getNodeKind() == SVFVar::IntrinsicValNode;
2195 }
2196 static inline bool classof(const ValVar* node)
2197 {
2198 return node->getNodeKind() == SVFVar::IntrinsicValNode;
2199 }
2200 static inline bool classof(const GenericPAGNodeTy* node)
2201 {
2202 return node->getNodeKind() == SVFVar::IntrinsicValNode;
2203 }
2204 static inline bool classof(const SVFValue* node)
2205 {
2206 return node->getNodeKind() == SVFVar::IntrinsicValNode;
2207 }
2209
2214
2215 inline const std::string getValueName() const
2216 {
2217 return "intrinsicVal";
2218 }
2219
2220 virtual const std::string toString() const;
2221};
2222
2223/*
2224 * Represents an LLVM BasicBlock (label operand of br/switch).
2225 * Collected into valSyms as a branch operand but has no ICFGNode.
2226 */
2228{
2229 friend class GraphDBClient;
2230
2231public:
2232 static inline bool classof(const BasicBlockValVar*)
2233 {
2234 return true;
2235 }
2236 static inline bool classof(const SVFVar* node)
2237 {
2238 return node->getNodeKind() == SVFVar::BasicBlockValNode;
2239 }
2240 static inline bool classof(const ValVar* node)
2241 {
2242 return node->getNodeKind() == SVFVar::BasicBlockValNode;
2243 }
2244 static inline bool classof(const GenericPAGNodeTy* node)
2245 {
2246 return node->getNodeKind() == SVFVar::BasicBlockValNode;
2247 }
2248 static inline bool classof(const SVFValue* node)
2249 {
2250 return node->getNodeKind() == SVFVar::BasicBlockValNode;
2251 }
2252
2255
2256 inline const std::string getValueName() const
2257 {
2258 return "basicBlockVal";
2259 }
2260 virtual const std::string toString() const;
2261};
2262
2263/*
2264 * Represents InlineAsm, DSOLocalEquivalent, and NoCFIValue.
2265 * These are non-instruction values related to inline assembly,
2266 * position-independent code (PIC), or control-flow integrity (CFI).
2267 * They have no corresponding ICFGNode.
2268 */
2269class AsmPCValVar: public ValVar
2270{
2271 friend class GraphDBClient;
2272
2273public:
2274 static inline bool classof(const AsmPCValVar*)
2275 {
2276 return true;
2277 }
2278 static inline bool classof(const SVFVar* node)
2279 {
2280 return node->getNodeKind() == SVFVar::AsmPCValNode;
2281 }
2282 static inline bool classof(const ValVar* node)
2283 {
2284 return node->getNodeKind() == SVFVar::AsmPCValNode;
2285 }
2286 static inline bool classof(const GenericPAGNodeTy* node)
2287 {
2288 return node->getNodeKind() == SVFVar::AsmPCValNode;
2289 }
2290 static inline bool classof(const SVFValue* node)
2291 {
2292 return node->getNodeKind() == SVFVar::AsmPCValNode;
2293 }
2294
2297
2298 inline const std::string getValueName() const
2299 {
2300 return "asmPCVal";
2301 }
2302 virtual const std::string toString() const;
2303};
2304
2305/*
2306 * Dummy object variable
2307 */
2309{
2310
2311 friend class GraphDBClient;
2312
2313
2314public:
2316 static inline bool classof(const DummyObjVar*)
2317 {
2318 return true;
2319 }
2320 static inline bool classof(const BaseObjVar* node)
2321 {
2322 return node->getNodeKind() == SVFVar::DummyObjNode;
2323 }
2324 static inline bool classof(const SVFVar* node)
2325 {
2326 return node->getNodeKind() == SVFVar::DummyObjNode;
2327 }
2328 static inline bool classof(const ObjVar* node)
2329 {
2330 return node->getNodeKind() == SVFVar::DummyObjNode;
2331 }
2332 static inline bool classof(const GenericPAGNodeTy* node)
2333 {
2334 return node->getNodeKind() == SVFVar::DummyObjNode;
2335 }
2336
2337 static inline bool classof(const SVFValue* node)
2338 {
2339 return node->getNodeKind() == SVFVar::DummyObjNode;
2340 }
2342
2345 : BaseObjVar(i, ti, node, DummyObjNode)
2346 {
2347 }
2348
2350 inline const std::string getValueName() const
2351 {
2352 return "dummyObj";
2353 }
2354
2355 virtual bool isPointer() const
2356 {
2357 return true;
2358 }
2359
2360 virtual const std::string toString() const;
2361};
2362
2363} // End namespace SVF
2364
2365#endif /* INCLUDE_SVFIR_SVFVARIABLE_H_ */
APOffset getConstantStructFldIdx() const
Get methods.
Definition AccessPath.h:98
Class representing a function argument variable in the SVFIR.
static bool classof(const SVFValue *node)
bool isArgOfUncalledFunction() const
u32_t getArgNo() const
const FunObjVar * cgNode
static bool classof(const GenericPAGNodeTy *node)
void addCGNodeFromDB(const FunObjVar *cgNode)
static bool classof(const SVFVar *node)
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
friend class GraphDBClient
virtual bool isPointer() const
Check if this variable represents a pointer.
const FunObjVar * getParent() const
static bool classof(const ValVar *node)
static bool classof(const ArgValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
const std::string getValueName() const
Return name of a LLVM value.
virtual const std::string toString() const
Get string representation.
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const SVFVar *node)
virtual const std::string toString() const
Get string representation.
static bool classof(const AsmPCValVar *)
static bool classof(const SVFValue *node)
AsmPCValVar(NodeID i, const SVFType *svfType)
friend class GraphDBClient
static bool classof(const ValVar *node)
const std::string getValueName() const
Get string name of the represented LLVM value.
bool isFunction() const
object attributes methods
void destroy()
Clean up memory.
bool isConstDataOrConstGlobal() const
u32_t getNumOfElements() const
Get the number of elements of this object.
const ICFGNode * icfgNode
virtual bool isConstDataOrAggData() const
Check if this variable represents constant/aggregate data.
bool isGlobalObj() const
BaseObjVar(NodeID i, ObjTypeInfo *ti, const ICFGNode *node, PNODEK ty=BaseObjNode)
Constructor.
const ObjTypeInfo * getTypeInfo() const
bool isConstantStruct() const
bool isStack() const
void setNumOfElements(u32_t num)
Set the number of elements of this object.
void setFieldInsensitive()
Set the memory object to be field insensitive.
bool isHeap() const
bool isArray() const
bool isStaticObj() const
const std::string getValueName() const
Return name of a LLVM value.
virtual const std::string toString() const
Get string representation.
void setFieldSensitive()
Set the memory object to be field sensitive (up to max field limit)
static bool classof(const SVFValue *node)
bool isVarStruct() const
static bool classof(const ObjVar *node)
virtual const BaseObjVar * getBaseMemObj() const
NodeID getId() const
Get the memory object id.
u32_t getMaxFieldOffsetLimit() const
Get max field offset limit.
const ICFGNode * getICFGNode() const
Get the ICFGNode related to the creation of this object.
bool isConstantByteSize() const
Check if byte size is a const value.
u32_t getByteSizeOfObj() const
Get the byte size of this object.
friend class GraphDBClient
ObjTypeInfo * typeInfo
bool isBlackHoleObj() const
Whether it is a black hole object.
bool isStruct() const
static bool classof(const BaseObjVar *)
ICFGNode related to the creation of this object.
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
bool isVarArray() const
static bool classof(const SVFVar *node)
bool isFieldInsensitive() const
Return true if its field limit is 0.
const SVFType * getType() const
Get obj type.
ObjTypeInfo * getTypeInfo()
bool isConstantArray() const
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const ValVar *node)
static bool classof(const BasicBlockValVar *)
static bool classof(const GenericPAGNodeTy *node)
friend class GraphDBClient
static bool classof(const SVFValue *node)
virtual const std::string toString() const
Get string representation.
static bool classof(const SVFVar *node)
const std::string getValueName() const
Get string name of the represented LLVM value.
BasicBlockValVar(NodeID i, const SVFType *svfType)
virtual const std::string toString() const
Get string representation.
virtual bool isConstDataOrAggDataButNotNullPtr() const
Check if this variable represents constant data/metadata but not null pointer.
BlackHoleValVar(NodeID i, const SVFType *svfType, PNODEK ty=BlackHoleValNode)
Constructor.
static bool classof(const ValVar *node)
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const SVFVar *node)
static bool classof(const ConstDataValVar *node)
friend class GraphDBClient
static bool classof(const BlackHoleValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const SVFValue *node)
static bool classof(const BaseObjVar *node)
virtual const std::string toString() const
Get string representation.
ConstAggObjVar(NodeID i, ObjTypeInfo *ti, const ICFGNode *node)
Constructor.
static bool classof(const SVFVar *node)
virtual bool isConstDataOrAggData() const
Check if this variable represents constant/aggregate data.
static bool classof(const ObjVar *node)
static bool classof(const ConstAggObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const SVFValue *node)
static bool classof(const GenericPAGNodeTy *node)
friend class GraphDBClient
virtual bool isConstDataOrAggDataButNotNullPtr() const
Check if this variable represents constant data/metadata but not null pointer.
static bool classof(const GenericPAGNodeTy *node)
virtual bool isConstDataOrAggData() const
Check if this variable represents constant/aggregate data.
static bool classof(const SVFVar *node)
static bool classof(const ValVar *node)
friend class GraphDBClient
static bool classof(const ConstAggValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
virtual bool isConstDataOrAggDataButNotNullPtr() const
Check if this variable represents constant data/metadata but not null pointer.
virtual const std::string toString() const
Get string representation.
static bool classof(const SVFValue *node)
ConstAggValVar(NodeID i, const ICFGNode *icn, const SVFType *svfTy)
Constructor.
ConstDataObjVar(NodeID i, ObjTypeInfo *ti, const ICFGNode *node, PNODEK ty=ConstDataObjNode)
Constructor.
static bool classof(const ObjVar *node)
static bool classof(const SVFValue *node)
virtual const std::string toString() const
Get string representation.
static bool classof(const BaseObjVar *node)
virtual bool isConstDataOrAggDataButNotNullPtr() const
Check if this variable represents constant data/metadata but not null pointer.
static bool classof(const GenericPAGNodeTy *node)
friend class GraphDBClient
virtual bool isConstDataOrAggData() const
Check if this variable represents constant/aggregate data.
static bool classof(const ConstDataObjVar *)
static bool classof(const SVFVar *node)
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const ConstDataValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
virtual bool isConstDataOrAggDataButNotNullPtr() const
Check if this variable represents constant data/metadata but not null pointer.
static bool classof(const ValVar *node)
static bool classof(const SVFValue *node)
ConstDataValVar(NodeID i, const ICFGNode *icn, const SVFType *svfType, PNODEK ty=ConstDataValNode)
Constructor.
virtual const std::string toString() const
Get string representation.
friend class GraphDBClient
static bool classof(const SVFVar *node)
virtual bool isConstDataOrAggData() const
Check if this variable represents constant/aggregate data.
ConstFPObjVar(NodeID i, double dv, ObjTypeInfo *ti, const ICFGNode *node)
Constructor.
static bool classof(const ObjVar *node)
static bool classof(const BaseObjVar *node)
static bool classof(const ConstFPObjVar *)
virtual const std::string toString() const
Get string representation.
friend class GraphDBClient
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const ConstDataObjVar *node)
double getFPValue() const
static bool classof(const SVFValue *node)
static bool classof(const SVFVar *node)
virtual const std::string toString() const
Get string representation.
static bool classof(const ValVar *node)
static bool classof(const SVFValue *node)
static bool classof(const ConstDataValVar *node)
static bool classof(const SVFVar *node)
static bool classof(const ConstFPValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const GenericPAGNodeTy *node)
friend class GraphDBClient
double getFPValue() const
ConstFPValVar(NodeID i, double dv, const ICFGNode *icn, const SVFType *svfType)
Constructor.
virtual const std::string toString() const
Get string representation.
static bool classof(const SVFValue *node)
ConstIntObjVar(NodeID i, s64_t sv, u64_t zv, ObjTypeInfo *ti, const ICFGNode *node)
Constructor.
static bool classof(const SVFVar *node)
static bool classof(const ConstDataObjVar *node)
s64_t getSExtValue() const
static bool classof(const ConstIntObjVar *)
static bool classof(const ObjVar *node)
u64_t getZExtValue() const
friend class GraphDBClient
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const BaseObjVar *node)
static bool classof(const ValVar *node)
u64_t getZExtValue() const
virtual const std::string toString() const
Get string representation.
static bool classof(const SVFValue *node)
s64_t getSExtValue() const
static bool classof(const ConstDataValVar *node)
friend class GraphDBClient
static bool classof(const ConstIntValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const SVFVar *node)
ConstIntValVar(NodeID i, s64_t sv, u64_t zv, const ICFGNode *icn, const SVFType *svfType)
Constructor.
static bool classof(const GenericPAGNodeTy *node)
ConstNullPtrObjVar(NodeID i, ObjTypeInfo *ti, const ICFGNode *node)
Constructor.
static bool classof(const BaseObjVar *node)
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const ConstNullPtrObjVar *)
static bool classof(const ConstDataObjVar *node)
static bool classof(const ObjVar *node)
static bool classof(const SVFVar *node)
virtual const std::string toString() const
Get string representation.
static bool classof(const SVFValue *node)
virtual bool isConstDataOrAggDataButNotNullPtr() const
Check if this variable represents constant data/metadata but not null pointer.
ConstNullPtrValVar(NodeID i, const ICFGNode *icn, const SVFType *svfType)
Constructor.
static bool classof(const ConstNullPtrValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const SVFValue *node)
virtual const std::string toString() const
Get string representation.
static bool classof(const SVFVar *node)
static bool classof(const GenericPAGNodeTy *node)
virtual bool isConstDataOrAggDataButNotNullPtr() const
Check if this variable represents constant data/metadata but not null pointer.
static bool classof(const ValVar *node)
static bool classof(const ConstDataValVar *node)
virtual const std::string toString() const
Get string representation.
virtual bool isPointer() const
Check if this variable represents a pointer.
static bool classof(const DummyObjVar *)
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const SVFVar *node)
DummyObjVar(NodeID i, ObjTypeInfo *ti, const ICFGNode *node)
Constructor.
static bool classof(const ObjVar *node)
friend class GraphDBClient
static bool classof(const BaseObjVar *node)
static bool classof(const SVFValue *node)
const std::string getValueName() const
Return name of this node.
static bool classof(const DummyValVar *)
const std::string getValueName() const
Return name of this node.
static bool classof(const ValVar *node)
virtual const std::string toString() const
Get string representation.
DummyValVar(NodeID i, const ICFGNode *node, const SVFType *svfType=SVFType::getSVFPtrType())
Constructor.
friend class GraphDBClient
virtual bool isPointer() const
Check if this variable represents a pointer.
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const SVFVar *node)
static bool classof(const SVFValue *node)
BasicBlockGraph::IDToNodeMapTy::const_iterator const_bb_iterator
void updateExitBlock(SVFBasicBlock *bb)
const BasicBlockGraph * getBasicBlockGraph() const
const ArgValVar * getArg(u32_t idx) const
virtual const std::string toString() const
Get string representation.
void setLoopAndDomInfo(SVFLoopAndDomInfo *ld)
SVFLoopAndDomInfo::BBList BBList
BasicBlockGraph * getBasicBlockGraph()
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
virtual ~FunObjVar()
const SVFBasicBlock * getLoopHeader(const BBList &lp) const
u32_t arg_size() const
const Map< const SVFBasicBlock *, BBSet > & getDomFrontierMap() const
const FunObjVar * getDefFunForMultipleModule() const
void getExitBlocksOfLoop(const SVFBasicBlock *bb, BBList &exitbbs) const
virtual bool isIsolatedNode() const
Check if this node is isolated (no edges) in the SVFIR graph.
bool isAddrTaken
return true if this function is an intrinsic function (e.g., llvm.dbg), which does not reside in the ...
bool hasAddressTaken() const
const Map< const SVFBasicBlock *, BBSet > & getDomTreeMap() const
static bool classof(const SVFVar *node)
SVFLoopAndDomInfo::LoopBBs LoopBBs
bool isNotRet
return true if this function is never called
SVFLoopAndDomInfo * loopAndDom
FunctionType, which is different from the type (PointerType) of this SVF Function.
void addArgument(const ArgValVar *arg)
const std::vector< const ArgValVar * > & getArgs() const
bool postDominate(const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
const SVFType * getReturnType() const
Returns the FunctionType.
const LoopBBs & getLoopInfo(const SVFBasicBlock *bb) const
bool dominate(const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
const_bb_iterator begin() const
static bool classof(const BaseObjVar *node)
std::vector< const ArgValVar * > allArgs
the basic block graph of this function
const SVFBasicBlock * back() const
bool supVarArg
return true if this function never returns
const SVFBasicBlock * getEntryBlock() const
const SVFBasicBlock * exitBlock
all formal arguments of this function
SVFLoopAndDomInfo::BBSet BBSet
bool isUncalledFunction() const
static bool classof(const SVFValue *node)
bool getIsNotRet() const
static bool classof(const GenericPAGNodeTy *node)
const SVFFunctionType * funcType
return true if this function supports variable arguments
friend class GraphDBClient
const SVFFunctionType * getFunctionType() const
Returns the FunctionType.
bool isLoopHeader(const SVFBasicBlock *bb) const
bool intrinsic
return true if this function does not have a body
const SVFBasicBlock * front() const
static bool classof(const FunObjVar *)
a 'single' basic block having no successors and containing return instruction in a function
const FunObjVar * realDefFun
the loop and dominate information
void setBasicBlockGraph(BasicBlockGraph *graph)
bool isUncalled
return true if this function is address-taken (for indirect call purposes)
bool isIntrinsic() const
const_bb_iterator end() const
bool loopContainsBB(const BBList &lp, const SVFBasicBlock *bb) const
void setExitBlock(SVFBasicBlock *bb)
SVFLoopAndDomInfo * getLoopAndDomInfo() const
bool isVarArg() const
static bool classof(const ObjVar *node)
void setRelDefFun(const FunObjVar *real)
void initFunObjVar(bool decl, bool intrinc, bool addr, bool uncalled, bool notret, bool vararg, const SVFFunctionType *ft, SVFLoopAndDomInfo *ld, const FunObjVar *real, BasicBlockGraph *bbg, const std::vector< const ArgValVar * > &allarg, const SVFBasicBlock *exit)
const std::vector< const SVFBasicBlock * > & getReachableBBs() const
const SVFBasicBlock * getExitBB() const
bool hasBasicBlock() const
BasicBlockGraph * bbGraph
the definition of a function across multiple modules
bool isDeclaration() const
bool hasReturn() const
bool hasLoopInfo(const SVFBasicBlock *bb) const
static bool classof(const FunValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const SVFValue *node)
virtual const std::string toString() const
Get string representation.
static bool classof(const SVFVar *node)
static bool classof(const GenericPAGNodeTy *node)
virtual bool isPointer() const
Check if this variable represents a pointer.
static bool classof(const ValVar *node)
friend class GraphDBClient
const FunObjVar * funObjVar
void setFunction(const FunObjVar *cgn)
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
iterator begin()
Iterators.
bool addIncomingEdge(EdgeType *inEdge)
Add incoming and outgoing edges.
bool addOutgoingEdge(EdgeType *outEdge)
APOffset getConstantFieldIdx() const
offset of the mem object
const BaseObjVar * getBaseObj() const
virtual bool isConstDataOrAggDataButNotNullPtr() const
Check if this variable represents constant data/metadata but not null pointer.
const BaseObjVar * base
virtual bool isConstDataOrAggData() const
Check if this variable represents constant/aggregate data.
NodeID getBaseNode(void) const
Return the base object from which this GEP node came from.
const std::string getValueName() const
Return name of a LLVM value.
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
static bool classof(const SVFValue *node)
virtual bool isPointer() const
Check if this variable represents a pointer.
virtual const std::string toString() const
Get string representation.
friend class GraphDBClient
static bool classof(const GepObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const ObjVar *node)
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const SVFVar *node)
virtual bool ptrInUncalledFunction() const
Check if this pointer is in an uncalled function.
GepObjVar(const BaseObjVar *baseObj, NodeID i, const APOffset &apOffset, PNODEK ty=GepObjNode)
Constructor.
APOffset apOffset
virtual const SVFType * getType() const
Return the type of this gep object.
const ValVar * getBaseNode(void) const
Return the base object from which this GEP node came from.
AccessPath ap
static bool classof(const GenericPAGNodeTy *node)
void setLLVMVarInstID(NodeID id)
Set the LLVM variable ID associated with this GepValVar.
virtual bool isConstDataOrAggDataButNotNullPtr() const
Check if this variable represents constant data/metadata but not null pointer.
static bool classof(const SVFValue *node)
static bool classof(const GepValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
const SVFType * getType() const
const SVFType * gepValType
virtual bool ptrInUncalledFunction() const
Check if this pointer is in an uncalled function.
const AccessPath & getAccessPath() const
const void setAccessPath(const AccessPath *ap)
virtual bool isConstDataOrAggData() const
Check if this variable represents constant/aggregate data.
const ValVar * base
static bool classof(const SVFVar *node)
virtual bool isPointer() const
Check if this variable represents a pointer.
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
friend class GraphDBClient
void setBaseNode(const ValVar *baseNode)
NodeID getLLVMVarInstID() const
Get the LLVM variable ID associated with this GepValVar.
virtual const std::string toString() const
Get string representation.
APOffset getConstantFieldIdx() const
offset of the base value variable
const std::string getValueName() const
Return name of a LLVM value.
static bool classof(const ValVar *node)
static bool classof(const BaseObjVar *node)
static bool classof(const GenericPAGNodeTy *node)
GlobalObjVar(NodeID i, ObjTypeInfo *ti, const ICFGNode *node, PNODEK ty=GlobalObjNode)
Constructor.
virtual const std::string toString() const
Get string representation.
static bool classof(const SVFVar *node)
friend class GraphDBClient
static bool classof(const GlobalObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const ObjVar *node)
static bool classof(const SVFValue *node)
GlobalValVar(NodeID i, const ICFGNode *icn, const SVFType *svfType)
Constructor.
static bool classof(const GlobalValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
virtual const std::string toString() const
Get string representation.
static bool classof(const ValVar *node)
static bool classof(const GenericPAGNodeTy *node)
friend class GraphDBClient
static bool classof(const SVFValue *node)
static bool classof(const SVFVar *node)
Class representing a heap object variable in the SVFIR.
static bool classof(const HeapObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
static bool classof(const SVFVar *node)
static bool classof(const GenericPAGNodeTy *node)
HeapObjVar(NodeID i, ObjTypeInfo *ti, const ICFGNode *node)
Constructor.
static bool classof(const SVFValue *node)
const std::string getValueName() const
Return name of a LLVM value.
friend class GraphDBClient
static bool classof(const ObjVar *node)
virtual const std::string toString() const
Get string representation.
static bool classof(const BaseObjVar *node)
const std::string getValueName() const
Get string name of the represented LLVM value.
static bool classof(const SVFVar *node)
static bool classof(const SVFValue *node)
static bool classof(const GenericPAGNodeTy *node)
IntrinsicValVar(NodeID i, const SVFType *svfType)
static bool classof(const ValVar *node)
friend class GraphDBClient
virtual const std::string toString() const
Get string representation.
static bool classof(const IntrinsicValVar *)
bool isConstantStruct()
bool isConstDataOrAggData()
u32_t getMaxFieldOffsetLimit()
Get max field offset limit.
bool isConstDataOrConstGlobal()
u32_t getNumOfElements() const
Get the number of elements of this object.
const SVFType * getType() const
Get LLVM type.
Definition ObjTypeInfo.h:97
bool isConstantByteSize() const
Check if byte size is a const value.
void setMaxFieldOffsetLimit(u32_t limit)
Get max field offset limit.
bool isFunction()
Object attributes.
u32_t getByteSizeOfObj() const
Get the byte size of this object.
void setNumOfElements(u32_t num)
Set the number of elements of this object.
virtual const std::string toString() const
Get string representation.
static bool classof(const SVFValue *node)
static bool classof(const GenericPAGNodeTy *node)
std::string getObjVarNodeFieldsStmt() const
static bool classof(const SVFVar *node)
ObjVar(NodeID i, const SVFType *svfType, PNODEK ty=ObjNode)
Constructor.
friend class GraphDBClient
static bool classof(const ObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
virtual const std::string getValueName() const
Return name of a LLVM value.
const FunObjVar * callGraphNode
void setCallGraphNode(const FunObjVar *node)
static bool classof(const ValVar *node)
static bool classof(const GenericPAGNodeTy *node)
static bool classof(const SVFValue *node)
const FunObjVar * getCallGraphNode() const
virtual bool isPointer() const
Check if this variable represents a pointer.
static bool classof(const SVFVar *node)
const std::string getValueName() const
Return name of a LLVM value.
friend class GraphDBClient
virtual const std::string toString() const
Get string representation.
static bool classof(const RetValPN *)
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
const SVFType * getReturnType() const
Definition SVFType.h:403
const LoopBBs & getLoopInfo(const SVFBasicBlock *bb) const
Definition SVFValue.cpp:76
const Map< const SVFBasicBlock *, BBSet > & getDomFrontierMap() const
Map< const SVFBasicBlock *, BBSet > & getDomTreeMap()
std::vector< const SVFBasicBlock * > BBList
bool dominate(const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
Definition SVFValue.cpp:102
bool isLoopHeader(const SVFBasicBlock *bb) const
Definition SVFValue.cpp:189
void getExitBlocksOfLoop(const SVFBasicBlock *bb, BBList &exitbbs) const
Definition SVFValue.cpp:83
const BBList & getReachableBBs() const
const SVFBasicBlock * getLoopHeader(const LoopBBs &lp) const
bool hasLoopInfo(const SVFBasicBlock *bb) const
Set< const SVFBasicBlock * > BBSet
bool loopContainsBB(const LoopBBs &lp, const SVFBasicBlock *bb) const
bool postDominate(const SVFBasicBlock *bbKey, const SVFBasicBlock *bbValue) const
Definition SVFValue.cpp:133
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
PAGEdgeToSetMapTy KindToSVFStmtMapTy
static SVFType * getSVFPtrType()
Definition SVFType.h:218
bool isPointerTy() const
Definition SVFType.h:294
@ ConstNullptrObjNode
Definition SVFValue.h:102
@ BasicBlockValNode
Definition SVFValue.h:84
@ ConstNullptrValNode
Definition SVFValue.h:80
static bool isConstantDataValVar(GNodeK n)
Definition SVFValue.h:252
static bool isObjVarKinds(GNodeK n)
Definition SVFValue.h:260
static bool isBaseObjVarKinds(GNodeK n)
Definition SVFValue.h:268
GNodeK getNodeKind() const
Get node kind.
Definition SVFValue.h:169
NodeID id
Node ID.
Definition SVFValue.h:209
virtual const std::string & getName() const
Definition SVFValue.h:189
static bool isConstantDataObjVarKinds(GNodeK n)
Definition SVFValue.h:276
static bool isValVarKinds(GNodeK n)
Definition SVFValue.h:243
static bool isSVFVarKind(GNodeK n)
Definition SVFValue.h:234
const SVFType * type
SVF type.
Definition SVFValue.h:211
SVFStmt::SVFStmtSetTy & getOutgoingEdges(SVFStmt::PEDGEK kind)
SVFStmt::KindToSVFStmtMapTy InEdgeKindToSetMap
Maps tracking incoming and outgoing edges by kind.
static bool classof(const SVFValue *node)
void addOutEdge(SVFStmt *outEdge)
friend OutStream & operator<<(OutStream &o, const SVFVar &node)
Stream operator overload for output.
SVFStmt::KindToSVFStmtMapTy OutEdgeKindToSetMap
virtual bool isConstDataOrAggDataButNotNullPtr() const
Check if this variable represents constant data/metadata but not null pointer.
virtual bool isPointer() const
Check if this variable represents a pointer.
virtual bool ptrInUncalledFunction() const
Check if this pointer is in an uncalled function.
virtual const std::string getValueName() const =0
Get string name of the represented LLVM value.
bool hasIncomingVariantGepEdge() const
Check for incoming variable field GEP edges.
bool hasIncomingEdges(SVFStmt::PEDGEK kind) const
SVFStmt::SVFStmtSetTy & getIncomingEdges(SVFStmt::PEDGEK kind)
Edge accessors and checkers.
GNodeK PNODEK
SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesBegin(SVFStmt::PEDGEK kind) const
Edge iterators.
void addInEdge(SVFStmt *inEdge)
Edge management methods.
bool hasOutgoingEdges(SVFStmt::PEDGEK kind) const
SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesBegin(SVFStmt::PEDGEK kind) const
const SVFStmt::KindToSVFStmtMapTy & getInEdgeKindToSetMap() const
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
void dump() const
Debug dump to console.
SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesEnd(SVFStmt::PEDGEK kind) const
const SVFStmt::KindToSVFStmtMapTy & getOutEdgeKindToSetMap() const
friend class GraphDBClient
virtual ~SVFVar()
Virtual destructor.
static bool classof(const SVFVar *)
Type checking support for LLVM-style RTTI.
virtual bool isIsolatedNode() const
Check if this node is isolated (no edges) in the SVFIR graph.
virtual const std::string toString() const
Get string representation.
virtual bool isConstDataOrAggData() const
Check if this variable represents constant/aggregate data.
s64_t GEdgeKind
SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesEnd(SVFStmt::PEDGEK kind) const
static bool classof(const GenericPAGNodeTy *node)
Represents a stack-allocated object variable in the SVFIR (SVF Intermediate Representation) @inherits...
const std::string getValueName() const
Return name of a LLVM value.
static bool classof(const SVFVar *node)
static bool classof(const ObjVar *node)
static bool classof(const BaseObjVar *node)
static bool classof(const GenericPAGNodeTy *node)
friend class GraphDBClient
StackObjVar(NodeID i, ObjTypeInfo *ti, const ICFGNode *node)
Constructor.
static bool classof(const SVFValue *node)
virtual const std::string toString() const
Get string representation.
static bool classof(const StackObjVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
Definition VFG.h:51
const ICFGNode * getICFGNode() const
static bool classof(const GenericPAGNodeTy *node)
virtual const std::string toString() const
Get string representation.
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
static bool classof(const SVFVar *node)
friend class GraphDBClient
std::string getValVarNodeFieldsStmt() const
static bool classof(const SVFValue *node)
static bool classof(const ValVar *)
Methods for support type inquiry through isa, cast, and dyn_cast:
const ICFGNode * icfgNode
const std::string getValueName() const
Return name of a LLVM value.
virtual bool isPointer() const
Check if this variable represents a pointer.
VarArgValPN(NodeID i, const FunObjVar *node, const SVFType *svfType, const ICFGNode *icn)
Constructor.
static bool classof(const SVFValue *node)
static bool classof(const GenericPAGNodeTy *node)
virtual const std::string toString() const
Get string representation.
static bool classof(const VarArgValPN *)
static bool classof(const SVFVar *node)
const FunObjVar * callGraphNode
const std::string getValueName() const
Return name of a LLVM value.
friend class GraphDBClient
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
static bool classof(const ValVar *node)
void setCallGraphNode(const FunObjVar *node)
for isBitcode
Definition BasicTypes.h:70
unsigned long long u64_t
Definition GeneralType.h:49
GenericNode< SVFVar, SVFStmt > GenericPAGNodeTy
u32_t NodeID
Definition GeneralType.h:56
s64_t APOffset
Definition GeneralType.h:60
std::ostream OutStream
Definition GeneralType.h:46
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:76
unsigned u32_t
Definition GeneralType.h:47
signed long long s64_t
Definition GeneralType.h:50