Static Value-Flow Analysis
Classes | Namespaces | Macros | Typedefs | Functions
SVFFileSystem.h File Reference
#include "Graphs/GenericGraph.h"
#include "Util/SVFUtil.h"
#include "Util/cJSON.h"
#include <type_traits>

Go to the source code of this file.

Classes

class  SVF::WriterPtrPool< T >
 Bookkeeping class to keep track of the IDs of objects that doesn't have any ID. E.g., SVFValue, XXXEdge. More...
 
class  SVF::GenericGraphWriter< NodeTy, EdgeTy >
 
class  SVF::ICFGWriter
 
class  SVF::SVFModuleWriter
 
class  SVF::SVFIRWriter
 
struct  SVF::KindBaseHelper< T, typename >
 Type trait to get base type. Helper struct to detect inheritance from Node/Edge. More...
 
class  SVF::ReaderIDToObjMap< T >
 Keeps a map from IDs to T objects, such as XXNode. More...
 
class  SVF::ReaderPtrPool< T >
 Reverse of WriterPtrPool where T is object type without ID field. More...
 
class  SVF::GenericGraphReader< NodeTy, EdgeTy >
 
class  SVF::SymbolTableInfoReader
 
class  SVF::ICFGReader
 
class  SVF::SVFModuleReader
 
class  SVF::SVFIRReader
 

Namespaces

 SVF
 for isBitcode
 

Macros

#define ABORT_MSG(reason)
 
#define ABORT_IFNOT(condition, reason)
 
#define SVFIR_DEBUG   1 /* Turn this on if you're debugging SVFWriter */
 
#define ENSURE_NOT_VISITED(graph)
 
#define FIELD_NAME_ITEM(field)   #field, (field)
 
#define JSON_FIELD_OR(json, field, default)   ((json) ? (json)->field : default)
 
#define JSON_KEY(json)   JSON_FIELD_OR(json, string, "NULL")
 
#define JSON_CHILD(json)   JSON_FIELD_OR(json, child, nullptr)
 
#define JSON_WRITE_FIELD(root, objptr, field)    jsonAddJsonableToObject(root, #field, (objptr)->field)
 
#define JSON_READ_OBJ_WITH_NAME(json, obj, name)
 
#define JSON_READ_OBJ_WITH_NAME_FWD(json, obj, name)
 
#define JSON_READ_OBJ(json, obj)   JSON_READ_OBJ_WITH_NAME(json, obj, #obj)
 
#define JSON_READ_OBJ_FWD(json, obj)    JSON_READ_OBJ_WITH_NAME_FWD(json, obj, #obj)
 
#define JSON_DEF_READ_FWD(json, type, obj, ...)
 
#define JSON_READ_FIELD_FWD(json, objptr, field)    JSON_READ_OBJ_WITH_NAME_FWD(json, (objptr)->field, #field)
 
#define CHECK_JSON_KEY_EQUALS(obj, key)
 
#define CHECK_JSON_KEY(obj)   CHECK_JSON_KEY_EQUALS(obj, #obj)
 
#define jsonForEach(field, array)    for (const cJSON* field = JSON_CHILD(array); field; field = field->next)
 
#define KIND_BASE(B, KindGetter)
 

Typedefs

using SVF::GenericICFGWriter = GenericGraphWriter< ICFGNode, ICFGEdge >
 
using SVF::IRGraphWriter = GenericGraphWriter< SVFVar, SVFStmt >
 
using SVF::CHGraphWriter = GenericGraphWriter< CHNode, CHEdge >
 
template<typename T >
using SVF::KindBaseT = typename KindBaseHelper< T >::type
 
using SVF::GenericICFGReader = GenericGraphReader< ICFGNode, ICFGEdge >
 
using SVF::CHGraphReader = GenericGraphReader< CHNode, CHEdge >
 
using SVF::IRGraphReader = GenericGraphReader< SVFVar, SVFStmt >
 

Functions

bool SVF::jsonIsBool (const cJSON *item)
 
bool SVF::jsonIsBool (const cJSON *item, bool &flag)
 
