Static Value-Flow Analysis
Loading...
Searching...
No Matches
Macros | Functions | Variables
ObjTypeInference.cpp File Reference
#include "SVF-LLVM/ObjTypeInference.h"
#include "SVF-LLVM/BasicTypes.h"
#include "SVF-LLVM/LLVMModule.h"
#include "SVF-LLVM/LLVMUtil.h"
#include "SVF-LLVM/CppUtil.h"
#include "Util/Casting.h"

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

const TypeinfersiteToType (const Value *val)
 

Variables

const std::string TYPEMALLOC = "TYPE_MALLOC"
 

Macro Definition Documentation

◆ ABORT_IFNOT

#define ABORT_IFNOT (   condition,
  msg 
)
Value:
do \
{ \
if (!(condition)) \
} while (0)
llvm::IRBuilder IRBuilder
Definition BasicTypes.h:74

Definition at line 50 of file ObjTypeInference.cpp.

52 { \
53 if (!(condition)) \
55 } while (0)

◆ ABORT_MSG

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

Definition at line 44 of file ObjTypeInference.cpp.

46 { \
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:77

Definition at line 38 of file ObjTypeInference.cpp.

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

◆ infersiteToType()

const Type * infersiteToType ( const Value val)

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

Definition at line 85 of file ObjTypeInference.cpp.

86{
87 assert(val && "value cannot be empty");
88 if (SVFUtil::isa<LoadInst, StoreInst>(val))
89 {
90 return llvm::getLoadStoreType(const_cast<Value *>(val));
91 }
92 else if (const auto *gepInst = SVFUtil::dyn_cast<GetElementPtrInst>(val))
93 {
94 return gepInst->getSourceElementType();
95 }
96 else if (const auto *call = SVFUtil::dyn_cast<CallBase>(val))
97 {
98 return call->getFunctionType();
99 }
100 else if (const auto *allocaInst = SVFUtil::dyn_cast<AllocaInst>(val))
101 {
102 return allocaInst->getAllocatedType();
103 }
104 else if (const auto *globalValue = SVFUtil::dyn_cast<GlobalValue>(val))
105 {
106 return globalValue->getValueType();
107 }
108 else
109 {
110 ABORT_MSG("unknown value:" + dumpValueAndDbgInfo(val));
111 }
112}
#define ABORT_MSG(msg)
std::string dumpValueAndDbgInfo(const Value *val)
Definition LLVMUtil.cpp:606
llvm::Value Value
LLVM Basic classes.
Definition BasicTypes.h:82

Variable Documentation

◆ TYPEMALLOC

const std::string TYPEMALLOC = "TYPE_MALLOC"

Definition at line 81 of file ObjTypeInference.cpp.