Static Value-Flow Analysis
|
Dwarf based CHG. More...
#include <DCHG.h>
Static Public Member Functions | |
static const DIType * | stripQualifiers (const DIType *) |
Returns the DIType beneath the qualifiers. Does not strip away "DW_TAG_members". | |
static const DIType * | stripArray (const DIType *) |
Returns the DIType beneath all qualifiers and arrays. | |
static bool | teq (const DIType *t1, const DIType *t2) |
static std::string | diTypeToStr (const DIType *) |
Returns a human-readable version of the DIType. | |
static bool | isAgg (const DIType *t) |
static bool | classof (const CommonCHGraph *chg) |
Protected Attributes | |
bool | extended = false |
Whether this CHG is an extended CHG (first-field). Set by buildCHG. | |
Map< const DIType *, DCHNode * > | diTypeToNodeMap |
Maps DITypes to their nodes. | |
Map< const GlobalObjVar *, const DIType * > | vtblToTypeMap |
Maps VTables to the DIType associated with them. | |
Map< const DIType *, NodeBS > | chaMap |
Maps types to all children (i.e. CHA). | |
Map< const DIType *, NodeBS > | chaFFMap |
Maps types to all children but also considering first field. | |
Map< const DIType *, VTableSet > | vtblCHAMap |
Maps types to a set with their vtable and all their children's. | |
Map< const CallICFGNode *, VFunSet > | csCHAMap |
Maps callsites to a set of potential virtual functions based on CHA. | |
Map< const DIType *, const DIType * > | canonicalTypeMap |
Maps types to their canonical type (many-to-one). | |
Set< const DIType * > | canonicalTypes |
Set of all possible canonical types (i.e. values of canonicalTypeMap). | |
Map< const DIType *, std::vector< const DIType * > > | fieldTypes |
Maps types to their flattened fields' types. | |
Map< const DIType *, Set< const DIType * > > | containingAggs |
Maps aggregate types to all the aggregate types it transitively contains. | |
![]() | |
CHGKind | kind |
![]() | |
IDToNodeMapTy | IDToNodeMap |
node map | |
Private Member Functions | |
void | handleDIBasicType (const DIBasicType *basicType) |
Construction helper to process DIBasicTypes. | |
void | handleDICompositeType (const DICompositeType *compositeType) |
Construction helper to process DICompositeTypes. | |
void | handleDIDerivedType (const DIDerivedType *derivedType) |
Construction helper to process DIDerivedTypes. | |
void | handleDISubroutineType (const DISubroutineType *subroutineType) |
Construction helper to process DISubroutineTypes. | |
void | buildVTables () |
Finds all defined virtual functions and attaches them to nodes. | |
const NodeBS & | cha (const DIType *type, bool firstField) |
Returns a set of all children of type (CHA). Also gradually builds chaMap. | |
void | handleTypedef (const DIType *typedefType) |
Attaches the typedef(s) to the base node. | |
void | flatten (const DICompositeType *type) |
Populates fieldTypes for type and all its elements. | |
void | gatherAggs (const DICompositeType *type) |
Populates containingAggs for type and all its elements. | |
DCHNode * | getOrCreateNode (const DIType *type) |
Creates a node from type, or returns it if it exists. | |
const DIType * | getCSStaticType (CallBase *cs) const |
Retrieves the metadata associated with a virtual callsite. | |
const DIType * | getCSStaticType (const CallICFGNode *cs) const |
bool | hasNode (const DIType *type) |
Checks if a node exists for type. | |
DCHNode * | getNode (const DIType *type) |
Returns the node for type (nullptr if it doesn't exist). | |
DCHEdge * | addEdge (const DIType *t1, const DIType *t2, DCHEdge::GEdgeKind et) |
Creates an edge between from t1 to t2. | |
DCHEdge * | hasEdge (const DIType *t1, const DIType *t2, DCHEdge::GEdgeKind et) |
Returns the edge between t1 and t2 if it exists, returns nullptr otherwise. | |
Private Attributes | |
NodeID | numTypes |
Number of types (nodes) in the graph. | |
Additional Inherited Members | |
![]() | |
enum | CHGKind { Standard , DI } |
![]() | |
typedef DCHNode | NodeType |
typedef DCHEdge | EdgeType |
typedef OrderedMap< NodeID, NodeType * > | IDToNodeMapTy |
NodeID to GenericNode map. | |
typedef IDToNodeMapTy::iterator | iterator |
Node Iterators. | |
typedef IDToNodeMapTy::const_iterator | const_iterator |
![]() | |
u32_t | edgeNum |
total num of node | |
u32_t | nodeNum |
total num of edge | |
Creates an edge between from t1 to t2.
Definition at line 435 of file DCHG.cpp.
|
virtual |
Builds the CHG from DWARF debug information. extend determines whether to extend the CHG with first field edges.
Definition at line 471 of file DCHG.cpp.
|
private |
Finds all defined virtual functions and attaches them to nodes.
Definition at line 166 of file DCHG.cpp.
Returns a set of all children of type (CHA). Also gradually builds chaMap.
Definition at line 225 of file DCHG.cpp.
|
inlinestatic |
|
inlineoverridevirtual |
Implements SVF::CommonCHGraph.
Definition at line 257 of file DCHG.h.
|
inlineoverridevirtual |
Implements SVF::CommonCHGraph.
Returns a human-readable version of the DIType.
Definition at line 969 of file DCHG.cpp.
|
inline |
Definition at line 243 of file DCHG.h.
|
private |
Populates fieldTypes for type and all its elements.
Definition at line 270 of file DCHG.cpp.
|
private |
Populates containingAggs for type and all its elements.
Definition at line 355 of file DCHG.cpp.
Returns all the aggregates contained (transitively) in base.
Definition at line 349 of file DCHG.h.
Returns the type representing all qualifier-variations of t. This should only matter in the case of DerivedTypes where qualifiers and have qualified base types cause a mess.
Definition at line 724 of file DCHG.cpp.
|
inlineprivate |
|
overridevirtual |
Implements SVF::CommonCHGraph.
Definition at line 549 of file DCHG.cpp.
|
overridevirtual |
Implements SVF::CommonCHGraph.
Definition at line 566 of file DCHG.cpp.
Returns the type of field number idx (flattened) in base.
Definition at line 296 of file DCHG.h.
Returns a vector of the types of all fields in base.
Returns the node for type (nullptr if it doesn't exist).
Definition at line 427 of file DCHG.h.
Creates a node from type, or returns it if it exists.
Definition at line 408 of file DCHG.cpp.
|
overridevirtual |
Implements SVF::CommonCHGraph.
Definition at line 594 of file DCHG.cpp.
|
private |
Construction helper to process DIBasicTypes.
|
private |
Construction helper to process DICompositeTypes.
Definition at line 27 of file DCHG.cpp.
|
private |
Construction helper to process DIDerivedTypes.
Definition at line 97 of file DCHG.cpp.
|
private |
Construction helper to process DISubroutineTypes.
Attaches the typedef(s) to the base node.
Definition at line 138 of file DCHG.cpp.
Returns true if a is a transitive base of b. firstField determines whether to consider first-field edges.
Returns true if f is a field of b (fields from getFieldTypes).
Definition at line 688 of file DCHG.cpp.
Definition at line 942 of file DCHG.cpp.
void DCHGraph::print | ( | void | ) |
Definition at line 1142 of file DCHG.cpp.
Returns the DIType beneath all qualifiers and arrays.
Definition at line 818 of file DCHG.cpp.
Returns the DIType beneath the qualifiers. Does not strip away "DW_TAG_members".
Definition at line 765 of file DCHG.cpp.
Returns true if t1 and t2 are equivalent, ignoring qualifiers. For equality... Tags always need to be equal. DIBasicType: shallow pointer equality. DIDerivedType: base types (teq). DICompositeType: shallow pointer equality. DISubroutineType: shallow pointer equality.
Definition at line 830 of file DCHG.cpp.
|
protected |
|
private |
|
protected |