bool SVF::jsonIsNumber (const cJSON *item)
 
bool SVF::jsonIsString (const cJSON *item)
 
bool SVF::jsonIsNullId (const cJSON *item)
 
bool SVF::jsonIsArray (const cJSON *item)
 
bool SVF::jsonIsMap (const cJSON *item)
 
bool SVF::jsonIsObject (const cJSON *item)
 
bool SVF::jsonKeyEquals (const cJSON *item, const char *key)
 
std::pair< const cJSON *, const cJSON * > SVF::jsonUnpackPair (const cJSON *item)
 
double SVF::jsonGetNumber (const cJSON *item)
 
cJSONSVF::jsonCreateNullId ()
 
cJSONSVF::jsonCreateObject ()
 
cJSONSVF::jsonCreateArray ()
 
cJSONSVF::jsonCreateString (const char *str)
 
cJSONSVF::jsonCreateIndex (size_t index)
 
cJSONSVF::jsonCreateBool (bool flag)
 
cJSONSVF::jsonCreateNumber (double num)
 
bool SVF::jsonAddPairToMap (cJSON *obj, cJSON *key, cJSON *value)
 
bool SVF::jsonAddItemToObject (cJSON *obj, const char *name, cJSON *item)
 
bool SVF::jsonAddItemToArray (cJSON *array, cJSON *item)
 
bool SVF::jsonAddNumberToObject (cJSON *obj, const char *name, double number)
 Helper function to write a number to a JSON object. More...
 
bool SVF::jsonAddStringToObject (cJSON *obj, const char *name, const char *str)
 
bool SVF::jsonAddStringToObject (cJSON *obj, const char *name, const std::string &s)
 
 SVF::KIND_BASE (SVFType, getKind)
 
 SVF::KIND_BASE (SVFValue, getKind)
 
 SVF::KIND_BASE (SVFVar, getNodeKind)
 
 SVF::KIND_BASE (SVFStmt, getEdgeKind)
 
 SVF::KIND_BASE (ICFGNode, getNodeKind)
 
 SVF::KIND_BASE (ICFGEdge, getEdgeKind)
 
 SVF::KIND_BASE (CHNode, getNodeKind)
 
 SVF::KIND_BASE (CHEdge, getEdgeKind)
 

Macro Definition Documentation

◆ ABORT_IFNOT

#define ABORT_IFNOT (   condition,
  reason 
)
Value:
do \
{ \
if (!(condition)) \
ABORT_MSG(reason); \
} while (0)

Definition at line 39 of file SVFFileSystem.h.

◆ ABORT_MSG

#define ABORT_MSG (   reason)
Value:
do \
{ \
SVFUtil::errs() << __FILE__ << ':' << __LINE__ << ": " << reason \
<< '\n'; \
abort(); \
} while (0)
std::ostream & errs()
Overwrite llvm::errs()
Definition: SVFUtil.h:56

Definition at line 32 of file SVFFileSystem.h.

◆ CHECK_JSON_KEY

#define CHECK_JSON_KEY (   obj)    CHECK_JSON_KEY_EQUALS(obj, #obj)

Definition at line 96 of file SVFFileSystem.h.

◆ CHECK_JSON_KEY_EQUALS

#define CHECK_JSON_KEY_EQUALS (   obj,
  key 
)
Value:
"Expect json key: " << key << ", but get " << JSON_KEY(obj));
#define ABORT_IFNOT(condition, reason)
Definition: SVFFileSystem.h:39
#define JSON_KEY(json)
Definition: SVFFileSystem.h:64
bool jsonKeyEquals(const cJSON *item, const char *key)

Definition at line 93 of file SVFFileSystem.h.

◆ ENSURE_NOT_VISITED

