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 : ObjVar(i, ti->getType(), ty), typeInfo(ti), icfgNode(node)
538 {
539 }
540
541 virtual const BaseObjVar* getBaseMemObj() const
542 {
543 return this;
544 }
545
547 inline const ICFGNode* getICFGNode() const
548 {
549 return icfgNode;
550 }
551
553 inline const std::string getValueName() const
554 {
555 return getName() + " (base object)";
556 }
557
558 virtual const std::string toString() const;
559
561 inline NodeID getId() const
562 {
563 return id;
564 }
565
568 {
569 return typeInfo->getNumOfElements();
570 }
571
574 {
576 }
577
583
584
587 {
588 return getMaxFieldOffsetLimit() == 0;
589 }
590
596
597
603
605 bool isBlackHoleObj() const;
606
609 {
610 return typeInfo->getByteSizeOfObj();
611 }
612
615 {
617 }
618
619
621
622 bool isFunction() const
623 {
624 return typeInfo->isFunction();
625 }
626 bool isGlobalObj() const
627 {
628 return typeInfo->isGlobalObj();
629 }
630 bool isStaticObj() const
631 {
632 return typeInfo->isStaticObj();
633 }
634 bool isStack() const
635 {
636 return typeInfo->isStack();
637 }
638 bool isHeap() const
639 {
640 return typeInfo->isHeap();
641 }
642 bool isStruct() const
643 {
644 return typeInfo->isStruct();
645 }
646 bool isArray() const
647 {
648 return typeInfo->isArray();
649 }
650 bool isVarStruct() const
651 {
652 return typeInfo->isVarStruct();
653 }
654 bool isVarArray() const
655 {
656 return typeInfo->isVarArray();
657 }
658 bool isConstantStruct() const
659 {
660 return typeInfo->isConstantStruct();
661 }
662 bool isConstantArray() const
663 {
664 return typeInfo->isConstantArray();
665 }
667 {
669 }
670 virtual inline bool isConstDataOrAggData() const
671 {
673 }
675
677 void destroy()
678 {
679 delete typeInfo;
680 typeInfo = nullptr;
681 }
682
683 virtual const FunObjVar* getFunction() const;
684
685};
686
687
688/*
689 * Gep Obj variable, this is dynamic generated for field sensitive analysis
690 * Each gep obj variable is one field of a BaseObjVar (base)
691 */
692class GepObjVar: public ObjVar
693{
694
695private:
697
699
700public:
702
703 static inline bool classof(const GepObjVar*)
704 {
705 return true;
706 }
707 static inline bool classof(const ObjVar* node)
708 {
709 return node->getNodeKind() == SVFVar::GepObjNode;
710 }
711 static inline bool classof(const SVFVar* node)
712 {
713 return node->getNodeKind() == SVFVar::GepObjNode;
714 }
715 static inline bool classof(const GenericPAGNodeTy* node)
716 {
717 return node->getNodeKind() == SVFVar::GepObjNode;
718 }
719 static inline bool classof(const SVFValue* node)
720 {
721 return node->getNodeKind() == SVFVar::GepObjNode;
722 }
724
731
734 {
735 return apOffset;
736 }
737
739 inline NodeID getBaseNode(void) const
740 {
741 return base->getId();
742 }
743
744 inline const BaseObjVar* getBaseObj() const
745 {
746 return base;
747 }
748
750 inline virtual const SVFType* getType() const;
751
752
754 inline const std::string getValueName() const
755 {
756 return getName() + "_" + std::to_string(apOffset);
757 }
758
759 virtual const FunObjVar* getFunction() const
760 {
761 return base->getFunction();
762 }
763
764 virtual const std::string toString() const;
765
766 virtual inline bool ptrInUncalledFunction() const
767 {
768 return base->ptrInUncalledFunction();
769 }
770
771 virtual inline bool isConstDataOrAggData() const
772 {
773 return base->isConstDataOrAggData();
774 }
775
777 {
779 }
780
781 virtual bool isPointer() const
782 {
783 return base->isPointer();
784 }
785};
786
787
788
796{
797
798public:
800
801 static inline bool classof(const HeapObjVar*)
802 {
803 return true;
804 }
805 static inline bool classof(const BaseObjVar* node)
806 {
807 return node->getNodeKind() == HeapObjNode;
808 }
809 static inline bool classof(const ObjVar* node)
810 {
811 return node->getNodeKind() == HeapObjNode;
812 }
813 static inline bool classof(const SVFVar* node)
814 {
815 return node->getNodeKind() == HeapObjNode;
816 }
817 static inline bool classof(const GenericPAGNodeTy* node)
818 {
819 return node->getNodeKind() == HeapObjNode;
820 }
821 static inline bool classof(const SVFValue* node)
822 {
823 return node->getNodeKind() == HeapObjNode;
824 }
826
829 BaseObjVar(i, ti, node, HeapObjNode)
830 {
831 }
832
834 inline const std::string getValueName() const
835 {
836 return " (heap base object)";
837 }
838
839 virtual const std::string toString() const;
840};
841
842
852{
853
854public:
856
857 static inline bool classof(const StackObjVar*)
858 {
859 return true;
860 }
861 static inline bool classof(const BaseObjVar* node)
862 {
863 return node->getNodeKind() == StackObjNode;
864 }
865 static inline bool classof(const ObjVar* node)
866 {
867 return node->getNodeKind() == StackObjNode;
868 }
869 static inline bool classof(const SVFVar* node)
870 {
871 return node->getNodeKind() == StackObjNode;
872 }
873 static inline bool classof(const GenericPAGNodeTy* node)
874 {
875 return node->getNodeKind() == StackObjNode;
876 }
877 static inline bool classof(const SVFValue* node)
878 {
879 return node->getNodeKind() == StackObjNode;
880 }
882
885 BaseObjVar(i, ti, node, StackObjNode)
886 {
887 }
888
890 inline const std::string getValueName() const
891 {
892 return " (stack base object)";
893 }
894
895 virtual const std::string toString() const;
896};
897
898
899class CallGraphNode;
900
901class FunObjVar : public BaseObjVar
902{
903 friend class SVFIRBuilder;
904 friend class LLVMModuleSet;
905
906public:
910
911 typedef BasicBlockGraph::IDToNodeMapTy::const_iterator const_bb_iterator;
912
913
914private:
915 bool isDecl;
919 bool isNotRet;
925 std::vector<const ArgValVar*> allArgs;
927
928public:
930
931 static inline bool classof(const FunObjVar*)
932 {
933 return true;
934 }
935 static inline bool classof(const BaseObjVar* node)
936 {
937 return node->getNodeKind() == FunObjNode;
938 }
939 static inline bool classof(const ObjVar* node)
940 {
941 return node->getNodeKind() == FunObjNode;
942 }
943 static inline bool classof(const SVFVar* node)
944 {
945 return node->getNodeKind() == FunObjNode;
946 }
947 static inline bool classof(const GenericPAGNodeTy* node)
948 {
949 return node->getNodeKind() == FunObjNode;
950 }
951 static inline bool classof(const SVFValue* node)
952 {
953 return node->getNodeKind() == FunObjNode;
954 }
956
958 FunObjVar(NodeID i, ObjTypeInfo* ti, const ICFGNode* node);
959
960
961 virtual ~FunObjVar()
962 {
963 delete loopAndDom;
964 delete bbGraph;
965 }
966
967 void initFunObjVar(bool decl, bool intrinc, bool addr, bool uncalled, bool notret, bool vararg, const SVFFunctionType *ft,
969 const std::vector<const ArgValVar *> &allarg, const SVFBasicBlock *exit);
970
972 {
974 }
975
976 virtual const FunObjVar*getFunction() const;
977
978 inline void addArgument(const ArgValVar *arg)
979 {
980 allArgs.push_back(arg);
981 }
982 inline bool isDeclaration() const
983 {
984 return isDecl;
985 }
986
987 inline bool isIntrinsic() const
988 {
989 return intrinsic;
990 }
991
992 inline bool hasAddressTaken() const
993 {
994 return isAddrTaken;
995 }
996
997 inline bool isVarArg() const
998 {
999 return supVarArg;
1000 }
1001
1002 inline bool isUncalledFunction() const
1003 {
1004 return isUncalled;
1005 }
1006
1007 inline bool hasReturn() const
1008 {
1009 return !isNotRet;
1010 }
1011
1013 inline const SVFFunctionType* getFunctionType() const
1014 {
1015 return funcType;
1016 }
1017
1019 inline const SVFType* getReturnType() const
1020 {
1021 return funcType->getReturnType();
1022 }
1023
1025 {
1026 return loopAndDom;
1027 }
1028
1029 inline const std::vector<const SVFBasicBlock*>& getReachableBBs() const
1030 {
1031 return loopAndDom->getReachableBBs();
1032 }
1033
1034 inline void getExitBlocksOfLoop(const SVFBasicBlock* bb, BBList& exitbbs) const
1035 {
1037 }
1038
1039 inline bool hasLoopInfo(const SVFBasicBlock* bb) const
1040 {
1041 return loopAndDom->hasLoopInfo(bb);
1042 }
1043
1044 const LoopBBs& getLoopInfo(const SVFBasicBlock* bb) const
1045 {
1046 return loopAndDom->getLoopInfo(bb);
1047 }
1048
1049 inline const SVFBasicBlock* getLoopHeader(const BBList& lp) const
1050 {
1051 return loopAndDom->getLoopHeader(lp);
1052 }
1053
1054 inline bool loopContainsBB(const BBList& lp, const SVFBasicBlock* bb) const
1055 {
1056 return loopAndDom->loopContainsBB(lp,bb);
1057 }
1058
1060 {
1061 return loopAndDom->getDomTreeMap();
1062 }
1063
1065 {
1066 return loopAndDom->getDomFrontierMap();
1067 }
1068
1069 inline bool isLoopHeader(const SVFBasicBlock* bb) const
1070 {
1071 return loopAndDom->isLoopHeader(bb);
1072 }
1073
1074 inline bool dominate(const SVFBasicBlock* bbKey, const SVFBasicBlock* bbValue) const
1075 {
1077 }
1078
1079 inline bool postDominate(const SVFBasicBlock* bbKey, const SVFBasicBlock* bbValue) const
1080 {
1082 }
1083
1085 {
1086 if(realDefFun==nullptr)
1087 return this;
1088 return realDefFun;
1089 }
1090
1092 {
1093 this->bbGraph = graph;
1094 }
1095
1097 {
1098 return bbGraph;
1099 }
1100
1102 {
1103 return bbGraph;
1104 }
1105
1106 inline bool hasBasicBlock() const
1107 {
1108 return bbGraph && bbGraph->begin() != bbGraph->end();
1109 }
1110
1111 inline const SVFBasicBlock* getEntryBlock() const
1112 {
1113 assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
1114 assert(bbGraph->begin()->second->getInEdges().size() == 0 && "the first basic block is not entry block");
1115 return bbGraph->begin()->second;
1116 }
1117
1118 inline const SVFBasicBlock* getExitBB() const
1119 {
1120 assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
1121 assert(exitBlock && "must have an exitBlock");
1122 return exitBlock;
1123 }
1124
1126 {
1127 assert(!exitBlock && "have already set exit Basicblock!");
1128 exitBlock = bb;
1129 }
1130
1131
1132 u32_t inline arg_size() const
1133 {
1134 return allArgs.size();
1135 }
1136
1137 inline const ArgValVar* getArg(u32_t idx) const
1138 {
1139 assert (idx < allArgs.size() && "getArg() out of range!");
1140 return allArgs[idx];
1141 }
1142
1143 inline const SVFBasicBlock* front() const
1144 {
1145 return getEntryBlock();
1146 }
1147
1148 inline const SVFBasicBlock* back() const
1149 {
1150 assert(hasBasicBlock() && "function does not have any Basicblock, external function?");
1154 return std::prev(bbGraph->end())->second;
1155 }
1156
1158 {
1159 return bbGraph->begin();
1160 }
1161
1162 inline const_bb_iterator end() const
1163 {
1164 return bbGraph->end();
1165 }
1166
1167 virtual bool isIsolatedNode() const;
1168
1169 virtual const std::string toString() const;
1170};
1171class FunValVar : public ValVar
1172{
1173
1174private:
1176
1177public:
1179
1180 static inline bool classof(const FunValVar*)
1181 {
1182 return true;
1183 }
1184 static inline bool classof(const ValVar* node)
1185 {
1186 return node->getNodeKind() == FunValNode;
1187 }
1188 static inline bool classof(const SVFVar* node)
1189 {
1190 return node->getNodeKind() == FunValNode;
1191 }
1192 static inline bool classof(const GenericPAGNodeTy* node)
1193 {
1194 return node->getNodeKind() == FunValNode;
1195 }
1196 static inline bool classof(const SVFValue* node)
1197 {
1198 return node->getNodeKind() == FunValNode;
1199 }
1201
1202 inline virtual const FunObjVar* getFunction() const
1203 {
1204 return funObjVar->getFunction();
1205 }
1206
1208 FunValVar(NodeID i, const ICFGNode* icn, const FunObjVar* cgn, const SVFType* svfType);
1209
1210
1211 virtual bool isPointer() const
1212 {
1213 return true;
1214 }
1215
1216 virtual const std::string toString() const;
1217};
1218
1219
1220
1221class GlobalValVar : public ValVar
1222{
1223
1224public:
1226
1227 static inline bool classof(const GlobalValVar*)
1228 {
1229 return true;
1230 }
1231 static inline bool classof(const ValVar* node)
1232 {
1233 return node->getNodeKind() == GlobalValNode;
1234 }
1235 static inline bool classof(const SVFVar* node)
1236 {
1237 return node->getNodeKind() == GlobalValNode;
1238 }
1239 static inline bool classof(const GenericPAGNodeTy* node)
1240 {
1241 return node->getNodeKind() == GlobalValNode;
1242 }
1243 static inline bool classof(const SVFValue* node)
1244 {
1245 return node->getNodeKind() == GlobalValNode;
1246 }
1248
1252 {
1253 type = svfType;
1254 }
1255
1256
1257 virtual const std::string toString() const;
1258};
1259
1261{
1262
1263public:
1265
1266 static inline bool classof(const ConstAggValVar*)
1267 {
1268 return true;
1269 }
1270 static inline bool classof(const ValVar* node)
1271 {
1272 return node->getNodeKind() == ConstAggValNode;
1273 }
1274 static inline bool classof(const SVFVar* node)
1275 {
1276 return node->getNodeKind() == ConstAggValNode;
1277 }
1278 static inline bool classof(const GenericPAGNodeTy* node)
1279 {
1280 return node->getNodeKind() == ConstAggValNode;
1281 }
1282 static inline bool classof(const SVFValue* node)
1283 {
1284 return node->getNodeKind() == ConstAggValNode;
1285 }
1287
1291 {
1292 type = svfTy;
1293 }
1294
1295
1296 virtual bool isConstDataOrAggData() const
1297 {
1298 return true;
1299 }
1300
1302 {
1303 return true;
1304 }
1305
1306 virtual const std::string toString() const;
1307};
1308
1309
1311{
1312
1313public:
1315
1316 static inline bool classof(const ConstDataValVar*)
1317 {
1318 return true;
1319 }
1320 static inline bool classof(const ValVar* node)
1321 {
1322 return isConstantDataValVar(node->getNodeKind());
1323 }
1324 static inline bool classof(const SVFVar* node)
1325 {
1326 return isConstantDataValVar(node->getNodeKind());
1327 }
1328 static inline bool classof(const GenericPAGNodeTy* node)
1329 {
1330 return isConstantDataValVar(node->getNodeKind());
1331 }
1332 static inline bool classof(const SVFValue* node)
1333 {
1334 return isConstantDataValVar(node->getNodeKind());
1335 }
1337
1341 : ValVar(i, svfType, icn, ty)
1342 {
1343
1344 }
1345
1346 virtual bool isConstDataOrAggData() const
1347 {
1348 return true;
1349 }
1350
1352 {
1353 return true;
1354 }
1355
1356 virtual const std::string toString() const;
1357};
1358
1360{
1361
1362public:
1364
1365 static inline bool classof(const BlackHoleValVar*)
1366 {
1367 return true;
1368 }
1369 static inline bool classof(const ConstDataValVar* node)
1370 {
1371 return node->getNodeKind() == BlackHoleValNode;
1372 }
1373 static inline bool classof(const ValVar* node)
1374 {
1375 return node->getNodeKind() == BlackHoleValNode;
1376 }
1377 static inline bool classof(const SVFVar* node)
1378 {
1379 return node->getNodeKind() == BlackHoleValNode;
1380 }
1381 static inline bool classof(const GenericPAGNodeTy* node)
1382 {
1383 return node->getNodeKind() == BlackHoleValNode;
1384 }
1385 static inline bool classof(const SVFValue* node)
1386 {
1387 return node->getNodeKind() == BlackHoleValNode;
1388 }
1390
1397
1399 {
1400 return false;
1401 }
1402
1403 virtual const std::string toString() const
1404 {
1405 return "BlackHoleValVar";
1406 }
1407};
1408
1410{
1411
1412private:
1413 double dval;
1414
1415public:
1417
1418 static inline bool classof(const ConstFPValVar*)
1419 {
1420 return true;
1421 }
1422 static inline bool classof(const ConstDataValVar* node)
1423 {
1424 return node->getNodeKind() == ConstFPValNode;
1425 }
1426 static inline bool classof(const ValVar* node)
1427 {
1428 return node->getNodeKind() == ConstFPValNode;
1429 }
1430 static inline bool classof(const SVFVar* node)
1431 {
1432 return node->getNodeKind() == ConstFPValNode;
1433 }
1434 static inline bool classof(const GenericPAGNodeTy* node)
1435 {
1436 return node->getNodeKind() == ConstFPValNode;
1437 }
1438 static inline bool classof(const SVFValue* node)
1439 {
1440 return node->getNodeKind() == ConstFPValNode;
1441 }
1443
1444 inline double getFPValue() const
1445 {
1446 return dval;
1447 }
1448
1451 const ICFGNode* icn, const SVFType* svfType)
1453 {
1454 }
1455
1456 virtual const std::string toString() const;
1457};
1458
1460{
1461
1462private:
1465
1466public:
1468
1469 static inline bool classof(const ConstIntValVar*)
1470 {
1471 return true;
1472 }
1473 static inline bool classof(const ConstDataValVar* node)
1474 {
1475 return node->getNodeKind() == ConstIntValNode;
1476 }
1477 static inline bool classof(const ValVar* node)
1478 {
1479 return node->getNodeKind() == ConstIntValNode;
1480 }
1481 static inline bool classof(const SVFVar* node)
1482 {
1483 return node->getNodeKind() == ConstIntValNode;
1484 }
1485 static inline bool classof(const GenericPAGNodeTy* node)
1486 {
1487 return node->getNodeKind() == ConstIntValNode;
1488 }
1489 static inline bool classof(const SVFValue* node)
1490 {
1491 return node->getNodeKind() == ConstIntValNode;
1492 }
1494
1496 {
1497 return sval;
1498 }
1499
1500
1502 {
1503 return zval;
1504 }
1505
1512 virtual const std::string toString() const;
1513};
1514
1516{
1517
1518public:
1520
1521 static inline bool classof(const ConstNullPtrValVar*)
1522 {
1523 return true;
1524 }
1525 static inline bool classof(const ConstDataValVar* node)
1526 {
1527 return node->getNodeKind() == ConstNullptrValNode;
1528 }
1529 static inline bool classof(const ValVar* node)
1530 {
1531 return node->getNodeKind() == ConstNullptrValNode;
1532 }
1533 static inline bool classof(const SVFVar* node)
1534 {
1535 return node->getNodeKind() == ConstNullptrValNode;
1536 }
1537 static inline bool classof(const GenericPAGNodeTy* node)
1538 {
1539 return node->getNodeKind() == ConstNullptrValNode;
1540 }
1541 static inline bool classof(const SVFValue* node)
1542 {
1543 return node->getNodeKind() == ConstNullptrValNode;
1544 }
1546
1553
1555 {
1556 return false;
1557 }
1558
1559 virtual const std::string toString() const;
1560};
1561
1563{
1564
1565public:
1567
1568 static inline bool classof(const GlobalObjVar*)
1569 {
1570 return true;
1571 }
1572 static inline bool classof(const BaseObjVar* node)
1573 {
1574 return node->getNodeKind() == GlobalObjNode;
1575 }
1576 static inline bool classof(const ObjVar* node)
1577 {
1578 return node->getNodeKind() == GlobalObjNode;
1579 }
1580 static inline bool classof(const SVFVar* node)
1581 {
1582 return node->getNodeKind() == GlobalObjNode;
1583 }
1584 static inline bool classof(const GenericPAGNodeTy* node)
1585 {
1586 return node->getNodeKind() == GlobalObjNode;
1587 }
1588 static inline bool classof(const SVFValue* node)
1589 {
1590 return node->getNodeKind() == GlobalObjNode;
1591 }
1593
1596 PNODEK ty = GlobalObjNode): BaseObjVar(i, ti, node, ty)
1597 {
1598
1599 }
1600
1601
1602 virtual const std::string toString() const;
1603};
1604
1606{
1607
1608public:
1610
1611 static inline bool classof(const ConstAggObjVar*)
1612 {
1613 return true;
1614 }
1615 static inline bool classof(const BaseObjVar* node)
1616 {
1617 return node->getNodeKind() == ConstAggObjNode;
1618 }
1619
1620 static inline bool classof(const ObjVar* node)
1621 {
1622 return node->getNodeKind() == ConstAggObjNode;
1623 }
1624 static inline bool classof(const SVFVar* node)
1625 {
1626 return node->getNodeKind() == ConstAggObjNode;
1627 }
1628 static inline bool classof(const GenericPAGNodeTy* node)
1629 {
1630 return node->getNodeKind() == ConstAggObjNode;
1631 }
1632 static inline bool classof(const SVFValue* node)
1633 {
1634 return node->getNodeKind() == ConstAggObjNode;
1635 }
1637
1640 : BaseObjVar(i, ti, node, ConstAggObjNode)
1641 {
1642
1643 }
1644
1645 virtual bool isConstDataOrAggData() const
1646 {
1647 return true;
1648 }
1649
1651 {
1652 return true;
1653 }
1654
1655 virtual const std::string toString() const;
1656};
1657
1659{
1660
1661public:
1663 static inline bool classof(const ConstDataObjVar*)
1664 {
1665 return true;
1666 }
1667 static inline bool classof(const BaseObjVar* node)
1668 {
1669 return isConstantDataObjVarKinds(node->getNodeKind());
1670 }
1671 static inline bool classof(const SVFVar* node)
1672 {
1673 return isConstantDataObjVarKinds(node->getNodeKind());
1674 }
1675 static inline bool classof(const ObjVar* node)
1676 {
1677 return isConstantDataObjVarKinds(node->getNodeKind());
1678 }
1679 static inline bool classof(const GenericPAGNodeTy* node)
1680 {
1681 return isConstantDataObjVarKinds(node->getNodeKind());
1682 }
1683
1684 static inline bool classof(const SVFValue* node)
1685 {
1686 return isConstantDataObjVarKinds(node->getNodeKind());
1687 }
1689
1692 : BaseObjVar(i, ti, node, ty)
1693 {
1694 }
1695
1696 virtual bool isConstDataOrAggData() const
1697 {
1698 return true;
1699 }
1700
1702 {
1703 return true;
1704 }
1705
1706 virtual const std::string toString() const;
1707};
1708
1710{
1711
1712private:
1713 float dval;
1714
1715public:
1717 static inline bool classof(const ConstFPObjVar*)
1718 {
1719 return true;
1720 }
1721 static inline bool classof(const ConstDataObjVar* node)
1722 {
1723 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1724 }
1725 static inline bool classof(const BaseObjVar* node)
1726 {
1727 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1728 }
1729
1730 static inline bool classof(const SVFVar* node)
1731 {
1732 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1733 }
1734
1735 static inline bool classof(const ObjVar* node)
1736 {
1737 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1738 }
1739
1740 static inline bool classof(const GenericPAGNodeTy* node)
1741 {
1742 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1743 }
1744
1745 static inline bool classof(const SVFValue* node)
1746 {
1747 return node->getNodeKind() == SVFVar::ConstFPObjNode;
1748 }
1750
1754 {
1755 }
1756
1757 inline double getFPValue() const
1758 {
1759 return dval;
1760 }
1761
1762
1763 virtual const std::string toString() const;
1764};
1765
1767{
1768
1769private:
1772
1773public:
1775 static inline bool classof(const ConstIntObjVar*)
1776 {
1777 return true;
1778 }
1779
1780 static inline bool classof(const ConstDataObjVar* node)
1781 {
1782 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1783 }
1784
1785 static inline bool classof(const BaseObjVar* node)
1786 {
1787 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1788 }
1789
1790 static inline bool classof(const SVFVar* node)
1791 {
1792 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1793 }
1794 static inline bool classof(const ObjVar* node)
1795 {
1796 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1797 }
1798 static inline bool classof(const GenericPAGNodeTy* node)
1799 {
1800 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1801 }
1802
1803 static inline bool classof(const SVFValue* node)
1804 {
1805 return node->getNodeKind() == SVFVar::ConstIntObjNode;
1806 }
1807
1809 {
1810 return sval;
1811 }
1812
1813
1815 {
1816 return zval;
1817 }
1819
1823 {
1824 }
1825
1826 virtual const std::string toString() const;
1827};
1828
1830{
1831
1832public:
1834 static inline bool classof(const ConstNullPtrObjVar*)
1835 {
1836 return true;
1837 }
1838
1839 static inline bool classof(const ConstDataObjVar* node)
1840 {
1841 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1842 }
1843
1844 static inline bool classof(const BaseObjVar* node)
1845 {
1846 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1847 }
1848
1849 static inline bool classof(const SVFVar* node)
1850 {
1851 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1852 }
1853 static inline bool classof(const ObjVar* node)
1854 {
1855 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1856 }
1857 static inline bool classof(const GenericPAGNodeTy* node)
1858 {
1859 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1860 }
1861
1862 static inline bool classof(const SVFValue* node)
1863 {
1864 return node->getNodeKind() == SVFVar::ConstNullptrObjNode;
1865 }
1867
1874 {
1875 return false;
1876 }
1877 virtual const std::string toString() const;
1878};
1879/*
1880 * Unique Return node of a procedure
1881 */
1882class RetValPN : public ValVar
1883{
1884
1885private:
1887
1888public:
1890 static inline bool classof(const RetValPN*)
1891 {
1892 return true;
1893 }
1894 static inline bool classof(const SVFVar* node)
1895 {
1896 return node->getNodeKind() == SVFVar::RetValNode;
1897 }
1898 static inline bool classof(const ValVar* node)
1899 {
1900 return node->getNodeKind() == SVFVar::RetValNode;
1901 }
1902 static inline bool classof(const GenericPAGNodeTy* node)
1903 {
1904 return node->getNodeKind() == SVFVar::RetValNode;
1905 }
1906 static inline bool classof(const SVFValue* node)
1907 {
1908 return node->getNodeKind() == SVFVar::RetValNode;
1909 }
1911
1912
1914 RetValPN(NodeID i, const FunObjVar* node, const SVFType* svfType, const ICFGNode* icn);
1915
1916 inline const FunObjVar* getCallGraphNode() const
1917 {
1918 return callGraphNode;
1919 }
1920
1921 virtual const FunObjVar* getFunction() const;
1922
1923 virtual bool isPointer() const;
1924
1926 const std::string getValueName() const;
1927
1928 virtual const std::string toString() const;
1929};
1930
1931/*
1932 * Unique vararg node of a procedure
1933 */
1934class VarArgValPN : public ValVar
1935{
1936
1937private:
1939
1940public:
1942 static inline bool classof(const VarArgValPN*)
1943 {
1944 return true;
1945 }
1946 static inline bool classof(const SVFVar* node)
1947 {
1948 return node->getNodeKind() == SVFVar::VarargValNode;
1949 }
1950 static inline bool classof(const ValVar* node)
1951 {
1952 return node->getNodeKind() == SVFVar::VarargValNode;
1953 }
1954 static inline bool classof(const GenericPAGNodeTy* node)
1955 {
1956 return node->getNodeKind() == SVFVar::VarargValNode;
1957 }
1958 static inline bool classof(const SVFValue* node)
1959 {
1960 return node->getNodeKind() == SVFVar::VarargValNode;
1961 }
1963
1965 VarArgValPN(NodeID i, const FunObjVar* node, const SVFType* svfType, const ICFGNode* icn)
1967 {
1968 }
1969
1970 virtual const FunObjVar* getFunction() const;
1971
1973 const std::string getValueName() const;
1974
1975 virtual bool isPointer() const
1976 {
1977 return true;
1978 }
1979 virtual const std::string toString() const;
1980};
1981
1982/*
1983 * Dummy variable without any LLVM value
1984 */
1985class DummyValVar: public ValVar
1986{
1987
1988public:
1990 static inline bool classof(const DummyValVar*)
1991 {
1992 return true;
1993 }
1994 static inline bool classof(const SVFVar* node)
1995 {
1996 return node->getNodeKind() == SVFVar::DummyValNode;
1997 }
1998 static inline bool classof(const ValVar* node)
1999 {
2000 return node->getNodeKind() == SVFVar::DummyValNode;
2001 }
2002 static inline bool classof(const GenericPAGNodeTy* node)
2003 {
2004 return node->getNodeKind() == SVFVar::DummyValNode;
2005 }
2006 static inline bool classof(const SVFValue* node)
2007 {
2008 return node->getNodeKind() == SVFVar::DummyValNode;
2009 }
2011
2014 : ValVar(i, svfType, node, DummyValNode)
2015 {
2016 }
2017
2019 inline const std::string getValueName() const
2020 {
2021 return "dummyVal";
2022 }
2023
2024 virtual bool isPointer() const
2025 {
2026 return true;
2027 }
2028
2029 virtual const std::string toString() const;
2030};
2031
2032/*
2033 * Dummy object variable
2034 */
2036{
2037
2038public:
2040 static inline bool classof(const DummyObjVar*)
2041 {
2042 return true;
2043 }
2044 static inline bool classof(const BaseObjVar* node)
2045 {
2046 return node->getNodeKind() == SVFVar::DummyObjNode;
2047 }
2048 static inline bool classof(const SVFVar* node)
2049 {
2050 return node->getNodeKind() == SVFVar::DummyObjNode;
2051 }
2052 static inline bool classof(const ObjVar* node)
2053 {
2054 return node->getNodeKind() == SVFVar::DummyObjNode;
2055 }
2056 static inline bool classof(const GenericPAGNodeTy* node)
2057 {
2058 return node->getNodeKind() == SVFVar::DummyObjNode;
2059 }
2060
2061 static inline bool classof(const SVFValue* node)
2062 {
2063 return node->getNodeKind() == SVFVar::DummyObjNode;
2064 }
2066
2069 : BaseObjVar(i, ti, node, DummyObjNode)
2070 {
2071 }
2072
2074 inline const std::string getValueName() const
2075 {
2076 return "dummyObj";
2077 }
2078
2079 virtual bool isPointer() const
2080 {
2081 return true;
2082 }
2083
2084 virtual const std::string toString() const;
2085};
2086
2087} // End namespace SVF
2088
2089#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
BaseObjVar(NodeID i, ObjTypeInfo *ti, const ICFGNode *node, PNODEK ty=BaseObjNode)
Constructor.
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
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.
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.
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)
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.
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)
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.
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.
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.
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
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)
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)
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)
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)
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.
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.
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.
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
virtual const SVFType * getType() const
Definition SVFValue.h:171
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)
static bool classof(const ObjVar *node)
static bool classof(const BaseObjVar *node)
static bool classof(const GenericPAGNodeTy *node)
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)
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