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
56public:
66 typedef GNodeK PNODEK;
68
69protected:
73
76
77
78public:
81
83 virtual ~SVFVar() {}
84
86 virtual inline bool isPointer() const
87 {
88 assert(type && "type is null?");
89 return type->isPointerTy();
90 }
91
94 {
95 return false;
96 }
97
99 virtual bool isIsolatedNode() const;
100
102 virtual const std::string getValueName() const = 0;
103
105 virtual inline const FunObjVar* getFunction() const
106 {
107 return nullptr;
108 }
109
111
116
121
122 inline bool hasIncomingEdges(SVFStmt::PEDGEK kind) const
123 {
124 SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
125 if (it != InEdgeKindToSetMap.end())
126 return (!it->second.empty());
127 else
128 return false;
129 }
130
131 inline bool hasOutgoingEdges(SVFStmt::PEDGEK kind) const
132 {
133 SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
134 if (it != OutEdgeKindToSetMap.end())
135 return (!it->second.empty());
136 else
137 return false;
138 }
139
141 inline SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesBegin(SVFStmt::PEDGEK kind) const
142 {
143 SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
144 assert(it!=InEdgeKindToSetMap.end() && "Edge kind not found");
145 return it->second.begin();
146 }
147
148 inline SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesEnd(SVFStmt::PEDGEK kind) const
149 {
150 SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(kind);
151 assert(it!=InEdgeKindToSetMap.end() && "Edge kind not found");
152 return it->second.end();
153 }
154
155 inline SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesBegin(SVFStmt::PEDGEK kind) const
156 {
157 SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
158 assert(it!=OutEdgeKindToSetMap.end() && "Edge kind not found");
159 return it->second.begin();
160 }
161
162 inline SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesEnd(SVFStmt::PEDGEK kind) const
163 {
164 SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind);
165 assert(it!=OutEdgeKindToSetMap.end() && "Edge kind not found");
166 return it->second.end();
167 }
169
171 static inline bool classof(const SVFVar *)
172 {
173 return true;
174 }
175
176 static inline bool classof(const GenericPAGNodeTy * node)
177 {
178 return isSVFVarKind(node->getNodeKind());
179 }
180
181 static inline bool classof(const SVFValue* node)
182 {
183 return isSVFVarKind(node->getNodeKind());
184 }
185
187 virtual bool ptrInUncalledFunction() const;
188
190 virtual bool isConstDataOrAggData() const
191 {
192 return false;
193 }
194
195
196private:
198
200 {
201 GEdgeKind kind = inEdge->getEdgeKind();
202 InEdgeKindToSetMap[kind].insert(inEdge);
204 }
205
207 {
208 GEdgeKind kind = outEdge->getEdgeKind();
209 OutEdgeKindToSetMap[kind].insert(outEdge);
211 }
212
214 inline bool hasIncomingVariantGepEdge() const
215 {
216 SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(SVFStmt::Gep);
217 if (it != InEdgeKindToSetMap.end())
218 {
219 for(auto gep : it->second)
220 {
221 if(SVFUtil::cast<GepStmt>(gep)->isVariantFieldGep())
222 return true;
223 }
224 }
225 return false;
226 }
227
228public:
230 virtual const std::string toString() const;
231
233 void dump() const;
234
236 friend OutStream& operator<< (OutStream &o, const SVFVar &node)
237 {
238 o << node.toString();
239 return o;
240 }
241};
242
243
244
245/*
246 * Value (Pointer) variable
247 */
248class ValVar: public SVFVar
249{
250
251private:
252 const ICFGNode* icfgNode; // icfgnode related to valvar
253
254public:
256
257 static inline bool classof(const ValVar*)
258 {
259 return true;
260 }
261 static inline bool classof(const SVFVar* node)
262 {
263 return isValVarKinds(node->getNodeKind());
264 }
265 static inline bool classof(const GenericPAGNodeTy* node)
266 {
267 return isValVarKinds(node->getNodeKind());
268 }
269 static inline bool classof(const SVFValue* node)
270 {
271 return isValVarKinds(node->getNodeKind());
272 }
274
277 : SVFVar(i, svfType, ty), icfgNode(node)
278 {
279 }
281 inline const std::string getValueName() const
282 {
283 return getName();
284 }
285
286 const ICFGNode* getICFGNode() const
287 {
288 return icfgNode;
289 }
290
291 virtual const FunObjVar* getFunction() const;
292
293 virtual const std::string toString() const;
294};
295
296/*
297 * Memory Object variable
298 */
299class ObjVar: public SVFVar
300{
301
302protected:
305 SVFVar(i, svfType, ty)
306 {
307 }
308public:
310
311 static inline bool classof(const ObjVar*)
312 {
313 return true;
314 }
315 static inline bool classof(const SVFVar* node)
316 {
317 return isObjVarKinds(node->getNodeKind());
318 }
319 static inline bool classof(const GenericPAGNodeTy* node)
320 {
321 return isObjVarKinds(node->getNodeKind());
322 }
323 static inline bool classof(const SVFValue* node)
324 {
325 return isObjVarKinds(node->getNodeKind());
326 }
328
330 virtual const std::string getValueName() const
331 {
332 return getName();
333 }
334
335 virtual const std::string toString() const;
336};
337
338
345class ArgValVar: public ValVar
346{
347
348private:
351
352public:
354
355 static inline bool classof(const ArgValVar*)
356 {
357 return true;
358 }
359 static inline bool classof(const ValVar* node)
360 {
361 return node->getNodeKind() == ArgValNode;
362 }
363 static inline bool classof(const SVFVar* node)
364 {
365 return node->getNodeKind() == ArgValNode;
366 }
367 static inline bool classof(const GenericPAGNodeTy* node)
368 {
369 return node->getNodeKind() == ArgValNode;
370 }
371 static inline bool classof(const SVFValue* node)
372 {
373 return node->getNodeKind() == ArgValNode;
374 }
376
378 ArgValVar(NodeID i, u32_t argNo, const ICFGNode* icn, const FunObjVar* callGraphNode,
379 const SVFType* svfType);
380
382 inline const std::string getValueName() const
383 {
384 return getName() + " (argument valvar)";
385 }
386
387 virtual const FunObjVar* getFunction() const;
388
389 const FunObjVar* getParent() const;
390
393 inline u32_t getArgNo() const
394 {
395 return argNo;
396 }
397
398 bool isArgOfUncalledFunction() const;
399
400 virtual bool isPointer() const;
401
402 virtual const std::string toString() const;
403};
404
405
406/*
407 * Gep Value (Pointer) variable, this variable can be dynamic generated for field sensitive analysis
408 * e.g. memcpy, temp gep value variable needs to be created
409 * Each Gep Value variable is connected to base value variable via gep edge
410 */
411class GepValVar: public ValVar
412{
413
414private:
415 AccessPath ap; // AccessPath
416 const ValVar* base; // base node
418
419public:
421
422 static inline bool classof(const GepValVar *)
423 {
424 return true;
425 }
426 static inline bool classof(const ValVar * node)
427 {
428 return node->getNodeKind() == SVFVar::GepValNode;
429 }
430 static inline bool classof(const SVFVar *node)
431 {
432 return node->getNodeKind() == SVFVar::GepValNode;
433 }
434 static inline bool classof(const GenericPAGNodeTy *node)
435 {
436 return node->getNodeKind() == SVFVar::GepValNode;
437 }
438 static inline bool classof(const SVFValue* node)
439 {
440 return node->getNodeKind() == SVFVar::GepValNode;
441 }
443
445 GepValVar(const ValVar* baseNode, NodeID i, const AccessPath& ap,
446 const SVFType* ty, const ICFGNode* node);
447
450 {
452 }
453
455 inline const ValVar* getBaseNode(void) const
456 {
457 return base;
458 }
459
461 inline const std::string getValueName() const
462 {
463 return getName() + "_" +
464 std::to_string(getConstantFieldIdx());
465 }
466
467 virtual bool isPointer() const
468 {
469 return base->isPointer();
470 }
471
472 inline const SVFType* getType() const
473 {
474 return gepValType;
475 }
476
477 virtual const FunObjVar* getFunction() const
478 {
479 return base->getFunction();
480 }
481
482 virtual const std::string toString() const;
483
485 {
487 }
488 virtual inline bool ptrInUncalledFunction() const
489 {
490 return base->ptrInUncalledFunction();
491 }
492
493 virtual inline bool isConstDataOrAggData() const
494 {
495 return base->isConstDataOrAggData();
496 }
497};
498
499/*
500 * Base memory object variable (address-taken variables in LLVM-based languages)
501 */
502class BaseObjVar : public ObjVar
503{
504 friend class SVFIRBuilder;
505private:
507
509
510public:
512
513 static inline bool classof(const BaseObjVar*)
514 {
515 return true;
516 }
517 static inline bool classof(const ObjVar* node)
518 {
519 return isBaseObjVarKinds(node->getNodeKind());
520 }
521 static inline bool classof(const SVFVar* node)
522 {
523 return isBaseObjVarKinds(node->getNodeKind());
524 }
525 static inline bool classof(const GenericPAGNodeTy* node)
526 {
527 return isBaseObjVarKinds(node->getNodeKind());
528 }
529 static inline bool classof(const SVFValue* node)
530 {
531 return isBaseObjVarKinds(node->getNodeKind());
532 }
534
537 const SVFType* svfType, const ICFGNode* node, PNODEK ty = BaseObjNode)
538 : ObjVar(i, svfType, ty), typeInfo(ti), icfgNode(node)
539 {
540 }
541
542 virtual const BaseObjVar* getBaseMemObj() const
543 {
544 return this;
545 }
546
548 inline const ICFGNode* getICFGNode() const
549 {
550 return icfgNode;
551 }
552
554 inline const std::string getValueName() const
555 {
556 return getName() + " (base object)";
557 }
558
559 virtual const std::string toString() const;
560
562 inline NodeID getId() const
563 {
564 return id;
565 }
566
568 const SVFType* getType() const
569 {
570 return typeInfo->getType();
571 }
572
575 {
576 return typeInfo->getNumOfElements();
577 }
578
581 {
583 }
584
590
591
594 {
595 return getMaxFieldOffsetLimit() == 0;
596 }
597
603
604
610
612 bool isBlackHoleObj() const;
613
616 {
617 return typeInfo->getByteSizeOfObj();
618 }
619
622 {
624 }
625
626
628
629 bool isFunction() const
630 {
631 return typeInfo->isFunction();
632 }
633 bool isGlobalObj() const
634 {
635 return typeInfo->isGlobalObj();
636 }
637 bool isStaticObj() const
638 {
639 return typeInfo->isStaticObj();
640 }
641 bool isStack() const
642 {
643 return typeInfo->isStack();
644 }
645 bool isHeap() const
646 {
647 return typeInfo->isHeap();
648 }
649 bool isStruct() const
650 {
651 return typeInfo->isStruct();
652 }
653 bool isArray() const
654 {
655 return typeInfo->isArray();
656 }
657 bool isVarStruct() const
658 {
659 return typeInfo->isVarStruct();
660 }
661 bool isVarArray() const
662 {
663 return typeInfo->isVarArray();
664 }
665 bool isConstantStruct() const
666 {
667 return typeInfo->isConstantStruct();
668 }
669 bool isConstantArray() const
670 {
671 return typeInfo->isConstantArray();
672 }
674 {
676 }
677 virtual inline bool isConstDataOrAggData() const
678 {
680 }
682
684 void destroy()
685 {
686 delete typeInfo;
687 typeInfo = nullptr;
688 }
689
690 virtual const FunObjVar* getFunction() const;
691
692};
693
694
695/*
696 * Gep Obj variable, this is dynamic generated for field sensitive analysis
697 * Each gep obj variable is one field of a BaseObjVar (base)
698 */
699class GepObjVar: public ObjVar
700{
701
702private:
704
706
707public:
709
710 static inline bool classof(const GepObjVar*)
711 {
712 return true;
713 }
714 static inline bool classof(const ObjVar* node)
715 {
716 return node->getNodeKind() == SVFVar::GepObjNode;
717 }
718 static inline bool classof(const SVFVar* node)
719 {
720 return node->getNodeKind() == SVFVar::GepObjNode;
721 }
722 static inline bool classof(const GenericPAGNodeTy* node)
723 {
724 return node->getNodeKind() == SVFVar::GepObjNode;
725 }
726 static inline bool classof(const SVFValue* node)
727 {
728 return node->getNodeKind() == SVFVar::GepObjNode;
729 }
731
738
741 {
742 return apOffset;
743 }
744
746 inline NodeID getBaseNode(void) const
747 {
748 return base->getId();
749 }
750
751 inline const BaseObjVar* getBaseObj() const
752 {
753 return base;
754 }
755
757 inline virtual const SVFType* getType() const;
758
759
761 inline const std::string getValueName() const
762 {
763 return getName() + "_" + std::to_string(apOffset);
764 }
765
766 virtual const FunObjVar* getFunction() const
767 {
768 return base->getFunction();
769 }
770
771 virtual const std::string toString() const;
772
773 virtual inline bool ptrInUncalledFunction() const
774 {
775 return base->ptrInUncalledFunction();
776 }
777
778 virtual inline bool isConstDataOrAggData() const
779 {
780 return base->isConstDataOrAggData();
781 }
782
784 {
786 }
787
788 virtual bool isPointer() const
789 {
790 return base->isPointer();
791 }
792};
793
794
795
803{
804
805public:
807
808 static inline bool classof(const HeapObjVar*)
809 {
810 return true;
811 }
812 static inline bool classof(const BaseObjVar* node)
813 {
814 return node->getNodeKind() == HeapObjNode;
815 }
816 static inline bool classof(const ObjVar* node)
817 {
818 return node->getNodeKind() == HeapObjNode;
819 }
820 static inline bool classof(const SVFVar* node)
821 {
822 return node->getNodeKind() == HeapObjNode;
823 }
824 static inline bool classof(const GenericPAGNodeTy* node)
825 {
826 return node->getNodeKind() == HeapObjNode;
827 }
828 static inline bool classof(const SVFValue* node)
829 {
830 return node->getNodeKind() == HeapObjNode;
831 }
833
837 {
838 }
839
841 inline const std::string getValueName() const
842 {
843 return " (heap base object)";
844 }
845
846 virtual const std::string toString() const;
847};
848
849
859{
860
861public:
863
864 static inline bool classof(const StackObjVar*)
865 {
866 return true;
867 }
868 static inline bool classof(const BaseObjVar* node)
869 {
870 return node->getNodeKind() == StackObjNode;
871 }
872 static inline bool classof(const ObjVar* node)
873 {
874 return node->getNodeKind() == StackObjNode;
875 }
876 static inline bool classof(const SVFVar* node)
877 {
878 return node->getNodeKind() == StackObjNode;
879 }
880 static inline bool classof(const GenericPAGNodeTy* node)
881 {
882 return node->getNodeKind() == StackObjNode;
883 }
884 static inline bool classof(const SVFValue* node)
885 {
886 return node->getNodeKind() == StackObjNode;
887 }
889
893 {
894 }
895
897 inline const std::string getValueName() const
898 {
899 return " (stack base object)";
900 }
901
902 virtual const std::string toString() const;
903};
904
905
906class CallGraphNode;
907
908class FunObjVar : public BaseObjVar
909{
910 friend class SVFIRBuilder;
911 friend class LLVMModuleSet;
912
913public:
917
918 typedef BasicBlockGraph::IDToNodeMapTy::const_iterator const_bb_iterator;
919
920
921private:
922 bool isDecl;
926 bool isNotRet;
932 std::vector<const ArgValVar*> allArgs;
934
935public:
937
938 static inline bool classof(const FunObjVar*)
939 {
940 return true;
941 }
942 static inline bool classof(const BaseObjVar* node)
943 {
944 return node->getNodeKind() == FunObjNode;
945 }
946 static inline bool classof(const ObjVar* node)
947 {
948 return node->getNodeKind() == FunObjNode;
949 }
950 static inline bool classof(const SVFVar* node)
951 {
952 return node->getNodeKind() == FunObjNode;
953 }
954 static inline bool classof(const GenericPAGNodeTy* node)
955 {
956 return node->getNodeKind() == FunObjNode;
957 }
958 static inline bool classof(const SVFValue* node)
959 {
960 return node->getNodeKind() == FunObjNode;
961 }
963
965 FunObjVar(NodeID i, ObjTypeInfo* ti, const SVFType* svfType, const ICFGNode* node);
966
967
968 virtual ~FunObjVar()
969 {
970 delete loopAndDom;
971 delete bbGraph;
972 }
973
974 void initFunObjVar(bool decl, bool intrinc, bool addr, bool uncalled, bool notret, bool vararg, const SVFFunctionType *ft,
976 const std::vector<const ArgValVar *> &allarg, const SVFBasicBlock *exit);
977
979 {
981 }
982
983 virtual const FunObjVar*getFunction() const;
984
985 inline void addArgument(const ArgValVar *arg)
986 {
987 allArgs.push_back(arg);
988 }
989 inline bool isDeclaration() const
990 {
991 return isDecl;
992 }
993
994 inline bool isIntrinsic() const
995 {
996 return intrinsic;
997 }
998
999 inline bool hasAddressTaken() const
1000 {
1001 return isAddrTaken;
1002 }
1003
1004 inline bool isVarArg() const
1005 {
1006 return supVarArg;
1007 }
1008
1009 inline bool isUncalledFunction() const
1010 {
1011 return isUncalled;
1012 }
1013
1014 inline bool hasReturn() const
1015 {
1016 return !isNotRet;
1017 }
1018
1020 inline const SVFFunctionType* getFunctionType() const
1021 {
1022 return funcType;
1023 }
1024
1026 inline const SVFType* getReturnType() const
1027 {
1028 return funcType->getReturnType();
1029 }
1030
1032 {
1033 return loopAndDom;
1034 }
1035
1036 inline const std::vector<const SVFBasicBlock*>& getReachableBBs() const
1037 {
1038 return loopAndDom->getReachableBBs();
1039 }
1040
1041 inline void getExitBlocksOfLoop(const SVFBasicBlock* bb, BBList& exitbbs) const
1042 {
1044 }
1045
1046 inline bool hasLoopInfo(const SVFBasicBlock* bb) const
1047 {
1048 return loopAndDom->hasLoopInfo(bb);
1049 }
1050
1051 const LoopBBs& getLoopInfo(const SVFBasicBlock* bb) const
1052 {
1053 return loopAndDom->getLoopInfo(bb);
1054 }
1055
1056 inline const SVFBasicBlock* getLoopHeader(const BBList& lp) const
1057 {
1058 return loopAndDom->getLoopHeader(lp);
1059 }
1060
1061 inline bool loopContainsBB(const BBList& lp, const SVFBasicBlock* bb) const
1062 {
1063 return loopAndDom->loopContainsBB(lp,bb);
1064 }
1065
1067 {
1068 return loopAndDom->getDomTreeMap();
1069 }
1070
1072 {
1073 return loopAndDom->getDomFrontierMap();
1074 }
1075
1076 inline bool isLoopHeader(const SVFBasicBlock* bb) const
1077 {
1078 return loopAndDom->isLoopHeader(bb);
1079 }
1080
1081 inline bool dominate(const SVFBasicBlock* bbKey, const SVFBasicBlock* bbValue) const
1082 {
1084 }
1085
1086 inline bool postDominate(const SVFBasicBlock* bbKey, const SVFBasicBlock* bbValue) const
1087 {
1089 }
1090
1092 {
1093 if(realDefFun==nullptr)
1094 return this;
1095 return realDefFun;
1096 }
1097
1099 {
1100 this->bbGraph = graph;
1101 }
1102
1104 {
1105 return bbGraph;
1106 }
1107
1109 {
1110 return bbGraph;
1111 }
1112
1113 inline bool hasBasicBlock() const
1114 {
1115 return bbGraph && bbGraph->begin() != bbGraph->end();
1116 }
1117
1118 inline const SVFBasicBlock* getEntryBlock() const
1119 {
1120 assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
1121 assert(bbGraph->begin()->second->getInEdges().size() == 0 && "the first basic block is not entry block");
1122 return bbGraph->begin()->second;
1123 }
1124
1125 inline const SVFBasicBlock* getExitBB() const
1126 {
1127 assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
1128 assert(exitBlock && "must have an exitBlock");
1129 return exitBlock;
1130 }
1131
1133 {
1134 assert(!exitBlock && "have already set exit Basicblock!");
1135 exitBlock = bb;
1136 }
1137
1138
1139 u32_t inline arg_size() const
1140 {
1141 return allArgs.size();
1142 }
1143
1144 inline const ArgValVar* getArg(u32_t idx) const
1145 {
1146 assert (idx < allArgs.size() && "getArg() out of range!");
1147 return allArgs[idx];
1148 }
1149
1150 inline const SVFBasicBlock* front() const
1151 {
1152 return getEntryBlock();
1153 }
1154
1155 inline const SVFBasicBlock* back() const
1156 {
1157 assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
1161 return std::prev(bbGraph->end())->second;
1162 }
1163
1165 {
1166 return bbGraph->begin();
1167 }
1168
1169 inline const_bb_iterator end() const
1170 {
1171 return bbGraph->end();
1172 }
1173
1174 virtual bool isIsolatedNode() const;
1175
1176 virtual const std::string toString() const;
1177};
1178class FunValVar : public ValVar
1179{
1180
1181private:
1183
1184public:
1186
1187 static inline bool classof(const FunValVar*)
1188 {
1189 return true;
1190 }
1191 static inline bool classof(const ValVar* node)
1192 {
1193 return node->getNodeKind() == FunValNode;
1194 }
1195 static inline bool classof(const SVFVar* node)
1196 {
1197 return node->getNodeKind() == FunValNode;
1198 }
1199 static inline bool classof(const GenericPAGNodeTy* node)
1200 {
1201 return node->getNodeKind() == FunValNode;
1202 }
1203 static inline bool classof(const SVFValue* node)
1204 {
1205 return node->getNodeKind() == FunValNode;
1206 }
1208
1209 inline virtual const FunObjVar* getFunction() const
1210 {
1211 return funObjVar->getFunction();
1212 }
1213
1215 FunValVar(NodeID i, const ICFGNode* icn, const FunObjVar* cgn, const SVFType* svfType);
1216
1217
1218 virtual bool isPointer() const
1219 {
1220 return true;
1221 }
1222
1223 virtual const std::string toString() const;
1224};
1225
1226
1227
1228class GlobalValVar : public ValVar
1229{
1230
1231public:
1233
1234 static inline bool classof(const GlobalValVar*)
1235 {
1236 return true;
1237 }
1238 static inline bool classof(const ValVar* node)
1239 {
1240 return node->getNodeKind() == GlobalValNode;
1241 }
1242 static inline bool classof(const SVFVar* node)
1243 {
1244 return node->getNodeKind() == GlobalValNode;
1245 }
1246 static inline bool classof(const GenericPAGNodeTy* node)
1247 {
1248 return node->getNodeKind() == GlobalValNode;
1249 }
1250 static inline bool classof(const SVFValue* node)
1251 {
1252 return node->getNodeKind() == GlobalValNode;
1253 }
1255
1259 {
1260 type = svfType;
1261 }
1262
1263
1264 virtual const std::string toString() const;
1265};
1266
1268{
1269
1270public:
1272
1273 static inline bool classof(const ConstAggValVar*)
1274 {
1275 return true;
1276 }
1277 static inline bool classof(const ValVar* node)
1278 {
1279 return node->getNodeKind() == ConstAggValNode;
1280 }
1281 static inline bool classof(const SVFVar* node)
1282 {
1283 return node->getNodeKind() == ConstAggValNode;
1284 }
1285 static inline bool classof(const GenericPAGNodeTy* node)
1286 {
1287 return node->getNodeKind() == ConstAggValNode;
1288 }
1289 static inline bool classof(const SVFValue* node)
1290 {
1291 return node->getNodeKind() == ConstAggValNode;
1292 }
1294
1298 {
1299 type = svfTy;
1300 }
1301
1302
1303 virtual bool isConstDataOrAggData() const
1304 {
1305 return true;
1306 }
1307
1309 {
1310 return true;
1311 }
1312
1313 virtual const std::string toString() const;
1314};
1315
1316
1318{
1319
1320public:
1322
1323 static inline bool classof(const ConstDataValVar*)
1324 {
1325 return true;
1326 }
1327 static inline bool classof(const ValVar* node)
1328 {
1329 return isConstantDataValVar(node->getNodeKind());
1330 }
1331 static inline bool classof(const SVFVar* node)
1332 {
1333 return isConstantDataValVar(node->getNodeKind());
1334 }
1335 static inline bool classof(const GenericPAGNodeTy* node)
1336 {
1337 return isConstantDataValVar(node->getNodeKind());
1338 }
1339 static inline bool classof(const SVFValue* node)
1340 {
1341 return isConstantDataValVar(node->getNodeKind());
1342 }
1344
1348 : ValVar(i, svfType, icn, ty)
1349 {
1350
1351 }
1352
1353 virtual bool isConstDataOrAggData() const
1354 {
1355 return true;
1356 }
1357
1359 {
1360 return true;
1361 }
1362
1363 virtual const std::string toString() const;
1364};
1365
1367{
1368
1369public:
1371
1372 static inline bool classof(const BlackHoleValVar*)
1373 {
1374 return true;
1375 }
1376 static inline bool classof(const ConstDataValVar* node)
1377 {
1378 return node->getNodeKind() == BlackHoleValNode;
1379 }
1380 static inline bool classof(const ValVar* node)
1381 {
1382 return node->getNodeKind() == BlackHoleValNode;
1383 }
1384 static inline bool classof(const SVFVar* node)
1385 {
1386 return node->getNodeKind() == BlackHoleValNode;
1387 }
1388 static inline bool classof(const GenericPAGNodeTy* node)
1389 {
1390 return node->getNodeKind() == BlackHoleValNode;
1391 }
1392 static inline bool classof(const SVFValue* node)
1393 {
1394 return node->getNodeKind() == BlackHoleValNode;
1395 }
1397
1404
1406 {
1407 return false;
1408 }
1409
1410 virtual const std::string toString() const
1411 {
1412 return "BlackHoleValVar";
1413 }
1414};
1415
1417{
1418
1419private:
1420 double dval;
1421
1422public:
1424
1425 static inline bool classof(const ConstFPValVar*)
1426 {
1427 return true;
1428 }
1429 static inline bool classof(const ConstDataValVar* node)
1430 {
1431 return node->getNodeKind() == ConstFPValNode;
1432 }
1433 static inline bool classof(const ValVar* node)
1434 {
1435 return node->getNodeKind() == ConstFPValNode;
1436 }
1437 static inline bool classof(const SVFVar* node)
1438 {
1439 return node->getNodeKind() == ConstFPValNode;
1440 }
1441 static inline bool classof(const GenericPAGNodeTy* node)
1442 {
1443 return node->getNodeKind() == ConstFPValNode;
1444 }
1445 static inline bool classof(const SVFValue* node)
1446 {
1447 return node->getNodeKind() == ConstFPValNode;
1448 }
1450
1451 inline double getFPValue() const
1452 {
1453 return dval;
1454 }
1455
1458 const ICFGNode* icn, const SVFType* svfType)
1460 {
1461 }
1462
1463 virtual const std::string toString() const;
1464};
1465
1467{
1468
1469private:
1472
1473public:
1475
1476 static inline bool classof(const ConstIntValVar*)
1477 {
1478 return true;
1479 }
1480 static inline bool classof(const ConstDataValVar* node)
1481 {
1482 return node->getNodeKind() == ConstIntValNode;
1483 }
1484 static inline bool classof(const ValVar* node)
1485 {
1486 return node->getNodeKind() == ConstIntValNode;
1487 }
1488 static inline bool classof(const SVFVar* node)
1489 {
1490 return node->getNodeKind() == ConstIntValNode;
1491 }
1492 static inline bool classof(const GenericPAGNodeTy* node)
1493 {
1494 return node->getNodeKind() == ConstIntValNode;
1495 }
1496 static inline bool classof(const SVFValue* node)
1497 {
1498 return node->getNodeKind() == ConstIntValNode;
1499 }
1501
1503 {
1504 return sval;
1505 }
1506
1507
1509 {
1510 return zval;
1511 }
1512
1519 virtual const std::string toString() const;
1520};
1521
1523{
1524
1525public:
1527
1528 static inline bool classof(const ConstNullPtrValVar*)
1529 {
1530 return true;
1531 }
1532 static inline bool classof(const ConstDataValVar* node)
1533 {
1534 return node->getNodeKind() == ConstNullptrValNode;
1535 }
1536 static inline bool classof(const ValVar* node)
1537 {
1538 return node->getNodeKind() == ConstNullptrValNode;
1539 }
1540 static inline bool classof(const SVFVar* node)
1541 {
1542 return node->getNodeKind() == ConstNullptrValNode;
1543 }
1544 static inline bool classof(const GenericPAGNodeTy* node)
1545 {
1546 return node->getNodeKind() == ConstNullptrValNode;
1547 }
1548 static inline bool classof(const SVFValue* node)
1549 {
1550 return node->getNodeKind() == ConstNullptrValNode;
1551 }
1553
1560
1562 {
1563 return false;
1564 }
1565
1566 virtual const std::string toString() const;
1567};
1568
1570{
1571
1572public:
1574
1575 static inline bool classof(const GlobalObjVar*)
1576 {
1577 return true;
1578 }
1579 static inline bool classof(const BaseObjVar* node)
1580 {
1581 return node->getNodeKind() == GlobalObjNode;
1582 }
1583 static inline bool classof(const ObjVar* node)
1584 {
1585 return node->getNodeKind() == GlobalObjNode;
1586 }
1587 static inline bool classof(const SVFVar* node)
1588 {
1589 return node->getNodeKind() == GlobalObjNode;
1590 }
1591 static inline bool classof(const GenericPAGNodeTy* node)
1592 {
1593 return node->getNodeKind() == GlobalObjNode;
1594 }
1595 static inline bool classof(const SVFValue* node)
1596 {
1597 return node->getNodeKind() == GlobalObjNode;
1598 }
1600
1604 {
1605
1606 }
1607
1608
1609 virtual const std::string toString() const;
1610};
1611
1613{
1614
1615public:
1617
1618 static inline bool classof(const ConstAggObjVar*)
1619 {
1620 return true;
1621 }
1622 static inline bool classof(const BaseObjVar* node)
1623 {
1624 return node->getNodeKind() == ConstAggObjNode;
1625 }
1626
1627 static inline bool classof(const ObjVar* node)
1628 {
1629 return node->getNodeKind() == ConstAggObjNode;
1630 }
1631 static inline bool classof(const SVFVar* node)
1632 {
1633 return node->getNodeKind() == ConstAggObjNode;
1634 }
1635 static inline bool classof(const GenericPAGNodeTy* node)
1636 {
1637 return node->getNodeKind() == ConstAggObjNode;
1638 }
1639 static inline bool classof(const SVFValue* node)
1640 {
1641 return node->getNodeKind() == ConstAggObjNode;
1642 }
1644
1648 {
1649
1650 }
1651
1652 virtual bool isConstDataOrAggData() const
1653 {
1654 return true;
1655 }
1656
1658 {
1659 return true;
1660 }
1661
1662 virtual const std::string toString() const;
1663};
1664
1666{
1667
1668public:
1670 static inline bool classof(const ConstDataObjVar*)
1671 {
1672 return true;
1673 }
1674 static inline bool classof(const BaseObjVar* node)
1675 {
1676 return isConstantDataObjVarKinds(node->getNodeKind());
1677 }
1678 static inline bool classof(const SVFVar* node)
1679 {
1680 return isConstantDataObjVarKinds(node->getNodeKind());
1681 }
1682 static inline bool classof(const ObjVar* node)
1683 {
1684 return isConstantDataObjVarKinds(node->getNodeKind());
1685 }
1686 static inline bool classof(const GenericPAGNodeTy* node)
1687 {
1688 return isConstantDataObjVarKinds(node->getNodeKind());
1689 }
1690
1691 static inline bool classof(const SVFValue* node)
1692 {
1693 return isConstantDataObjVarKinds(node->getNodeKind());
1694 }
1696
1699 : BaseObjVar(i, ti, svfType, node, ty)
1700 {
1701 }
1702
1703 virtual bool isConstDataOrAggData() const
1704 {
1705 return true;
1706 }
1707
1709 {
1710 return true;
1711 }
1712
1713 virtual const std::string toString() const;
1714};
1715
1717{
1718
1719private:
1720 float dval;
1721
1722public:
1724 static inline bool classof(const ConstFPObjVar*)
1725 {
1726 return true;
1727 }
1728 static inline bool classof(const ConstDataObjVar* node)
1729 {
1730 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1731 }
1732 static inline bool classof(const BaseObjVar* node)
1733 {
1734 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1735 }
1736
1737 static inline bool classof(const SVFVar* node)
1738 {
1739 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1740 }
1741
1742 static inline bool classof(const ObjVar* node)
1743 {
1744 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1745 }
1746
1747 static inline bool classof(const GenericPAGNodeTy* node)
1748 {
1749 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1750 }
1751
1752 static inline bool classof(const SVFValue* node)
1753 {
1754 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1755 }
1757
1761 {
1762 }
1763
1764 inline double getFPValue() const
1765 {
1766 return dval;
1767 }
1768
1769
1770 virtual const std::string toString() const;
1771};
1772
1774{
1775
1776private:
1779
1780public:
1782 static inline bool classof(const ConstIntObjVar*)
1783 {
1784 return true;
1785 }
1786
1787 static inline bool classof(const ConstDataObjVar* node)
1788 {
1789 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1790 }
1791
1792 static inline bool classof(const BaseObjVar* node)
1793 {
1794 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1795 }
1796
1797 static inline bool classof(const SVFVar* node)
1798 {
1799 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1800 }
1801 static inline bool classof(const ObjVar* node)
1802 {
1803 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1804 }
1805 static inline bool classof(const GenericPAGNodeTy* node)
1806 {
1807 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1808 }
1809
1810 static inline bool classof(const SVFValue* node)
1811 {
1812 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1813 }
1814
1816 {
1817 return sval;
1818 }
1819
1820
1822 {
1823 return zval;
1824 }
1826
1832
1833
1834 virtual const std::string toString() const;
1835};
1836
1838{
1839
1840public:
1842 static inline bool classof(const ConstNullPtrObjVar*)
1843 {
1844 return true;
1845 }
1846
1847 static inline bool classof(const ConstDataObjVar* node)
1848 {
1849 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1850 }
1851
1852 static inline bool classof(const BaseObjVar* node)
1853 {
1854 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1855 }
1856
1857 static inline bool classof(const SVFVar* node)
1858 {
1859 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1860 }
1861 static inline bool classof(const ObjVar* node)
1862 {
1863 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1864 }
1865 static inline bool classof(const GenericPAGNodeTy* node)
1866 {
1867 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1868 }
1869
1870 static inline bool classof(const SVFValue* node)
1871 {
1872 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1873 }
1875
1882 {
1883 return false;
1884 }
1885 virtual const std::string toString() const;
1886};
1887/*
1888 * Unique Return node of a procedure
1889 */
1890class RetValPN : public ValVar
1891{
1892
1893private:
1895
1896public:
1898 static inline bool classof(const RetValPN*)
1899 {
1900 return true;
1901 }
1902 static inline bool classof(const SVFVar* node)
1903 {
1904 return node->getNodeKind() == SVFVar::RetValNode;
1905 }
1906 static inline bool classof(const ValVar* node)
1907 {
1908 return node->getNodeKind() == SVFVar::RetValNode;
1909 }
1910 static inline bool classof(const GenericPAGNodeTy* node)
1911 {
1912 return node->getNodeKind() == SVFVar::RetValNode;
1913 }
1914 static inline bool classof(const SVFValue* node)
1915 {
1916 return node->getNodeKind() == SVFVar::RetValNode;
1917 }
1919
1920
1922 RetValPN(NodeID i, const FunObjVar* node, const SVFType* svfType, const ICFGNode* icn);
1923
1924 inline const FunObjVar* getCallGraphNode() const
1925 {
1926 return callGraphNode;
1927 }
1928
1929 virtual const FunObjVar* getFunction() const;
1930
1931 virtual bool isPointer() const;
1932
1934 const std::string getValueName() const;
1935
1936 virtual const std::string toString() const;
1937};
1938
1939/*
1940 * Unique vararg node of a procedure
1941 */
1942class VarArgValPN : public ValVar
1943{
1944
1945private:
1947
1948public:
1950 static inline bool classof(const VarArgValPN*)
1951 {
1952 return true;
1953 }
1954 static inline bool classof(const SVFVar* node)
1955 {
1956 return node->getNodeKind() == SVFVar::VarargValNode;
1957 }
1958 static inline bool classof(const ValVar* node)
1959 {
1960 return node->getNodeKind() == SVFVar::VarargValNode;
1961 }
1962 static inline bool classof(const GenericPAGNodeTy* node)
1963 {
1964 return node->getNodeKind() == SVFVar::VarargValNode;
1965 }
1966 static inline bool classof(const SVFValue* node)
1967 {
1968 return node->getNodeKind() == SVFVar::VarargValNode;
1969 }
1971
1973 VarArgValPN(NodeID i, const FunObjVar* node, const SVFType* svfType, const ICFGNode* icn)
1975 {
1976 }
1977
1978 virtual const FunObjVar* getFunction() const;
1979
1981 const std::string getValueName() const;
1982
1983 virtual bool isPointer() const
1984 {
1985 return true;
1986 }
1987 virtual const std::string toString() const;
1988};
1989
1990/*
1991 * Dummy variable without any LLVM value
1992 */
1993class DummyValVar: public ValVar
1994{
1995
1996public:
1998 static inline bool classof(const DummyValVar*)
1999 {
2000 return true;
2001 }
2002 static inline bool classof(const SVFVar* node)
2003 {
2004 return node->getNodeKind() == SVFVar::DummyValNode;
2005 }
2006 static inline bool classof(const ValVar* node)
2007 {
2008 return node->getNodeKind() == SVFVar::DummyValNode;
2009 }
2010 static inline bool classof(const GenericPAGNodeTy* node)
2011 {
2012 return node->getNodeKind() == SVFVar::DummyValNode;
2013 }
2014 static inline bool classof(const SVFValue* node)
2015 {
2016 return node->getNodeKind() == SVFVar::DummyValNode;
2017 }
2019
2022 : ValVar(i, svfType, node, DummyValNode)
2023 {
2024 }
2025
2027 inline const std::string getValueName() const
2028 {
2029 return "dummyVal";
2030 }
2031
2032 virtual bool isPointer() const
2033 {
2034 return true;
2035 }
2036
2037 virtual const std::string toString() const;
2038};
2039
2040/*
2041 * Dummy object variable
2042 */
2044{
2045
2046public:
2048 static inline bool classof(const DummyObjVar*)
2049 {
2050 return true;
2051 }
2052 static inline bool classof(const BaseObjVar* node)
2053 {
2054 return node->getNodeKind() == SVFVar::DummyObjNode;
2055 }
2056 static inline bool classof(const SVFVar* node)
2057 {
2058 return node->getNodeKind() == SVFVar::DummyObjNode;
2059 }
2060 static inline bool classof(const ObjVar* node)
2061 {
2062 return node->getNodeKind() == SVFVar::DummyObjNode;
2063 }
2064 static inline bool classof(const GenericPAGNodeTy* node)
2065 {
2066 return node->getNodeKind() == SVFVar::DummyObjNode;
2067 }
2068
2069 static inline bool classof(const SVFValue* node)
2070 {
2071 return node->getNodeKind() == SVFVar::DummyObjNode;
2072 }
2074
2080
2082 inline const std::string getValueName() const
2083 {
2084 return "dummyObj";
2085 }
2086
2087 virtual bool isPointer() const
2088 {
2089 return true;
2090 }
2091
2092 virtual const std::string toString() const;
2093};
2094
2095} // End namespace SVF
2096
2097#endif /* INCLUDE_SVFIR_SVFVARIABLE_H_ */
APOffset getConstantStructFldIdx() const
Get methods.
Definition AccessPath.h:97
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)
static bool classof(const SVFVar *node)
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
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.
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
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.
ObjTypeInfo * typeInfo
BaseObjVar(NodeID i, ObjTypeInfo *ti, const SVFType *svfType, const ICFGNode *node, PNODEK ty=BaseObjNode)
Constructor.
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.
bool isConstantArray() const
static bool classof(const GenericPAGNodeTy *node)
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)
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.
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)
ConstAggObjVar(NodeID i, ObjTypeInfo *ti, const SVFType *svfType, const ICFGNode *node)
Constructor.
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)
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.
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)
virtual bool isConstDataOrAggData() const
Check if this variable represents constant/aggregate data.
static bool classof(const ConstDataObjVar *)
static bool classof(const SVFVar *node)
ConstDataObjVar(NodeID i, ObjTypeInfo *ti, const SVFType *svfType, const ICFGNode *node, PNODEK ty=ConstDataObjNode)
Constructor.
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.
static bool classof(const SVFVar *node)
virtual bool isConstDataOrAggData() const
Check if this variable represents constant/aggregate data.
static bool classof(const ObjVar *node)
ConstFPObjVar(NodeID i, double dv, ObjTypeInfo *ti, const SVFType *svfType, const ICFGNode *node)
Constructor.
static bool classof(const BaseObjVar *node)
static bool classof(const ConstFPObjVar *)
virtual const std::string toString() const
Get string representation.
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)
double getFPValue() const
ConstFPValVar(NodeID i, double dv, const ICFGNode *icn, const SVFType *svfType)
Constructor.
ConstIntObjVar(NodeID i, s64_t sv, u64_t zv, ObjTypeInfo *ti, const SVFType *svfType, const ICFGNode *node)
Constructor.
virtual const std::string toString() const
Get string representation.
static bool classof(const SVFValue *node)
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
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)
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)
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.
ConstNullPtrObjVar(NodeID i, ObjTypeInfo *ti, const SVFType *svfType, const ICFGNode *node)
Constructor.
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, const SVFType *svfType=SVFType::getSVFPtrType())
Constructor.
static bool classof(const ObjVar *node)
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.
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
const BasicBlockGraph * getBasicBlockGraph() const
const ArgValVar * getArg(u32_t idx) const
virtual const std::string toString() const
Get string representation.
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)
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)
static bool classof(const GenericPAGNodeTy *node)
const SVFFunctionType * funcType
return true if this function supports variable arguments
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)
const FunObjVar * funObjVar
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.
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)
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.
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.
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)
GlobalObjVar(NodeID i, ObjTypeInfo *ti, const SVFType *svfType, const ICFGNode *node, PNODEK ty=GlobalObjNode)
Constructor.
static bool classof(const BaseObjVar *node)
static bool classof(const GenericPAGNodeTy *node)
virtual const std::string toString() const
Get string representation.
static bool classof(const SVFVar *node)
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)
static bool classof(const SVFValue *node)
static bool classof(const SVFVar *node)
Class representing a heap object variable in the SVFIR.
HeapObjVar(NodeID i, ObjTypeInfo *ti, const SVFType *svfType, const ICFGNode *node)
Constructor.
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)
static bool classof(const SVFValue *node)
const std::string getValueName() const
Return name of a LLVM value.
static bool classof(const ObjVar *node)
virtual const std::string toString() const
Get string representation.
static bool classof(const BaseObjVar *node)
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:96
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)
static bool classof(const SVFVar *node)
ObjVar(NodeID i, const SVFType *svfType, PNODEK ty=ObjNode)
Constructor.
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
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.
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:335
const LoopBBs & getLoopInfo(const SVFBasicBlock *bb) const
Definition SVFValue.cpp:70
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:96
bool isLoopHeader(const SVFBasicBlock *bb) const
Definition SVFValue.cpp:183
void getExitBlocksOfLoop(const SVFBasicBlock *bb, BBList &exitbbs) const
Definition SVFValue.cpp:77
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:127
GenericNode< SVFVar, SVFStmt >::GEdgeSetTy SVFStmtSetTy
PAGEdgeToSetMapTy KindToSVFStmtMapTy
static SVFType * getSVFPtrType()
Definition SVFType.h:175
bool isPointerTy() const
Definition SVFType.h:251
@ ConstNullptrObjNode
Definition SVFValue.h:99
@ ConstNullptrValNode
Definition SVFValue.h:80
static bool isConstantDataValVar(GNodeK n)
Definition SVFValue.h:248
static bool isObjVarKinds(GNodeK n)
Definition SVFValue.h:256
static bool isBaseObjVarKinds(GNodeK n)
Definition SVFValue.h:264
GNodeK getNodeKind() const
Get node kind.
Definition SVFValue.h:166
NodeID id
Node ID.
Definition SVFValue.h:205
virtual const std::string & getName() const
Definition SVFValue.h:186
static bool isConstantDataObjVarKinds(GNodeK n)
Definition SVFValue.h:272
static bool isValVarKinds(GNodeK n)
Definition SVFValue.h:239
static bool isSVFVarKind(GNodeK n)
Definition SVFValue.h:230
const SVFType * type
SVF type.
Definition SVFValue.h:207
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.
SVFVar(NodeID i, PNODEK k)
Empty constructor for deserialization.
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
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
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)
StackObjVar(NodeID i, ObjTypeInfo *ti, const SVFType *svfType, const ICFGNode *node)
Constructor.
static bool classof(const ObjVar *node)
static bool classof(const BaseObjVar *node)
static bool classof(const GenericPAGNodeTy *node)
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)
ValVar(NodeID i, const SVFType *svfType, const ICFGNode *node, PNODEK ty=ValNode)
Constructor.
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.
virtual const FunObjVar * getFunction() const
Get containing function, or null for globals/constants.
static bool classof(const ValVar *node)
for isBitcode
Definition BasicTypes.h:68
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:74
unsigned u32_t
Definition GeneralType.h:47
signed long long s64_t
Definition GeneralType.h:50