#define ENSURE_NOT_VISITED (   graph)
Value:
do \
{ \
static std::set<decltype(graph)> visited; \
bool inserted = visited.insert(graph).second; \
ABORT_IFNOT(inserted, #graph << " already visited!"); \
} while (0)
set(THREADS_PREFER_PTHREAD_FLAG ON) find_package(Threads REQUIRED) add_llvm_executable(wpa wpa.cpp) target_link_libraries(wpa PUBLIC $
Definition: CMakeLists.txt:1

Definition at line 48 of file SVFFileSystem.h.

◆ FIELD_NAME_ITEM

#define FIELD_NAME_ITEM (   field)    #field, (field)

Definition at line 61 of file SVFFileSystem.h.

◆ JSON_CHILD

#define JSON_CHILD (   json)    JSON_FIELD_OR(json, child, nullptr)

Definition at line 65 of file SVFFileSystem.h.

◆ JSON_DEF_READ_FWD

#define JSON_DEF_READ_FWD (   json,
  type,
  obj,
  ... 
)
Value:
type obj __VA_ARGS__; \
JSON_READ_OBJ_FWD(json, obj)
newitem type
Definition: cJSON.cpp:2739
global_error json
Definition: cJSON.cpp:1103

Definition at line 88 of file SVFFileSystem.h.

◆ JSON_FIELD_OR

#define JSON_FIELD_OR (   json,
  field,
  default 
)    ((json) ? (json)->field : default)

Definition at line 63 of file SVFFileSystem.h.

◆ JSON_KEY

#define JSON_KEY (   json)    JSON_FIELD_OR(json, string, "NULL")

Definition at line 64 of file SVFFileSystem.h.

◆ JSON_READ_FIELD_FWD

#define JSON_READ_FIELD_FWD (   json,
  objptr,
  field 
)     JSON_READ_OBJ_WITH_NAME_FWD(json, (objptr)->field, #field)

Definition at line 91 of file SVFFileSystem.h.

◆ JSON_READ_OBJ

#define JSON_READ_OBJ (   json,
  obj 
)    JSON_READ_OBJ_WITH_NAME(json, obj, #obj)

Definition at line 85 of file SVFFileSystem.h.

◆ JSON_READ_OBJ_FWD

#define JSON_READ_OBJ_FWD (   json,
  obj 
)     JSON_READ_OBJ_WITH_NAME_FWD(json, obj, #obj)

Definition at line 86 of file SVFFileSystem.h.

◆ JSON_READ_OBJ_WITH_NAME

#define JSON_READ_OBJ_WITH_NAME (   json,
  obj,
  name 
)
Value:
do \
{ \
ABORT_IFNOT(jsonKeyEquals(json, name), \
"Expect name '" << name << "', got " << JSON_KEY(json)); \
SVFIRReader::readJson(json, obj); \
} while (0)
const char *const name
Definition: cJSON.h:264

Definition at line 70 of file SVFFileSystem.h.

◆ JSON_READ_OBJ_WITH_NAME_FWD

#define JSON_READ_OBJ_WITH_NAME_FWD (   json,
  obj,
  name 
)
Value:
do \
{ \
JSON_READ_OBJ_WITH_NAME(json, obj, name); \
json = (json)->next; \
} while (0)
item next
Definition: cJSON.cpp:2224

Definition at line 78 of file SVFFileSystem.h.

◆ JSON_WRITE_FIELD

#define JSON_WRITE_FIELD (   root,
  objptr,
  field 
)     jsonAddJsonableToObject(root, #field, (objptr)->field)

Definition at line 67 of file SVFFileSystem.h.

◆ jsonForEach

#define jsonForEach (   field,
  array 
)     for (const cJSON* field = JSON_CHILD(array); field; field = field->next)

Definition at line 226 of file SVFFileSystem.h.

◆ KIND_BASE

#define KIND_BASE (   B,
  KindGetter 
)
Value:
template <typename T> \
struct KindBaseHelper<T, std::enable_if_t<std::is_base_of<B, T>::value>> \
{ \
using type = B; \
static inline s64_t getKind(T* p) \
{ \
return {p->KindGetter()}; \
} \
}
cJSON * p
Definition: cJSON.cpp:2559
signed long long s64_t
Definition: GeneralType.h:49

Definition at line 659 of file SVFFileSystem.h.

◆ SVFIR_DEBUG

#define SVFIR_DEBUG   1 /* Turn this on if you're debugging SVFWriter */

Definition at line 46 of file SVFFileSystem.h.