Static Value-Flow Analysis
Loading...
Searching...
No Matches
ObjTypeInference.cpp File Reference

Go to the source code of this file.

Macros

#define TYPE_DEBUG   0 /* Turn this on if you're debugging type inference */
#define ERR_MSG(msg)
#define ABORT_MSG(msg)
#define ABORT_IFNOT(condition, msg)
#define WARN_MSG(msg)
#define WARN_IFNOT(condition, msg)

Functions

static bool hasUseList (const Value *v)
const Type * infersiteToType (const Value *val)

Variables

const std::string TYPEMALLOC = "TYPE_MALLOC"

Macro Definition Documentation

◆ ABORT_IFNOT

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

Definition at line 50 of file ObjTypeInference.cpp.

50#define ABORT_IFNOT(condition, msg) \
51 do \
52 { \
53 if (!(condition)) \
54 ABORT_MSG(msg); \
55 } while (0)

◆ ABORT_MSG

#define ABORT_MSG ( msg)
Value:
do \
{ \
ERR_MSG(msg); \
abort(); \
} while (0)

Definition at line 44 of file ObjTypeInference.cpp.

44#define ABORT_MSG(msg) \
45 do \
46 { \
47 ERR_MSG(msg); \
48 abort(); \
49 } while (0)

◆ ERR_MSG

#define ERR_MSG ( msg)
Value:
do \
{ \
SVFUtil::errs() << SVFUtil::errMsg("Error ") << __FILE__ << ':' \
<< __LINE__ << ": " << (msg) << '\n'; \
} while (0)
std::string errMsg(const std::string &msg)
Print error message by converting a string into red string output.
Definition SVFUtil.cpp:98

Definition at line 38 of file ObjTypeInference.cpp.

38#define ERR_MSG(msg) \
39 do \
40 { \
41 SVFUtil::errs() << SVFUtil::errMsg("Error ") << __FILE__ << ':' \
42 << __LINE__ << ": " << (msg) << '\n'; \
43 } while (0)

◆ TYPE_DEBUG

#define TYPE_DEBUG   0 /* Turn this on if you're debugging type inference */

Definition at line 37 of file ObjTypeInference.cpp.

◆ WARN_IFNOT

#define WARN_IFNOT ( condition,
msg )

Definition at line 72 of file ObjTypeInference.cpp.

◆ WARN_MSG

#define WARN_MSG ( msg)

Definition at line 71 of file ObjTypeInference.cpp.

Function Documentation

◆ hasUseList()

bool hasUseList ( const Value * v)
inlinestatic

Definition at line 92 of file ObjTypeInference.cpp.

93{
95}
LLVM_NODISCARD bool isa(const Y &Val)
Definition Casting.h:241

◆ infersiteToType()

const Type * infersiteToType ( const Value * val)

Determine type based on infer site https://llvm.org/docs/OpaquePointers.html#migration-instructions

Definition at line 103 of file ObjTypeInference.cpp.

104{
105 assert(val && "value cannot be empty");
107 {
108 return llvm::getLoadStoreType(const_cast<Value *>(val));
109 }
110 else if (const auto *gepInst = SVFUtil::dyn_cast<GetElementPtrInst>(val))
111 {
112 return gepInst->getSourceElementType();
113 }
114 else if (const auto *call = SVFUtil::dyn_cast<CallBase>(val))
115 {
116 return call->getFunctionType();
117 }
118 else if (const auto *allocaInst = SVFUtil::dyn_cast<AllocaInst>(val))
119 {
120 return allocaInst->getAllocatedType();
121 }
122 else if (const auto *globalValue = SVFUtil::dyn_cast<GlobalValue>(val))
123 {
124 return globalValue->getValueType();
125 }
126 else
127 {
128 ABORT_MSG("unknown value:" + dumpValueAndDbgInfo(val));
129 }
130}
#define ABORT_MSG(msg)
std::string dumpValueAndDbgInfo(const Value *val)
Definition LLVMUtil.cpp:634
LLVM_NODISCARD std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > dyn_cast(const Y &Val)
Definition Casting.h:405
llvm::Value Value
LLVM Basic classes.
Definition BasicTypes.h:80

Variable Documentation

◆ TYPEMALLOC

const std::string TYPEMALLOC = "TYPE_MALLOC"

Definition at line 99 of file ObjTypeInference.cpp.