diff --git a/SVF-osx/Release-build/bin/ae b/SVF-osx/Release-build/bin/ae index 9fa2f6fe..6ae2a514 100755 Binary files a/SVF-osx/Release-build/bin/ae and b/SVF-osx/Release-build/bin/ae differ diff --git a/SVF-osx/Release-build/bin/cfl b/SVF-osx/Release-build/bin/cfl index 24bff235..2be320ef 100755 Binary files a/SVF-osx/Release-build/bin/cfl and b/SVF-osx/Release-build/bin/cfl differ diff --git a/SVF-osx/Release-build/bin/dvf b/SVF-osx/Release-build/bin/dvf index 8d2747e2..c53a3013 100755 Binary files a/SVF-osx/Release-build/bin/dvf and b/SVF-osx/Release-build/bin/dvf differ diff --git a/SVF-osx/Release-build/bin/llvm2svf b/SVF-osx/Release-build/bin/llvm2svf index 1105140a..e6f7c56d 100755 Binary files a/SVF-osx/Release-build/bin/llvm2svf and b/SVF-osx/Release-build/bin/llvm2svf differ diff --git a/SVF-osx/Release-build/bin/mta b/SVF-osx/Release-build/bin/mta index 2d883dd0..15aac52b 100755 Binary files a/SVF-osx/Release-build/bin/mta and b/SVF-osx/Release-build/bin/mta differ diff --git a/SVF-osx/Release-build/bin/saber b/SVF-osx/Release-build/bin/saber index a90bd548..20459a1e 100755 Binary files a/SVF-osx/Release-build/bin/saber and b/SVF-osx/Release-build/bin/saber differ diff --git a/SVF-osx/Release-build/bin/svf-ex b/SVF-osx/Release-build/bin/svf-ex index d5bf228a..efcd5147 100755 Binary files a/SVF-osx/Release-build/bin/svf-ex and b/SVF-osx/Release-build/bin/svf-ex differ diff --git a/SVF-osx/Release-build/bin/wpa b/SVF-osx/Release-build/bin/wpa index c7a74026..4262a3a4 100755 Binary files a/SVF-osx/Release-build/bin/wpa and b/SVF-osx/Release-build/bin/wpa differ diff --git a/SVF-osx/Release-build/include/Graphs/GenericGraph.h b/SVF-osx/Release-build/include/Graphs/GenericGraph.h index 0e58eacc..d9a63998 100644 --- a/SVF-osx/Release-build/include/Graphs/GenericGraph.h +++ b/SVF-osx/Release-build/include/Graphs/GenericGraph.h @@ -141,96 +141,110 @@ class SVFBaseNode enum GNodeK { - // ┌── ICFGNode: Classes of inter-procedural and intra-procedural control flow graph nodes - IntraBlock, // ├──Represents a node within a single procedure - GlobalBlock, // ├──Represents a global-level block - // │ └─ InterICFGNode: Classes of inter-procedural control flow graph nodes - FunEntryBlock, // ├──Entry point of a function - FunExitBlock, // ├──Exit point of a function - FunCallBlock, // ├──Call site in the function - FunRetBlock, // ├──Return site in the function - // └──────── - - // ┌── SVFVar: Classes of top-level variables (ValVar) and address-taken variables (ObjVar) - // │ └── ValVar: Classes of top-level variable nodes - ValNode, // ├──Represents a standard value variable - ArgNode, // ├──Represents an argument value variable - FunValNode, // ├──Represents a Function value variable - GepValNode, // ├──Represents a GEP value variable - RetNode, // ├──Represents a return value node - VarargNode, // ├──Represents a variadic argument node - GlobalValNode, // ├──Represents a global variable node - ConstantAggValNode, // ├──Represents a constant aggregate value node - ConstantDataValNode, // ├──Represents a constant data variable - BlackHoleNode, // ├──Represents a black hole node - ConstantFPValNode, // ├──Represents a constant float-point value node - ConstantIntValNode, // ├── Represents a constant integer value node - ConstantNullptrValNode, // ├── Represents a constant nullptr value node - DummyValNode, // ├──Represents a dummy node for uninitialized values - // │ └── ObjVar: Classes of object variable nodes - ObjNode, // ├──Represents an object variable - GepObjNode, // ├──Represents a GEP object variable - // │ └── BaseObjVar: Classes of base object nodes - BaseObjNode, // ├──Represents a base object node - FunObjNode, // ├──Types of function object - HeapObjNode, // ├──Types of heap object - StackObjNode, // ├──Types of stack object - GlobalObjNode, // ├──Types of global object - ConstantAggObjNode, // ├──Types of constant aggregate object - ConstantDataObjNode, // ├──Types of constant data object - ConstantFPObjNode, // ├──Types of constant float-point object - ConstantIntObjNode, // ├──Types of constant integer object - ConstantNullptrObjNode, // ├──Types of constant nullptr object - DummyObjNode, // ├──Dummy node for uninitialized objects - // └──────── - - // ┌── VFGNode: Classes of Value Flow Graph (VFG) node kinds with operations - Cmp, // ├──Represents a comparison operation - BinaryOp, // ├──Represents a binary operation - UnaryOp, // ├──Represents a unary operation - Branch, // ├──Represents a branch operation - DummyVProp, // ├──Dummy node for value propagation - NPtr, // ├──Represents a null pointer operation - // │ └── ArgumentVFGNode: Classes of argument nodes in VFG - FRet, // ├──Represents a function return value - ARet, // ├──Represents an argument return value - AParm, // ├──Represents an argument parameter - FParm, // ├──Represents a function parameter - // │ └── StmtVFGNode: Classes of statement nodes in VFG - Addr, // ├──Represents an address operation - Copy, // ├──Represents a copy operation - Gep, // ├──Represents a GEP operation - Store, // ├──Represents a store operation - Load, // ├──Represents a load operation - // │ └── PHIVFGNode: Classes of PHI nodes in VFG - TPhi, // ├──Represents a type-based PHI node - TIntraPhi, // ├──Represents an intra-procedural PHI node - TInterPhi, // ├──Represents an inter-procedural PHI node - // │ └── MRSVFGNode: Classes of Memory-related SVFG nodes - FPIN, // ├──Function parameter input - FPOUT, // ├──Function parameter output - APIN, // ├──Argument parameter input - APOUT, // ├──Argument parameter output - // │ └── MSSAPHISVFGNode: Classes of Mem SSA PHI nodes for SVFG - MPhi, // ├──Memory PHI node - MIntraPhi, // ├──Intra-procedural memory PHI node - MInterPhi, // ├──Inter-procedural memory PHI node - // └──────── - - // Additional specific graph node types - CallNodeKd, // Callgraph node - CDNodeKd, // Control dependence graph node - CFLNodeKd, // CFL graph node - CHNodeKd, // Class hierarchy graph node + // ┌─────────────────────────────────────────────────────────────────────────┐ + // │ ICFGNode: Classes of inter-procedural and intra-procedural control flow │ + // │ graph nodes (Parent class: ICFGNode) │ + // └─────────────────────────────────────────────────────────────────────────┘ + IntraBlock, // ├── Represents a node within a single procedure + GlobalBlock, // ├── Represents a global-level block + // │ └─ Subclass: InterICFGNode + FunEntryBlock, // │ ├── Entry point of a function + FunExitBlock, // │ ├── Exit point of a function + FunCallBlock, // │ ├── Call site in the function + FunRetBlock, // │ └── Return site in the function + + // ┌─────────────────────────────────────────────────────────────────────────┐ + // │ SVFVar: Classes of variable nodes (Parent class: SVFVar) │ + // │ Includes two main subclasses: ValVar and ObjVar │ + // └─────────────────────────────────────────────────────────────────────────┘ + // └─ Subclass: ValVar (Top-level variable nodes) + ValNode, // ├── Represents a standard value variable + ArgValNode, // ├── Represents an argument value variable + FunValNode, // ├── Represents a function value variable + GepValNode, // ├── Represents a GEP value variable + RetValNode, // ├── Represents a return value node + VarargValNode, // ├── Represents a variadic argument node + GlobalValNode, // ├── Represents a global variable node + ConstAggValNode, // ├── Represents a constant aggregate value node + // │ └─ Subclass: ConstDataValVar + ConstDataValNode, // │ ├── Represents a constant data variable + BlackHoleValNode, // │ ├── Represents a black hole node + ConstFPValNode, // │ ├── Represents a constant floating-point value node + ConstIntValNode, // │ ├── Represents a constant integer value node + ConstNullptrValNode, // │ └── Represents a constant nullptr value node + // │ └─ Subclass: DummyValVar + DummyValNode, // │ └── Dummy node for uninitialized values + + // └─ Subclass: ObjVar (Object variable nodes) + ObjNode, // ├── Represents an object variable + // │ └─ Subclass: GepObjVar + GepObjNode, // │ ├── Represents a GEP object variable + // │ └─ Subclass: BaseObjVar + BaseObjNode, // │ ├── Represents a base object node + FunObjNode, // │ ├── Represents a function object + HeapObjNode, // │ ├── Represents a heap object + StackObjNode, // │ ├── Represents a stack object + GlobalObjNode, // │ ├── Represents a global object + ConstAggObjNode, // │ ├── Represents a constant aggregate object + // │ └─ Subclass: ConstDataObjVar + ConstDataObjNode, // │ ├── Represents a constant data object + ConstFPObjNode, // │ ├── Represents a constant floating-point object + ConstIntObjNode, // │ ├── Represents a constant integer object + ConstNullptrObjNode, // │ └── Represents a constant nullptr object + // │ └─ Subclass: DummyObjVar + DummyObjNode, // │ └── Dummy node for uninitialized objects + + // ┌─────────────────────────────────────────────────────────────────────────┐ + // │ VFGNode: Classes of Value Flow Graph (VFG) node kinds (Parent class: │ + // │ VFGNode) │ + // │ Includes operation nodes and specialized subclasses │ + // └─────────────────────────────────────────────────────────────────────────┘ + Cmp, // ├── Represents a comparison operation + BinaryOp, // ├── Represents a binary operation + UnaryOp, // ├── Represents a unary operation + Branch, // ├── Represents a branch operation + DummyVProp, // ├── Dummy node for value propagation + NPtr, // ├── Represents a null pointer operation + // │ └─ Subclass: ArgumentVFGNode + FRet, // │ ├── Represents a function return value + ARet, // │ ├── Represents an argument return value + AParm, // │ ├── Represents an argument parameter + FParm, // │ └── Represents a function parameter + // │ └─ Subclass: StmtVFGNode + Addr, // │ ├── Represents an address operation + Copy, // │ ├── Represents a copy operation + Gep, // │ ├── Represents a GEP operation + Store, // │ ├── Represents a store operation + Load, // │ └── Represents a load operation + // │ └─ Subclass: PHIVFGNode + TPhi, // │ ├── Represents a type-based PHI node + TIntraPhi, // │ ├── Represents an intra-procedural PHI node + TInterPhi, // │ └── Represents an inter-procedural PHI node + // │ └─ Subclass: MRSVFGNode + FPIN, // │ ├── Function parameter input + FPOUT, // │ ├── Function parameter output + APIN, // │ ├── Argument parameter input + APOUT, // │ └── Argument parameter output + // │ └─ Subclass: MSSAPHISVFGNode + MPhi, // │ ├── Memory PHI node + MIntraPhi, // │ ├── Intra-procedural memory PHI node + MInterPhi, // │ └── Inter-procedural memory PHI node + + // ┌─────────────────────────────────────────────────────────────────────────┐ + // │ Additional specific graph node types │ + // └─────────────────────────────────────────────────────────────────────────┘ + CallNodeKd, // Callgraph node + CDNodeKd, // Control dependence graph node + CFLNodeKd, // CFL graph node + CHNodeKd, // Class hierarchy graph node ConstraintNodeKd, // Constraint graph node - TCTNodeKd, // Thread creation tree node - DCHNodeKd, // DCHG node - OtherKd // Other node kind + TCTNodeKd, // Thread creation tree node + DCHNodeKd, // DCHG node + OtherKd // Other node kind }; - - SVFBaseNode(NodeID i, GNodeK k, SVFType* ty = nullptr): id(i),nodeKind(k), type(ty) + SVFBaseNode(NodeID i, GNodeK k, const SVFType* ty = nullptr): id(i),nodeKind(k), type(ty) { } @@ -326,10 +340,10 @@ class SVFBaseNode static inline bool isConstantDataValVar(GNodeK n) { - static_assert(ConstantNullptrValNode - ConstantDataValNode == 4, + static_assert(ConstNullptrValNode - ConstDataValNode == 4, "The number of ConstantDataValVarKinds has changed, make " "sure the range is correct"); - return n <= ConstantNullptrValNode && n >= ConstantDataValNode; + return n <= ConstNullptrValNode && n >= ConstDataValNode; } static inline bool isObjVarKinds(GNodeK n) @@ -350,10 +364,10 @@ class SVFBaseNode static inline bool isConstantDataObjVarKinds(GNodeK n) { - static_assert(ConstantNullptrObjNode - ConstantDataObjNode == 3, + static_assert(ConstNullptrObjNode - ConstDataObjNode == 3, "The number of ConstantDataObjVarKinds has changed, make " "sure the range is correct"); - return n <= ConstantNullptrObjNode && n >= ConstantDataObjNode; + return n <= ConstNullptrObjNode && n >= ConstDataObjNode; } static inline bool isVFGNodeKinds(GNodeK n) @@ -433,7 +447,7 @@ class GenericNode: public SVFBaseNode public: /// Constructor - GenericNode(NodeID i, GNodeK k): SVFBaseNode(i, k) + GenericNode(NodeID i, GNodeK k, const SVFType* svfType = nullptr): SVFBaseNode(i, k, svfType) { } diff --git a/SVF-osx/Release-build/include/SVF-LLVM/SVFIRBuilder.h b/SVF-osx/Release-build/include/SVF-LLVM/SVFIRBuilder.h index 07e6ea88..e875f597 100644 --- a/SVF-osx/Release-build/include/SVF-LLVM/SVFIRBuilder.h +++ b/SVF-osx/Release-build/include/SVF-LLVM/SVFIRBuilder.h @@ -272,7 +272,7 @@ class SVFIRBuilder: public llvm::InstVisitor { LLVMContext& cxt = llvmModuleSet()->getContext(); ConstantPointerNull* constNull = ConstantPointerNull::get(PointerType::getUnqual(cxt)); - NodeID nullPtr = pag->addConstantNullPtrValNode(llvmModuleSet()->getSVFValue(constNull),pag->getNullPtr(), nullptr); + NodeID nullPtr = pag->addConstantNullPtrValNode(pag->getNullPtr(), nullptr, llvmModuleSet()->getSVFType(constNull->getType())); llvmModuleSet()->addToSVFVar2LLVMValueMap(constNull, pag->getGNode(pag->getNullPtr())); setCurrentLocation(constNull, nullptr); addBlackHoleAddrEdge(pag->getBlkPtr()); diff --git a/SVF-osx/Release-build/include/SVFIR/SVFIR.h b/SVF-osx/Release-build/include/SVFIR/SVFIR.h index b14d9d2c..9c397e7d 100644 --- a/SVF-osx/Release-build/include/SVFIR/SVFIR.h +++ b/SVF-osx/Release-build/include/SVFIR/SVFIR.h @@ -473,7 +473,7 @@ class SVFIR : public IRGraph //@} inline NodeID addDummyValNode() { - return addDummyValNode(NodeIDAllocator::get()->allocateValueId()); + return addDummyValNode(NodeIDAllocator::get()->allocateValueId(), nullptr); } inline NodeID addDummyObjNode(const SVFType* type) { @@ -544,165 +544,164 @@ class SVFIR : public IRGraph /// add node into SVFIR //@{ /// Add a value (pointer) node - inline NodeID addValNode(const SVFValue* val, NodeID i, const ICFGNode* icfgNode) + inline NodeID addValNode(NodeID i, const SVFType* type, const ICFGNode* icfgNode) { - SVFVar *node = new ValVar(val,i, ValVar::ValNode, icfgNode); - return addValNode(val, node); + SVFVar *node = new ValVar(i, type, icfgNode, ValVar::ValNode); + return addValNode(node); } - NodeID addFunValNode(NodeID i, const ICFGNode* icfgNode, const CallGraphNode* callGraphNode) + NodeID addFunValNode(NodeID i, const ICFGNode* icfgNode, const CallGraphNode* callGraphNode, const SVFType* type) { - FunValVar* node = new FunValVar(i, icfgNode, callGraphNode); - return addValNode(nullptr, node); + FunValVar* node = new FunValVar(i, icfgNode, callGraphNode, type); + return addValNode(node); } - NodeID addArgValNode(NodeID i, u32_t argNo, const ICFGNode* icfgNode, const CallGraphNode* callGraphNode, bool isUncalled = false) + NodeID addArgValNode(NodeID i, u32_t argNo, const ICFGNode* icfgNode, const CallGraphNode* callGraphNode, const SVFType* type, bool isUncalled = false) { ArgValVar* node = - new ArgValVar(i, argNo, icfgNode, callGraphNode, isUncalled); - return addValNode(nullptr, node); + new ArgValVar(i, argNo, icfgNode, callGraphNode, type, isUncalled); + return addValNode(node); } - inline NodeID addConstantFPValNode(const SVFValue* curInst, const NodeID i, double dval, - const ICFGNode* icfgNode) + inline NodeID addConstantFPValNode(const NodeID i, double dval, + const ICFGNode* icfgNode, const SVFType* type) { - SVFVar* node = new ConstantFPValVar(curInst, i, dval, icfgNode); + SVFVar* node = new ConstFPValVar(i, dval, icfgNode, type); return addNode(node); } - inline NodeID addConstantIntValNode(const SVFValue* curInst, NodeID i, const std::pair& intValue, - const ICFGNode* icfgNode) + inline NodeID addConstantIntValNode(NodeID i, const std::pair& intValue, + const ICFGNode* icfgNode, const SVFType* type) { - SVFVar* node = new ConstantIntValVar(curInst, i, intValue.first, intValue.second, icfgNode); + SVFVar* node = new ConstIntValVar(i, intValue.first, intValue.second, icfgNode, type); return addNode(node); } - inline NodeID addConstantNullPtrValNode(const SVFValue* curInst, const NodeID i, const ICFGNode* icfgNode) + inline NodeID addConstantNullPtrValNode(const NodeID i, const ICFGNode* icfgNode, const SVFType* type) { - SVFVar* node = new ConstantNullPtrValVar(curInst, i, icfgNode); + SVFVar* node = new ConstNullPtrValVar(i, icfgNode, type); return addNode(node); } - inline NodeID addGlobalValueValNode(const SVFValue* curInst, const NodeID i, const ICFGNode* icfgNode) + inline NodeID addGlobalValNode(const NodeID i, const ICFGNode* icfgNode, const SVFType* svfType) { - SVFVar* node = new GlobalValVar(curInst, i, icfgNode); + SVFVar* node = new GlobalValVar(i, icfgNode, svfType); return addNode(node); } - inline NodeID addConstantAggValNode(const SVFValue* curInst, const NodeID i, const ICFGNode* icfgNode) + inline NodeID addConstantAggValNode(const NodeID i, const ICFGNode* icfgNode, const SVFType* svfType) { - SVFVar* node = new ConstantAggValVar(curInst, i, icfgNode); + SVFVar* node = new ConstAggValVar(i, icfgNode, svfType); return addNode(node); } - inline NodeID addConstantDataValNode(const SVFValue* curInst, const NodeID i, const ICFGNode* icfgNode) + inline NodeID addConstantDataValNode(const NodeID i, const ICFGNode* icfgNode, const SVFType* type) { - SVFVar* node = new ConstantDataValVar(curInst, i, icfgNode); + SVFVar* node = new ConstDataValVar(i, icfgNode, type); return addNode(node); } /// Add a memory obj node - inline NodeID addObjNode(const SVFValue* val, NodeID i, ObjTypeInfo* ti) + inline NodeID addObjNode(NodeID i, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node) { - return addFIObjNode(val, i, ti); + return addFIObjNode( i, ti, type, node); } /** * Creates and adds a heap object node to the SVFIR */ - inline NodeID addHeapObjNode(const SVFValue* val, NodeID i, ObjTypeInfo* ti, const SVFFunction* f) + inline NodeID addHeapObjNode(NodeID i, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node) { memToFieldsMap[i].set(i); - HeapObjVar *heapObj = new HeapObjVar(val, i, ti, f); - return addObjNode(val, heapObj); + HeapObjVar *heapObj = new HeapObjVar(i, ti, type, node); + return addObjNode(heapObj); } /** * Creates and adds a stack object node to the SVFIR */ - inline NodeID addStackObjNode(const SVFValue* val, NodeID i, ObjTypeInfo* ti, const SVFFunction* f) + inline NodeID addStackObjNode(NodeID i, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node) { memToFieldsMap[i].set(i); - StackObjVar *stackObj = new StackObjVar(val, i, ti, f); - return addObjNode(val, stackObj); + StackObjVar *stackObj = new StackObjVar(i, ti, type, node); + return addObjNode(stackObj); } - NodeID addFunObjNode(const SVFValue* val, NodeID id, ObjTypeInfo* ti, const CallGraphNode* callGraphNode) + NodeID addFunObjNode(NodeID id, ObjTypeInfo* ti, const CallGraphNode* callGraphNode, const SVFType* type, const ICFGNode* node) { memToFieldsMap[id].set(id); - FunObjVar* funObj = new FunObjVar(val, id, ti, callGraphNode); - return addObjNode(val, funObj); + FunObjVar* funObj = new FunObjVar(id, ti, callGraphNode, type, node); + return addObjNode(funObj); } - inline NodeID addConstantFPObjNode(const SVFValue* curInst, NodeID i, ObjTypeInfo* ti, double dval) + inline NodeID addConstantFPObjNode(NodeID i, ObjTypeInfo* ti, double dval, const SVFType* type, const ICFGNode* node) { memToFieldsMap[i].set(i); - ConstantFPObjVar* conObj = new ConstantFPObjVar(curInst, i, dval, ti); - return addObjNode(curInst, conObj); + ConstFPObjVar* conObj = new ConstFPObjVar(i, dval, ti, type, node); + return addObjNode(conObj); } - inline NodeID addConstantIntObjNode(const SVFValue* curInst, NodeID i, ObjTypeInfo* ti, const std::pair& intValue) + inline NodeID addConstantIntObjNode(NodeID i, ObjTypeInfo* ti, const std::pair& intValue, const SVFType* type, const ICFGNode* node) { memToFieldsMap[i].set(i); - ConstantIntObjVar* conObj = - new ConstantIntObjVar(curInst, i, intValue.first, intValue.second, ti); - return addObjNode(curInst, conObj); + ConstIntObjVar* conObj = + new ConstIntObjVar(i, intValue.first, intValue.second, ti, type, node); + return addObjNode(conObj); } - inline NodeID addConstantNullPtrObjNode(const SVFValue* curInst, const NodeID i, ObjTypeInfo* ti) + inline NodeID addConstantNullPtrObjNode(const NodeID i, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node) { memToFieldsMap[i].set(i); - ConstantNullPtrObjVar* conObj = new ConstantNullPtrObjVar(curInst, i, ti); - return addObjNode(curInst, conObj); + ConstNullPtrObjVar* conObj = new ConstNullPtrObjVar(i, ti, type, node); + return addObjNode(conObj); } - inline NodeID addGlobalValueObjNode(const SVFValue* curInst, const NodeID i, ObjTypeInfo* ti) + inline NodeID addGlobalObjNode(const NodeID i, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node) { memToFieldsMap[i].set(i); - GlobalObjVar* gObj = new GlobalObjVar(curInst, i, ti); - return addObjNode(curInst, gObj); + GlobalObjVar* gObj = new GlobalObjVar(i, ti, type, node); + return addObjNode(gObj); } - inline NodeID addConstantAggObjNode(const SVFValue* curInst, - const NodeID i, ObjTypeInfo* ti) + inline NodeID addConstantAggObjNode(const NodeID i, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node) { memToFieldsMap[i].set(i); - ConstantAggObjVar* conObj = new ConstantAggObjVar(curInst, i, ti); - return addObjNode(curInst, conObj); + ConstAggObjVar* conObj = new ConstAggObjVar(i, ti, type, node); + return addObjNode(conObj); } - inline NodeID addConstantDataObjNode(const SVFValue* curInst, const NodeID i, ObjTypeInfo* ti) + inline NodeID addConstantDataObjNode(const NodeID i, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node) { memToFieldsMap[i].set(i); - ConstantDataObjVar* conObj = new ConstantDataObjVar(curInst, i, ti); - return addObjNode(curInst, conObj); + ConstDataObjVar* conObj = new ConstDataObjVar(i, ti, type, node); + return addObjNode(conObj); } /// Add a unique return node for a procedure - inline NodeID addRetNode(NodeID i, const CallGraphNode* callGraphNode) + inline NodeID addRetNode(NodeID i, const CallGraphNode* callGraphNode, const SVFType* type, const ICFGNode* icn) { - SVFVar *node = new RetPN(i, callGraphNode); + SVFVar *node = new RetValPN(i, callGraphNode, type, icn); return addRetNode(callGraphNode, node); } /// Add a unique vararg node for a procedure - inline NodeID addVarargNode(NodeID i, const CallGraphNode* val) + inline NodeID addVarargNode(NodeID i, const CallGraphNode* val, const SVFType* type, const ICFGNode* n) { - SVFVar *node = new VarArgPN(i, val); + SVFVar *node = new VarArgValPN(i, val, type, n); return addNode(node); } /// Add a temp field value node, this method can only invoked by getGepValVar - NodeID addGepValNode(const SVFValue* curInst,const SVFValue* val, const AccessPath& ap, NodeID i, const SVFType* type); + NodeID addGepValNode(const SVFValue* curInst,const SVFValue* val, const AccessPath& ap, NodeID i, const SVFType* type, const ICFGNode* node); /// Add a field obj node, this method can only invoked by getGepObjVar NodeID addGepObjNode(const BaseObjVar* baseObj, const APOffset& apOffset, const NodeID gepId); /// Add a field-insensitive node, this method can only invoked by getFIGepObjNode - NodeID addFIObjNode(const SVFValue* val, NodeID i, ObjTypeInfo* ti) + NodeID addFIObjNode(NodeID i, ObjTypeInfo* ti, const SVFType* type, const ICFGNode* node) { memToFieldsMap[i].set(i); - BaseObjVar* baseObj = new BaseObjVar(val, i, ti); - return addObjNode(val, baseObj); + BaseObjVar* baseObj = new BaseObjVar(i, ti, type, node); + return addObjNode(baseObj); } @@ -710,9 +709,9 @@ class SVFIR : public IRGraph /// Add a dummy value/object node according to node ID (llvm value is null) //@{ - inline NodeID addDummyValNode(NodeID i) + inline NodeID addDummyValNode(NodeID i, const ICFGNode* node) { - return addValNode(nullptr, new DummyValVar(i)); + return addValNode(new DummyValVar(i, node)); } inline NodeID addDummyObjNode(NodeID i, const SVFType* type) { @@ -720,31 +719,30 @@ class SVFIR : public IRGraph { ObjTypeInfo* ti = symInfo->createObjTypeInfo(type); symInfo->idToObjTypeInfoMap()[i] = ti; - return addObjNode(nullptr, new DummyObjVar(i, ti)); + return addObjNode(new DummyObjVar(i, ti, nullptr, type)); } else { - return addObjNode(nullptr, new DummyObjVar(i, symInfo->getObjTypeInfo(i))); + return addObjNode(new DummyObjVar(i, symInfo->getObjTypeInfo(i), nullptr, type)); } } inline NodeID addBlackholeObjNode() { - return addObjNode( - nullptr, new DummyObjVar(getBlackHoleNode(), symInfo->getObjTypeInfo(getBlackHoleNode()))); + return addObjNode(new DummyObjVar(getBlackHoleNode(), symInfo->getObjTypeInfo(getBlackHoleNode()), nullptr)); } inline NodeID addConstantObjNode() { - return addObjNode(nullptr, new DummyObjVar(getConstantNode(), symInfo->getObjTypeInfo(getConstantNode()))); + return addObjNode(new DummyObjVar(getConstantNode(), symInfo->getObjTypeInfo(getConstantNode()), nullptr)); } inline NodeID addBlackholePtrNode() { - return addDummyValNode(getBlkPtr()); + return addDummyValNode(getBlkPtr(), nullptr); } //@} /// Add a value (pointer) node - inline NodeID addValNode(const SVFValue*, SVFVar *node) + inline NodeID addValNode(SVFVar *node) { assert(node && "node cannot be nullptr."); assert(hasGNode(node->getId()) == false && @@ -753,7 +751,7 @@ class SVFIR : public IRGraph return addNode(node); } /// Add a memory obj node - inline NodeID addObjNode(const SVFValue*, SVFVar *node) + inline NodeID addObjNode(SVFVar *node) { assert(node && "node cannot be nullptr."); assert(hasGNode(node->getId()) == false && diff --git a/SVF-osx/Release-build/include/SVFIR/SVFVariables.h b/SVF-osx/Release-build/include/SVFIR/SVFVariables.h index 6e4159b9..11384eec 100644 --- a/SVF-osx/Release-build/include/SVFIR/SVFVariables.h +++ b/SVF-osx/Release-build/include/SVFIR/SVFVariables.h @@ -39,7 +39,8 @@ namespace SVF class SVFVar; /* - * SVFIR program variables (PAGNodes) + * Program variables in SVFIR (based on PAG nodes) + * These represent variables in the program analysis graph */ typedef GenericNode GenericPAGNodeTy; class SVFVar : public GenericPAGNodeTy @@ -52,110 +53,71 @@ class SVFVar : public GenericPAGNodeTy friend class VFG; public: - /// Nine kinds of SVFIR variables - /// ValNode: llvm pointer value - /// ObjNode: memory object - /// RetNode: unique return node - /// Vararg: unique node for vararg parameter - /// GepValNode: temporary gep value node for field sensitivity - /// GepValNode: temporary gep obj node for field sensitivity - /// BaseObjNode: for field insensitive analysis - /// DummyValNode and DummyObjNode: for non-llvm-value node + /// Node kinds for SVFIR variables: + /// ValNode - LLVM pointer value + /// ObjNode - Memory object + /// RetValNode - Function return value + /// VarargNode - Variable argument parameter + /// GepValNode - Temporary value for field-sensitive analysis + /// GepObjNode - Temporary object for field-sensitive analysis + /// BaseObjNode - Base object for field-insensitive analysis + /// DummyValNode/DummyObjNode - Nodes for non-LLVM values typedef GNodeK PNODEK; typedef s64_t GEdgeKind; protected: - const SVFValue* value; ///< value of this SVFIR node + /// Maps tracking incoming and outgoing edges by kind SVFStmt::KindToSVFStmtMapTy InEdgeKindToSetMap; SVFStmt::KindToSVFStmtMapTy OutEdgeKindToSetMap; - bool isPtr; /// whether it is a pointer (top-level or address-taken) - const SVFFunction* func; /// function containing this variable - - /// Constructor to create an empty object (for deserialization) - SVFVar(NodeID i, PNODEK k) : GenericPAGNodeTy(i, k), value{} {} + /// Empty constructor for deserialization + SVFVar(NodeID i, PNODEK k) : GenericPAGNodeTy(i, k) {} public: - /// Constructor - SVFVar(const SVFValue* val, NodeID i, PNODEK k); - /// Destructor - virtual ~SVFVar() {} - - /// Get/has methods of the components - //@{ - inline const SVFValue* getValue() const - { - assert(this->getNodeKind() != DummyValNode && - this->getNodeKind() != DummyObjNode && - "dummy node do not have value!"); - assert(!SymbolTableInfo::isBlkObjOrConstantObj(this->getId()) && - "blackhole and constant obj do not have value"); - assert(value && "value is null (GepObjNode whose basenode is a DummyObj?)"); - return value; - } + /// Standard constructor with ID, type and kind + SVFVar(NodeID i, const SVFType* svfType, PNODEK k); - /// Return type of the value - inline virtual const SVFType* getType() const - { - return value ? value->getType() : nullptr; - } + /// Virtual destructor + virtual ~SVFVar() {} - inline bool hasValue() const - { - return value != nullptr; - } - /// Whether it is a pointer + /// Check if this variable represents a pointer virtual inline bool isPointer() const { - return isPtr; + assert(type && "type is null?"); + return type->isPointerTy(); } - /// Whether it is constant data, i.e., "0", "1.001", "str" - /// or llvm's metadata, i.e., metadata !4087 + + /// Check if this variable represents constant data/metadata but not null pointer virtual bool isConstDataOrAggDataButNotNullPtr() const { return false; } - /// Whether this is an isolated node on the SVFIR graph + /// Check if this node is isolated (no edges) in the SVFIR graph virtual bool isIsolatedNode() const; - /// Get name of the LLVM value - // TODO: (Optimization) Should it return const reference instead of value? + /// Get string name of the represented LLVM value virtual const std::string getValueName() const = 0; - /// Return the function containing this SVFVar - /// @return The SVFFunction containing this variable, or nullptr if it's a global/constant expression + /// Get containing function, or null for globals/constants virtual inline const SVFFunction* getFunction() const { - // Return cached function if available - if(func) return func; - - // If we have an associated LLVM value, check its parent function - if (value) - { - // For instructions, return the function containing the parent basic block - if (auto inst = SVFUtil::dyn_cast(value)) - { - return inst->getParent()->getParent(); - } - } - - // Return nullptr for globals/constants with no parent function return nullptr; } - /// Get incoming SVFIR statements (edges) + /// Edge accessors and checkers + //@{ inline SVFStmt::SVFStmtSetTy& getIncomingEdges(SVFStmt::PEDGEK kind) { return InEdgeKindToSetMap[kind]; } - /// Get outgoing SVFIR statements (edges) + inline SVFStmt::SVFStmtSetTy& getOutgoingEdges(SVFStmt::PEDGEK kind) { return OutEdgeKindToSetMap[kind]; } - /// Has incoming SVFIR statements (edges) + inline bool hasIncomingEdges(SVFStmt::PEDGEK kind) const { SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(kind); @@ -164,7 +126,7 @@ class SVFVar : public GenericPAGNodeTy else return false; } - /// Has outgoing SVFIR statements (edges) + inline bool hasOutgoingEdges(SVFStmt::PEDGEK kind) const { SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind); @@ -174,39 +136,37 @@ class SVFVar : public GenericPAGNodeTy return false; } - /// Get incoming SVFStmt iterator + /// Edge iterators inline SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesBegin(SVFStmt::PEDGEK kind) const { SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(kind); - assert(it!=InEdgeKindToSetMap.end() && "The node does not have such kind of edge"); + assert(it!=InEdgeKindToSetMap.end() && "Edge kind not found"); return it->second.begin(); } - /// Get incoming SVFStmt iterator inline SVFStmt::SVFStmtSetTy::iterator getIncomingEdgesEnd(SVFStmt::PEDGEK kind) const { SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(kind); - assert(it!=InEdgeKindToSetMap.end() && "The node does not have such kind of edge"); + assert(it!=InEdgeKindToSetMap.end() && "Edge kind not found"); return it->second.end(); } - /// Get outgoing SVFStmt iterator inline SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesBegin(SVFStmt::PEDGEK kind) const { SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind); - assert(it!=OutEdgeKindToSetMap.end() && "The node does not have such kind of edge"); + assert(it!=OutEdgeKindToSetMap.end() && "Edge kind not found"); return it->second.begin(); } - /// Get outgoing SVFStmt iterator inline SVFStmt::SVFStmtSetTy::iterator getOutgoingEdgesEnd(SVFStmt::PEDGEK kind) const { SVFStmt::KindToSVFStmtMapTy::const_iterator it = OutEdgeKindToSetMap.find(kind); - assert(it!=OutEdgeKindToSetMap.end() && "The node does not have such kind of edge"); + assert(it!=OutEdgeKindToSetMap.end() && "Edge kind not found"); return it->second.end(); } //@} + /// Type checking support for LLVM-style RTTI static inline bool classof(const SVFVar *) { return true; @@ -222,6 +182,7 @@ class SVFVar : public GenericPAGNodeTy return isSVFVarKind(node->getNodeKind()); } + /// Check if this pointer is in an uncalled function inline virtual bool ptrInUncalledFunction() const { if (const SVFFunction* fun = getFunction()) @@ -234,6 +195,7 @@ class SVFVar : public GenericPAGNodeTy } } + /// Check if this variable represents constant/aggregate data virtual bool isConstDataOrAggData() const { return false; @@ -241,7 +203,7 @@ class SVFVar : public GenericPAGNodeTy private: - /// add methods of the components + /// Edge management methods //@{ inline void addInEdge(SVFStmt* inEdge) { @@ -256,7 +218,8 @@ class SVFVar : public GenericPAGNodeTy OutEdgeKindToSetMap[kind].insert(outEdge); addOutgoingEdge(outEdge); } - /// Has incoming VariantGepEdges + + /// Check for incoming variable field GEP edges inline bool hasIncomingVariantGepEdge() const { SVFStmt::KindToSVFStmtMapTy::const_iterator it = InEdgeKindToSetMap.find(SVFStmt::Gep); @@ -272,20 +235,18 @@ class SVFVar : public GenericPAGNodeTy } public: + /// Get string representation virtual const std::string toString() const; - /// Dump to console for debugging + /// Debug dump to console void dump() const; - //@} - /// Overloading operator << for dumping SVFVar value - //@{ + /// Stream operator overload for output friend OutStream& operator<< (OutStream &o, const SVFVar &node) { o << node.toString(); return o; } - //@} }; @@ -326,16 +287,14 @@ class ValVar: public SVFVar //@} /// Constructor - ValVar(const SVFValue* val, NodeID i, PNODEK ty = ValNode, const ICFGNode* node = nullptr) - : SVFVar(val, i, ty), icfgNode(node) + ValVar(NodeID i, const SVFType* svfType, const ICFGNode* node, PNODEK ty = ValNode) + : SVFVar(i, svfType, ty), icfgNode(node) { } /// Return name of a LLVM value inline const std::string getValueName() const { - if (value) - return value->getName(); - return ""; + return getName(); } const ICFGNode* getICFGNode() const @@ -343,6 +302,8 @@ class ValVar: public SVFVar return icfgNode; } + virtual const SVFFunction* getFunction() const; + virtual const std::string toString() const; }; @@ -358,8 +319,8 @@ class ObjVar: public SVFVar /// Constructor to create an empty ObjVar (for SVFIRReader/deserialization) ObjVar(NodeID i, PNODEK ty = ObjNode) : SVFVar(i, ty) {} /// Constructor - ObjVar(const SVFValue* val, NodeID i, PNODEK ty = ObjNode) : - SVFVar(val, i, ty) + ObjVar(NodeID i, const SVFType* svfType, PNODEK ty = ObjNode) : + SVFVar(i, svfType, ty) { } public: @@ -386,14 +347,7 @@ class ObjVar: public SVFVar /// Return name of a LLVM value virtual const std::string getValueName() const { - if (value) - return value->getName(); - return ""; - } - /// Return type of the value - inline virtual const SVFType* getType() const - { - return value->getType(); + return getName(); } virtual const std::string toString() const; @@ -418,7 +372,7 @@ class ArgValVar: public ValVar protected: /// Constructor to create function argument (for SVFIRReader/deserialization) - ArgValVar(NodeID i, PNODEK ty = ArgNode) : ValVar(i, ty) {} + ArgValVar(NodeID i, PNODEK ty = ArgValNode) : ValVar(i, ty) {} public: /// Methods for support type inquiry through isa, cast, and dyn_cast: @@ -429,32 +383,30 @@ class ArgValVar: public ValVar } static inline bool classof(const ValVar* node) { - return node->getNodeKind() == ArgNode; + return node->getNodeKind() == ArgValNode; } static inline bool classof(const SVFVar* node) { - return node->getNodeKind() == ArgNode; + return node->getNodeKind() == ArgValNode; } static inline bool classof(const GenericPAGNodeTy* node) { - return node->getNodeKind() == ArgNode; + return node->getNodeKind() == ArgValNode; } static inline bool classof(const SVFBaseNode* node) { - return node->getNodeKind() == ArgNode; + return node->getNodeKind() == ArgValNode; } //@} /// Constructor ArgValVar(NodeID i, u32_t argNo, const ICFGNode* icn, const CallGraphNode* callGraphNode, - bool isUncalled = false, PNODEK ty = ArgNode); + const SVFType* svfType, bool isUncalled = false); /// Return name of a LLVM value inline const std::string getValueName() const { - if (value) - return value->getName() + " (argument valvar)"; - return " (argument valvar)"; + return getName() + " (argument valvar)"; } virtual const SVFFunction* getFunction() const; @@ -473,6 +425,8 @@ class ArgValVar: public ValVar return uncalled; } + virtual bool isPointer() const; + virtual const std::string toString() const; }; @@ -521,8 +475,8 @@ class GepValVar: public ValVar //@} /// Constructor - GepValVar(ValVar* baseNode, const SVFValue* val, NodeID i, const AccessPath& ap, - const SVFType* ty); + GepValVar(ValVar* baseNode, NodeID i, const AccessPath& ap, + const SVFType* ty, const ICFGNode* node); /// offset of the base value variable inline APOffset getConstantFieldIdx() const @@ -539,10 +493,13 @@ class GepValVar: public ValVar /// Return name of a LLVM value inline const std::string getValueName() const { - if (value) - return value->getName() + "_" + - std::to_string(getConstantFieldIdx()); - return "offset_" + std::to_string(getConstantFieldIdx()); + return getName() + "_" + + std::to_string(getConstantFieldIdx()); + } + + virtual bool isPointer() const + { + return base->isPointer(); } inline const SVFType* getType() const @@ -550,6 +507,11 @@ class GepValVar: public ValVar return gepValType; } + virtual const SVFFunction* getFunction() const + { + return base->getFunction(); + } + virtual const std::string toString() const; virtual bool isConstDataOrAggDataButNotNullPtr() const @@ -582,7 +544,7 @@ class BaseObjVar : public ObjVar protected: /// Constructor to create empty ObjVar (for SVFIRReader/deserialization) - BaseObjVar(NodeID i, PNODEK ty = BaseObjNode) : ObjVar(i, ty) {} + BaseObjVar(NodeID i, const ICFGNode* node, PNODEK ty = BaseObjNode) : ObjVar(i, ty), icfgNode(node) {} public: /// Methods for support type inquiry through isa, cast, and dyn_cast: @@ -610,8 +572,9 @@ class BaseObjVar : public ObjVar //@} /// Constructor - BaseObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, PNODEK ty = BaseObjNode) - : ObjVar(val, i, ty), typeInfo(ti) + BaseObjVar(NodeID i, ObjTypeInfo* ti, + const SVFType* svfType, const ICFGNode* node, PNODEK ty = BaseObjNode) + : ObjVar(i, svfType, ty), typeInfo(ti), icfgNode(node) { } @@ -629,9 +592,7 @@ class BaseObjVar : public ObjVar /// Return name of a LLVM value inline const std::string getValueName() const { - if (value) - return value->getName() + " (base object)"; - return " (base object)"; + return getName() + " (base object)"; } virtual const std::string toString() const; @@ -768,6 +729,7 @@ class BaseObjVar : public ObjVar typeInfo = nullptr; } + virtual const SVFFunction* getFunction() const; }; @@ -818,7 +780,7 @@ class GepObjVar: public ObjVar /// Constructor GepObjVar(const BaseObjVar* baseObj, NodeID i, const APOffset& apOffset, PNODEK ty = GepObjNode) - : ObjVar(baseObj->hasValue()? baseObj->getValue(): nullptr, i, ty), apOffset(apOffset), base(baseObj) + : ObjVar(i, baseObj->getType(), ty), apOffset(apOffset), base(baseObj) { } @@ -842,15 +804,18 @@ class GepObjVar: public ObjVar /// Return the type of this gep object inline virtual const SVFType* getType() const { - return SymbolTableInfo::SymbolInfo()->getFlatternedElemType(value->getType(), apOffset); + return SymbolTableInfo::SymbolInfo()->getFlatternedElemType(type, apOffset); } /// Return name of a LLVM value inline const std::string getValueName() const { - if (value) - return value->getName() + "_" + std::to_string(apOffset); - return "offset_" + std::to_string(apOffset); + return getName() + "_" + std::to_string(apOffset); + } + + virtual const SVFFunction* getFunction() const + { + return base->getFunction(); } virtual const std::string toString() const; @@ -869,6 +834,11 @@ class GepObjVar: public ObjVar { return base->isConstDataOrAggDataButNotNullPtr(); } + + virtual bool isPointer() const + { + return base->isPointer(); + } }; @@ -887,7 +857,7 @@ class HeapObjVar: public BaseObjVar protected: /// Constructor to create heap object var - HeapObjVar(NodeID i, PNODEK ty = HeapObjNode) : BaseObjVar(i, ty) {} + HeapObjVar(NodeID i, const ICFGNode* node) : BaseObjVar(i, node, HeapObjNode) {} public: /// Methods for support type inquiry through isa, cast, and dyn_cast: @@ -919,12 +889,9 @@ class HeapObjVar: public BaseObjVar //@} /// Constructor - HeapObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, - const SVFFunction* f, PNODEK ty = HeapObjNode): - BaseObjVar(val, i, ti, ty) + HeapObjVar(NodeID i, ObjTypeInfo* ti, const SVFType* svfType, const ICFGNode* node): + BaseObjVar(i, ti, svfType, node, HeapObjNode) { - isPtr = val->getType()->isPointerTy(); - func = f; } /// Return name of a LLVM value @@ -953,7 +920,7 @@ class StackObjVar: public BaseObjVar protected: /// Constructor to create stack object var - StackObjVar(NodeID i, PNODEK ty = StackObjNode) : BaseObjVar(i, ty) {} + StackObjVar(NodeID i, const ICFGNode* node) : BaseObjVar(i, node, StackObjNode) {} public: /// Methods for support type inquiry through isa, cast, and dyn_cast: @@ -985,12 +952,9 @@ class StackObjVar: public BaseObjVar //@} /// Constructor - StackObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, - const SVFFunction* fun, PNODEK ty = StackObjNode): - BaseObjVar(val, i, ti, ty) + StackObjVar(NodeID i, ObjTypeInfo* ti, const SVFType* svfType, const ICFGNode* node): + BaseObjVar(i, ti, svfType, node, StackObjNode) { - isPtr = val->getType()->isPointerTy(); - func = fun; } /// Return name of a LLVM value @@ -1043,8 +1007,13 @@ class FunValVar : public ValVar } /// Constructor - FunValVar(NodeID i, const ICFGNode* icn, const CallGraphNode* cgn, - PNODEK ty = FunValNode); + FunValVar(NodeID i, const ICFGNode* icn, const CallGraphNode* cgn, const SVFType* svfType); + + + virtual bool isPointer() const + { + return true; + } virtual const std::string toString() const; }; @@ -1059,7 +1028,7 @@ class FunObjVar : public BaseObjVar private: /// Constructor to create empty ObjVar (for SVFIRReader/deserialization) - FunObjVar(NodeID i, PNODEK ty = FunObjNode) : BaseObjVar(i, ty) {} + FunObjVar(NodeID i, const ICFGNode* node) : BaseObjVar(i,node, FunObjNode) {} public: /// Methods for support type inquiry through isa, cast, and dyn_cast: @@ -1091,8 +1060,7 @@ class FunObjVar : public BaseObjVar //@} /// Constructor - FunObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, const CallGraphNode* cgNode, - PNODEK ty = FunObjNode); + FunObjVar(NodeID i, ObjTypeInfo* ti, const CallGraphNode* cgNode, const SVFType* svfType, const ICFGNode* node); inline const CallGraphNode* getCallGraphNode() const { @@ -1101,6 +1069,8 @@ class FunObjVar : public BaseObjVar virtual const SVFFunction* getFunction() const; + virtual bool isPointer() const; + virtual bool isIsolatedNode() const; virtual const std::string toString() const; @@ -1137,16 +1107,17 @@ class GlobalValVar : public ValVar //@} /// Constructor - GlobalValVar(const SVFValue* val, NodeID i, const ICFGNode* icn, - PNODEK ty = GlobalValNode) - : ValVar(val, i, ty, icn) + GlobalValVar(NodeID i, const ICFGNode* icn, const SVFType* svfType) + : ValVar(i, svfType, icn, GlobalValNode) { + type = svfType; } + virtual const std::string toString() const; }; -class ConstantAggValVar: public ValVar +class ConstAggValVar: public ValVar { friend class SVFIRWriter; friend class SVFIRReader; @@ -1154,36 +1125,36 @@ class ConstantAggValVar: public ValVar public: /// Methods for support type inquiry through isa, cast, and dyn_cast: //@{ - static inline bool classof(const ConstantAggValVar*) + static inline bool classof(const ConstAggValVar*) { return true; } static inline bool classof(const ValVar* node) { - return node->getNodeKind() == ConstantAggValNode; + return node->getNodeKind() == ConstAggValNode; } static inline bool classof(const SVFVar* node) { - return node->getNodeKind() == ConstantAggValNode; + return node->getNodeKind() == ConstAggValNode; } static inline bool classof(const GenericPAGNodeTy* node) { - return node->getNodeKind() == ConstantAggValNode; + return node->getNodeKind() == ConstAggValNode; } static inline bool classof(const SVFBaseNode* node) { - return node->getNodeKind() == ConstantAggValNode; + return node->getNodeKind() == ConstAggValNode; } //@} /// Constructor - ConstantAggValVar(const SVFValue* val, NodeID i, const ICFGNode* icn, - PNODEK ty = ConstantAggValNode) - : ValVar(val, i, ty, icn) + ConstAggValVar(NodeID i, const ICFGNode* icn, const SVFType* svfTy) + : ValVar(i, svfTy, icn, ConstAggValNode) { - + type = svfTy; } + virtual bool isConstDataOrAggData() const { return true; @@ -1198,7 +1169,7 @@ class ConstantAggValVar: public ValVar }; -class ConstantDataValVar: public ValVar +class ConstDataValVar : public ValVar { friend class SVFIRWriter; friend class SVFIRReader; @@ -1206,7 +1177,7 @@ class ConstantDataValVar: public ValVar public: /// Methods for support type inquiry through isa, cast, and dyn_cast: //@{ - static inline bool classof(const ConstantDataValVar*) + static inline bool classof(const ConstDataValVar*) { return true; } @@ -1229,9 +1200,9 @@ class ConstantDataValVar: public ValVar //@} /// Constructor - ConstantDataValVar(const SVFValue* val, NodeID i, const ICFGNode* icn, - PNODEK ty = ConstantDataValNode) - : ValVar(val, i, ty, icn) + ConstDataValVar(NodeID i, const ICFGNode* icn, const SVFType* svfType, + PNODEK ty = ConstDataValNode) + : ValVar(i, svfType, icn, ty) { } @@ -1249,7 +1220,7 @@ class ConstantDataValVar: public ValVar virtual const std::string toString() const; }; -class BlackHoleVar: public ConstantDataValVar +class BlackHoleValVar : public ConstDataValVar { friend class SVFIRWriter; friend class SVFIRReader; @@ -1257,35 +1228,35 @@ class BlackHoleVar: public ConstantDataValVar public: /// Methods for support type inquiry through isa, cast, and dyn_cast: //@{ - static inline bool classof(const BlackHoleVar*) + static inline bool classof(const BlackHoleValVar*) { return true; } - static inline bool classof(const ConstantDataValVar* node) + static inline bool classof(const ConstDataValVar* node) { - return node->getNodeKind() == BlackHoleNode; + return node->getNodeKind() == BlackHoleValNode; } static inline bool classof(const ValVar* node) { - return node->getNodeKind() == BlackHoleNode; + return node->getNodeKind() == BlackHoleValNode; } static inline bool classof(const SVFVar* node) { - return node->getNodeKind() == BlackHoleNode; + return node->getNodeKind() == BlackHoleValNode; } static inline bool classof(const GenericPAGNodeTy* node) { - return node->getNodeKind() == BlackHoleNode; + return node->getNodeKind() == BlackHoleValNode; } static inline bool classof(const SVFBaseNode* node) { - return node->getNodeKind() == BlackHoleNode; + return node->getNodeKind() == BlackHoleValNode; } //@} /// Constructor - BlackHoleVar(NodeID i, PNODEK ty = BlackHoleNode) - : ConstantDataValVar(nullptr, i, nullptr, ty) + BlackHoleValVar(NodeID i, const SVFType* svfType, PNODEK ty = BlackHoleValNode) + : ConstDataValVar(i, nullptr, svfType, ty) { } @@ -1297,11 +1268,11 @@ class BlackHoleVar: public ConstantDataValVar virtual const std::string toString() const { - return "BlackHoleVar"; + return "BlackHoleValVar"; } }; -class ConstantFPValVar: public ConstantDataValVar +class ConstFPValVar : public ConstDataValVar { friend class SVFIRWriter; friend class SVFIRReader; @@ -1311,29 +1282,29 @@ class ConstantFPValVar: public ConstantDataValVar public: /// Methods for support type inquiry through isa, cast, and dyn_cast: //@{ - static inline bool classof(const ConstantFPValVar*) + static inline bool classof(const ConstFPValVar*) { return true; } - static inline bool classof(const ConstantDataValVar* node) + static inline bool classof(const ConstDataValVar* node) { - return node->getNodeKind() == ConstantFPValNode; + return node->getNodeKind() == ConstFPValNode; } static inline bool classof(const ValVar* node) { - return node->getNodeKind() == ConstantFPValNode; + return node->getNodeKind() == ConstFPValNode; } static inline bool classof(const SVFVar* node) { - return node->getNodeKind() == ConstantFPValNode; + return node->getNodeKind() == ConstFPValNode; } static inline bool classof(const GenericPAGNodeTy* node) { - return node->getNodeKind() == ConstantFPValNode; + return node->getNodeKind() == ConstFPValNode; } static inline bool classof(const SVFBaseNode* node) { - return node->getNodeKind() == ConstantFPValNode; + return node->getNodeKind() == ConstFPValNode; } //@} @@ -1343,17 +1314,16 @@ class ConstantFPValVar: public ConstantDataValVar } /// Constructor - ConstantFPValVar(const SVFValue* val, NodeID i, double dv, const ICFGNode* icn, - PNODEK ty = ConstantFPValNode) - : ConstantDataValVar(val, i, icn, ty), dval(dv) + ConstFPValVar(NodeID i, double dv, + const ICFGNode* icn, const SVFType* svfType) + : ConstDataValVar(i, icn, svfType, ConstFPValNode), dval(dv) { - } virtual const std::string toString() const; }; -class ConstantIntValVar: public ConstantDataValVar +class ConstIntValVar : public ConstDataValVar { friend class SVFIRWriter; friend class SVFIRReader; @@ -1364,29 +1334,29 @@ class ConstantIntValVar: public ConstantDataValVar public: /// Methods for support type inquiry through isa, cast, and dyn_cast: //@{ - static inline bool classof(const ConstantIntValVar*) + static inline bool classof(const ConstIntValVar*) { return true; } - static inline bool classof(const ConstantDataValVar* node) + static inline bool classof(const ConstDataValVar* node) { - return node->getNodeKind() == ConstantIntValNode; + return node->getNodeKind() == ConstIntValNode; } static inline bool classof(const ValVar* node) { - return node->getNodeKind() == ConstantIntValNode; + return node->getNodeKind() == ConstIntValNode; } static inline bool classof(const SVFVar* node) { - return node->getNodeKind() == ConstantIntValNode; + return node->getNodeKind() == ConstIntValNode; } static inline bool classof(const GenericPAGNodeTy* node) { - return node->getNodeKind() == ConstantIntValNode; + return node->getNodeKind() == ConstIntValNode; } static inline bool classof(const SVFBaseNode* node) { - return node->getNodeKind() == ConstantIntValNode; + return node->getNodeKind() == ConstIntValNode; } //@} @@ -1402,16 +1372,15 @@ class ConstantIntValVar: public ConstantDataValVar } /// Constructor - ConstantIntValVar(const SVFValue* val, NodeID i, s64_t sv, u64_t zv, const ICFGNode* icn, - PNODEK ty = ConstantIntValNode) - : ConstantDataValVar(val, i, icn, ty), zval(zv), sval(sv) + ConstIntValVar(NodeID i, s64_t sv, u64_t zv, const ICFGNode* icn, const SVFType* svfType) + : ConstDataValVar(i, icn, svfType, ConstIntValNode), zval(zv), sval(sv) { } virtual const std::string toString() const; }; -class ConstantNullPtrValVar: public ConstantDataValVar +class ConstNullPtrValVar : public ConstDataValVar { friend class SVFIRWriter; friend class SVFIRReader; @@ -1419,36 +1388,35 @@ class ConstantNullPtrValVar: public ConstantDataValVar public: /// Methods for support type inquiry through isa, cast, and dyn_cast: //@{ - static inline bool classof(const ConstantNullPtrValVar*) + static inline bool classof(const ConstNullPtrValVar*) { return true; } - static inline bool classof(const ConstantDataValVar* node) + static inline bool classof(const ConstDataValVar* node) { - return node->getNodeKind() == ConstantNullptrValNode; + return node->getNodeKind() == ConstNullptrValNode; } static inline bool classof(const ValVar* node) { - return node->getNodeKind() == ConstantNullptrValNode; + return node->getNodeKind() == ConstNullptrValNode; } static inline bool classof(const SVFVar* node) { - return node->getNodeKind() == ConstantNullptrValNode; + return node->getNodeKind() == ConstNullptrValNode; } static inline bool classof(const GenericPAGNodeTy* node) { - return node->getNodeKind() == ConstantNullptrValNode; + return node->getNodeKind() == ConstNullptrValNode; } static inline bool classof(const SVFBaseNode* node) { - return node->getNodeKind() == ConstantNullptrValNode; + return node->getNodeKind() == ConstNullptrValNode; } //@} /// Constructor - ConstantNullPtrValVar(const SVFValue* val, NodeID i, const ICFGNode* icn, - PNODEK ty = ConstantNullptrValNode) - : ConstantDataValVar(val, i, icn, ty) + ConstNullPtrValVar(NodeID i, const ICFGNode* icn, const SVFType* svfType) + : ConstDataValVar(i, icn, svfType, ConstNullptrValNode) { } @@ -1468,7 +1436,7 @@ class GlobalObjVar : public BaseObjVar private: /// Constructor to create empty ObjVar (for SVFIRReader/deserialization) - GlobalObjVar(NodeID i, PNODEK ty = GlobalObjNode) : BaseObjVar(i, ty) {} + GlobalObjVar(NodeID i, const ICFGNode* node) : BaseObjVar(i, node, GlobalObjNode) {} public: /// Methods for support type inquiry through isa, cast, and dyn_cast: @@ -1500,8 +1468,8 @@ class GlobalObjVar : public BaseObjVar //@} /// Constructor - GlobalObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, - PNODEK ty = GlobalObjNode): BaseObjVar(val, i, ti, ty) + GlobalObjVar(NodeID i, ObjTypeInfo* ti, const SVFType* svfType, const ICFGNode* node, + PNODEK ty = GlobalObjNode): BaseObjVar(i, ti, svfType, node, ty) { } @@ -1510,7 +1478,7 @@ class GlobalObjVar : public BaseObjVar virtual const std::string toString() const; }; -class ConstantAggObjVar: public BaseObjVar +class ConstAggObjVar : public BaseObjVar { friend class SVFIRWriter; friend class SVFIRReader; @@ -1518,37 +1486,36 @@ class ConstantAggObjVar: public BaseObjVar public: /// Methods for support type inquiry through isa, cast, and dyn_cast: //@{ - static inline bool classof(const ConstantAggObjVar*) + static inline bool classof(const ConstAggObjVar*) { return true; } static inline bool classof(const BaseObjVar* node) { - return node->getNodeKind() == ConstantAggObjNode; + return node->getNodeKind() == ConstAggObjNode; } static inline bool classof(const ObjVar* node) { - return node->getNodeKind() == ConstantAggObjNode; + return node->getNodeKind() == ConstAggObjNode; } static inline bool classof(const SVFVar* node) { - return node->getNodeKind() == ConstantAggObjNode; + return node->getNodeKind() == ConstAggObjNode; } static inline bool classof(const GenericPAGNodeTy* node) { - return node->getNodeKind() == ConstantAggObjNode; + return node->getNodeKind() == ConstAggObjNode; } static inline bool classof(const SVFBaseNode* node) { - return node->getNodeKind() == ConstantAggObjNode; + return node->getNodeKind() == ConstAggObjNode; } //@} /// Constructor - ConstantAggObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, - PNODEK ty = ConstantAggObjNode) - : BaseObjVar(val, i, ti, ty) + ConstAggObjVar(NodeID i, ObjTypeInfo* ti, const SVFType* svfType, const ICFGNode* node) + : BaseObjVar(i, ti, svfType, node, ConstAggObjNode) { } @@ -1566,18 +1533,18 @@ class ConstantAggObjVar: public BaseObjVar virtual const std::string toString() const; }; -class ConstantDataObjVar: public BaseObjVar +class ConstDataObjVar : public BaseObjVar { friend class SVFIRWriter; friend class SVFIRReader; protected: /// Constructor to create empty DummyObjVar (for SVFIRReader/deserialization) - ConstantDataObjVar(NodeID i) : BaseObjVar(i, ConstantDataObjNode) {} + ConstDataObjVar(NodeID i, const ICFGNode* node) : BaseObjVar(i, node, ConstDataObjNode) {} public: //@{ Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const ConstantDataObjVar*) + static inline bool classof(const ConstDataObjVar*) { return true; } @@ -1605,8 +1572,8 @@ class ConstantDataObjVar: public BaseObjVar //@} /// Constructor - ConstantDataObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, PNODEK ty = ConstantDataObjNode) - : BaseObjVar(val, i, ti, ty) + ConstDataObjVar(NodeID i, ObjTypeInfo* ti, const SVFType* svfType, const ICFGNode* node, PNODEK ty = ConstDataObjNode) + : BaseObjVar(i, ti, svfType, node, ty) { } @@ -1623,57 +1590,57 @@ class ConstantDataObjVar: public BaseObjVar virtual const std::string toString() const; }; -class ConstantFPObjVar: public ConstantDataObjVar +class ConstFPObjVar : public ConstDataObjVar { friend class SVFIRWriter; friend class SVFIRReader; private: /// Constructor to create empty DummyObjVar (for SVFIRReader/deserialization) - ConstantFPObjVar(NodeID i) : ConstantDataObjVar(i) {} + ConstFPObjVar(NodeID i, const ICFGNode* node) : ConstDataObjVar(i, node) {} private: float dval; public: //@{ Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const ConstantFPObjVar*) + static inline bool classof(const ConstFPObjVar*) { return true; } - static inline bool classof(const ConstantDataObjVar* node) + static inline bool classof(const ConstDataObjVar* node) { - return node->getNodeKind() == SVFVar::ConstantFPObjNode; + return node->getNodeKind() == SVFVar::ConstFPObjNode; } static inline bool classof(const BaseObjVar* node) { - return node->getNodeKind() == SVFVar::ConstantFPObjNode; + return node->getNodeKind() == SVFVar::ConstFPObjNode; } static inline bool classof(const SVFVar* node) { - return node->getNodeKind() == SVFVar::ConstantFPObjNode; + return node->getNodeKind() == SVFVar::ConstFPObjNode; } static inline bool classof(const ObjVar* node) { - return node->getNodeKind() == SVFVar::ConstantFPObjNode; + return node->getNodeKind() == SVFVar::ConstFPObjNode; } static inline bool classof(const GenericPAGNodeTy* node) { - return node->getNodeKind() == SVFVar::ConstantFPObjNode; + return node->getNodeKind() == SVFVar::ConstFPObjNode; } static inline bool classof(const SVFBaseNode* node) { - return node->getNodeKind() == SVFVar::ConstantFPObjNode; + return node->getNodeKind() == SVFVar::ConstFPObjNode; } //@} /// Constructor - ConstantFPObjVar(const SVFValue* val, NodeID i, double dv, ObjTypeInfo* ti, PNODEK ty = ConstantFPObjNode) - : ConstantDataObjVar(val, i, ti, ty), dval(dv) + ConstFPObjVar(NodeID i, double dv, ObjTypeInfo* ti, const SVFType* svfType, const ICFGNode* node) + : ConstDataObjVar(i, ti, svfType, node, ConstFPObjNode), dval(dv) { } @@ -1686,14 +1653,14 @@ class ConstantFPObjVar: public ConstantDataObjVar virtual const std::string toString() const; }; -class ConstantIntObjVar: public ConstantDataObjVar +class ConstIntObjVar : public ConstDataObjVar { friend class SVFIRWriter; friend class SVFIRReader; private: /// Constructor to create empty DummyObjVar (for SVFIRReader/deserialization) - ConstantIntObjVar(NodeID i) : ConstantDataObjVar(i) {} + ConstIntObjVar(NodeID i, const ICFGNode* node) : ConstDataObjVar(i, node) {} private: u64_t zval; @@ -1701,37 +1668,37 @@ class ConstantIntObjVar: public ConstantDataObjVar public: //@{ Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const ConstantIntObjVar*) + static inline bool classof(const ConstIntObjVar*) { return true; } - static inline bool classof(const ConstantDataObjVar* node) + static inline bool classof(const ConstDataObjVar* node) { - return node->getNodeKind() == SVFVar::ConstantIntObjNode; + return node->getNodeKind() == SVFVar::ConstIntObjNode; } static inline bool classof(const BaseObjVar* node) { - return node->getNodeKind() == SVFVar::ConstantIntObjNode; + return node->getNodeKind() == SVFVar::ConstIntObjNode; } static inline bool classof(const SVFVar* node) { - return node->getNodeKind() == SVFVar::ConstantIntObjNode; + return node->getNodeKind() == SVFVar::ConstIntObjNode; } static inline bool classof(const ObjVar* node) { - return node->getNodeKind() == SVFVar::ConstantIntObjNode; + return node->getNodeKind() == SVFVar::ConstIntObjNode; } static inline bool classof(const GenericPAGNodeTy* node) { - return node->getNodeKind() == SVFVar::ConstantIntObjNode; + return node->getNodeKind() == SVFVar::ConstIntObjNode; } static inline bool classof(const SVFBaseNode* node) { - return node->getNodeKind() == SVFVar::ConstantIntObjNode; + return node->getNodeKind() == SVFVar::ConstIntObjNode; } s64_t getSExtValue() const @@ -1747,8 +1714,8 @@ class ConstantIntObjVar: public ConstantDataObjVar //@} /// Constructor - ConstantIntObjVar(const SVFValue* val, NodeID i, s64_t sv, u64_t zv, ObjTypeInfo* ti, PNODEK ty = ConstantIntObjNode) - : ConstantDataObjVar(val, i, ti, ty), zval(zv), sval(sv) + ConstIntObjVar(NodeID i, s64_t sv, u64_t zv, ObjTypeInfo* ti, const SVFType* svfType, const ICFGNode* node) + : ConstDataObjVar(i, ti, svfType, node, ConstIntObjNode), zval(zv), sval(sv) { } @@ -1756,68 +1723,66 @@ class ConstantIntObjVar: public ConstantDataObjVar virtual const std::string toString() const; }; -class ConstantNullPtrObjVar: public ConstantDataObjVar +class ConstNullPtrObjVar : public ConstDataObjVar { friend class SVFIRWriter; friend class SVFIRReader; private: /// Constructor to create empty DummyObjVar (for SVFIRReader/deserialization) - ConstantNullPtrObjVar(NodeID i) : ConstantDataObjVar(i) {} + ConstNullPtrObjVar(NodeID i, const ICFGNode* node) : ConstDataObjVar(i, node) {} public: //@{ Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const ConstantNullPtrObjVar*) + static inline bool classof(const ConstNullPtrObjVar*) { return true; } - static inline bool classof(const ConstantDataObjVar* node) + static inline bool classof(const ConstDataObjVar* node) { - return node->getNodeKind() == SVFVar::ConstantNullptrObjNode; + return node->getNodeKind() == SVFVar::ConstNullptrObjNode; } static inline bool classof(const BaseObjVar* node) { - return node->getNodeKind() == SVFVar::ConstantNullptrObjNode; + return node->getNodeKind() == SVFVar::ConstNullptrObjNode; } static inline bool classof(const SVFVar* node) { - return node->getNodeKind() == SVFVar::ConstantNullptrObjNode; + return node->getNodeKind() == SVFVar::ConstNullptrObjNode; } static inline bool classof(const ObjVar* node) { - return node->getNodeKind() == SVFVar::ConstantNullptrObjNode; + return node->getNodeKind() == SVFVar::ConstNullptrObjNode; } static inline bool classof(const GenericPAGNodeTy* node) { - return node->getNodeKind() == SVFVar::ConstantNullptrObjNode; + return node->getNodeKind() == SVFVar::ConstNullptrObjNode; } static inline bool classof(const SVFBaseNode* node) { - return node->getNodeKind() == SVFVar::ConstantNullptrObjNode; + return node->getNodeKind() == SVFVar::ConstNullptrObjNode; } //@} /// Constructor - ConstantNullPtrObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti, PNODEK ty = ConstantNullptrObjNode) - : ConstantDataObjVar(val, i, ti, ty) + ConstNullPtrObjVar(NodeID i, ObjTypeInfo* ti, const SVFType* svfType, const ICFGNode* node) + : ConstDataObjVar(i, ti, svfType, node, ConstNullptrObjNode) { } - virtual bool isConstDataOrAggDataButNotNullPtr() const { return false; } - virtual const std::string toString() const; }; /* * Unique Return node of a procedure */ -class RetPN: public ValVar +class RetValPN : public ValVar { friend class SVFIRWriter; friend class SVFIRReader; @@ -1825,36 +1790,36 @@ class RetPN: public ValVar private: const CallGraphNode* callGraphNode; private: - /// Constructor to create empty RetPN (for SVFIRReader/deserialization) - RetPN(NodeID i) : ValVar(i, RetNode) {} + /// Constructor to create empty RetValPN (for SVFIRReader/deserialization) + RetValPN(NodeID i) : ValVar(i, RetValNode) {} public: //@{ Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const RetPN*) + static inline bool classof(const RetValPN*) { return true; } static inline bool classof(const SVFVar* node) { - return node->getNodeKind() == SVFVar::RetNode; + return node->getNodeKind() == SVFVar::RetValNode; } static inline bool classof(const ValVar* node) { - return node->getNodeKind() == SVFVar::RetNode; + return node->getNodeKind() == SVFVar::RetValNode; } static inline bool classof(const GenericPAGNodeTy* node) { - return node->getNodeKind() == SVFVar::RetNode; + return node->getNodeKind() == SVFVar::RetValNode; } static inline bool classof(const SVFBaseNode* node) { - return node->getNodeKind() == SVFVar::RetNode; + return node->getNodeKind() == SVFVar::RetValNode; } //@} /// Constructor - RetPN(NodeID i, const CallGraphNode* node); + RetValPN(NodeID i, const CallGraphNode* node, const SVFType* svfType, const ICFGNode* icn); inline const CallGraphNode* getCallGraphNode() const { @@ -1863,6 +1828,8 @@ class RetPN: public ValVar virtual const SVFFunction* getFunction() const; + virtual bool isPointer() const; + /// Return name of a LLVM value const std::string getValueName() const; @@ -1872,7 +1839,7 @@ class RetPN: public ValVar /* * Unique vararg node of a procedure */ -class VarArgPN: public ValVar +class VarArgValPN : public ValVar { friend class SVFIRWriter; friend class SVFIRReader; @@ -1880,41 +1847,48 @@ class VarArgPN: public ValVar const CallGraphNode* callGraphNode; private: - /// Constructor to create empty VarArgPN (for SVFIRReader/deserialization) - VarArgPN(NodeID i) : ValVar(i, VarargNode) {} + /// Constructor to create empty VarArgValPN (for SVFIRReader/deserialization) + VarArgValPN(NodeID i) : ValVar(i, VarargValNode) {} public: //@{ Methods for support type inquiry through isa, cast, and dyn_cast: - static inline bool classof(const VarArgPN*) + static inline bool classof(const VarArgValPN*) { return true; } static inline bool classof(const SVFVar* node) { - return node->getNodeKind() == SVFVar::VarargNode; + return node->getNodeKind() == SVFVar::VarargValNode; } static inline bool classof(const ValVar* node) { - return node->getNodeKind() == SVFVar::VarargNode; + return node->getNodeKind() == SVFVar::VarargValNode; } static inline bool classof(const GenericPAGNodeTy* node) { - return node->getNodeKind() == SVFVar::VarargNode; + return node->getNodeKind() == SVFVar::VarargValNode; } static inline bool classof(const SVFBaseNode* node) { - return node->getNodeKind() == SVFVar::VarargNode; + return node->getNodeKind() == SVFVar::VarargValNode; } //@} /// Constructor - VarArgPN(NodeID i, const CallGraphNode* node) : ValVar(nullptr, i, VarargNode), callGraphNode(node) {} + VarArgValPN(NodeID i, const CallGraphNode* node, const SVFType* svfType, const ICFGNode* icn) + : ValVar(i, svfType, icn, VarargValNode), callGraphNode(node) + { + } virtual const SVFFunction* getFunction() const; /// Return name of a LLVM value const std::string getValueName() const; + virtual bool isPointer() const + { + return true; + } virtual const std::string toString() const; }; @@ -1951,7 +1925,10 @@ class DummyValVar: public ValVar //@} /// Constructor - DummyValVar(NodeID i) : ValVar(nullptr, i, DummyValNode) {} + DummyValVar(NodeID i, const ICFGNode* node, const SVFType* svfType = SVFType::getSVFPtrType()) + : ValVar(i, svfType, node, DummyValNode) + { + } /// Return name of this node inline const std::string getValueName() const @@ -1959,6 +1936,11 @@ class DummyValVar: public ValVar return "dummyVal"; } + virtual bool isPointer() const + { + return true; + } + virtual const std::string toString() const; }; @@ -1972,7 +1954,7 @@ class DummyObjVar: public BaseObjVar private: /// Constructor to create empty DummyObjVar (for SVFIRReader/deserialization) - DummyObjVar(NodeID i) : BaseObjVar(i, DummyObjNode) {} + DummyObjVar(NodeID i, const ICFGNode* node) : BaseObjVar(i, node, DummyObjNode) {} public: //@{ Methods for support type inquiry through isa, cast, and dyn_cast: @@ -2004,8 +1986,8 @@ class DummyObjVar: public BaseObjVar //@} /// Constructor - DummyObjVar(NodeID i, ObjTypeInfo* ti, PNODEK ty = DummyObjNode) - : BaseObjVar(nullptr, i, ti, ty) + DummyObjVar(NodeID i, ObjTypeInfo* ti, const ICFGNode* node, const SVFType* svfType = SVFType::getSVFPtrType()) + : BaseObjVar(i, ti, svfType, node, DummyObjNode) { } @@ -2015,6 +1997,11 @@ class DummyObjVar: public BaseObjVar return "dummyObj"; } + virtual bool isPointer() const + { + return true; + } + virtual const std::string toString() const; }; diff --git a/SVF-osx/Release-build/lib/libSvfCore.a b/SVF-osx/Release-build/lib/libSvfCore.a index 4d613712..71ca385d 100644 Binary files a/SVF-osx/Release-build/lib/libSvfCore.a and b/SVF-osx/Release-build/lib/libSvfCore.a differ diff --git a/SVF-osx/Release-build/lib/libSvfLLVM.a b/SVF-osx/Release-build/lib/libSvfLLVM.a index 58106293..99fe320b 100644 Binary files a/SVF-osx/Release-build/lib/libSvfLLVM.a and b/SVF-osx/Release-build/lib/libSvfLLVM.a differ