38using namespace SVFUtil;
39using namespace LLVMUtil;
87 std::vector<AccessPath>
fields;
142 if (
arg->getType()->isPointerTy())
155 writeWrnMsg(
"Arg receiving new object must be pointer type");
162 if(
svfCallee->getName().find(
"iconv") != std::string::npos)
164 else if(
svfCallee->getName().find(
"bcopy") != std::string::npos)
170 if(SVFUtil::isa<PointerType>(cs->getType()))
189 if(SVFUtil::isa<PointerType>(cs->getType()))
192 else if(
svfCallee->getName().compare(
"dlsym") == 0)
207 const Value* src = cs->getArgOperand(1);
213 if (!SVFUtil::isa<GlobalVariable>(src))
216 auto *
glob = SVFUtil::cast<GlobalVariable>(src);
217 if (!
glob->hasInitializer() || !SVFUtil::isa<ConstantDataArray>(
glob->getInitializer()))
220 auto *
constarray = SVFUtil::cast<ConstantDataArray>(
glob->getInitializer());
230 else if(
svfCallee->getName().find(
"_ZSt29_Rb_tree_insert_and_rebalancebPSt18_Rb_tree_node_baseS0_RS_") != std::string::npos)
233 assert(
svfCall->arg_size() == 4 &&
"_Rb_tree_insert_and_rebalance should have 4 arguments.\n");
251 fields[
i].getConstantStructFldIdx());
269 assert((
forkedFun->arg_size() <= 2) &&
"Size of formal parameter of start routine should be one");
APOffset getConstantStructFldIdx() const
Get methods.
const SVFFunction * getFunction() const
Get function of this call node.
FunEntryICFGNode * getFunEntryICFGNode(const SVFFunction *fun)
Add a function entry node.
NodeID getValueNode(const SVFValue *V)
SymbolTableInfo * getSymbolInfo() const
NodeID getObjectNode(const SVFValue *V)
static LLVMModuleSet * getLLVMModuleSet()
CallICFGNode * getCallICFGNode(const Instruction *cs)
get a call node
LLVMContext & getContext() const
SVFInstruction * getSVFInstruction(const Instruction *inst) const
ObjTypeInference * getTypeInference()
SVFValue * getSVFValue(const Value *value)
const Type * inferObjType(const Value *var)
get or infer the type of the object pointed by the value
const CallGraphNode * getCallGraphNode() const
const SVFFunction * getDefFunForMultipleModule() const
SVFIR * getPAG() const
Return SVFIR.
void addStoreEdge(NodeID src, NodeID dst)
Add Store edge.
void addLoadEdge(NodeID src, NodeID dst)
Add Load edge.
AddrStmt * addAddrWithHeapSz(NodeID src, NodeID dst, const CallBase *cs)
Add Address edge from ext call with args like "%5 = call i8* @malloc(i64 noundef 5)".
LLVMModuleSet * llvmModuleSet()
void addThreadForkEdge(NodeID src, NodeID dst, const CallICFGNode *cs, const FunEntryICFGNode *entry)
Add Thread fork edge for parameter passing.
AccessPath getAccessPathFromBaseNode(NodeID nodeId)
const Value * getBaseValueForExtArg(const Value *V)
Get the base value of (i8* src and i8* dst) for external argument (e.g. memcpy(i8* dst,...
virtual void handleExtCall(const CallBase *cs, const SVFFunction *svfCallee)
virtual const Type * getBaseTypeAndFlattenedFields(const Value *V, std::vector< AccessPath > &fields, const Value *szValue)
Handle external call.
CopyStmt * addCopyEdge(NodeID src, NodeID dst, CopyStmt::CopyKind kind)
NodeID getValueNode(const Value *V)
Get different kinds of node.
virtual void addComplexConsForExt(Value *D, Value *S, const Value *sz)
NodeID getGepValVar(const Value *val, const AccessPath &ap, const SVFType *elementType)
NodeID addConstantIntValNode(const SVFValue *curInst, const std::pair< s64_t, u64_t > &intValue, const NodeID i, const ICFGNode *icfgNode)
SVFTypeLocSetsPair & getTypeLocSetsMap(NodeID argId)
Given an arg NodeId, get its base SVFType* and all its field location sets.
NodeID addDummyObjNode(const SVFType *type)
SymID getValSym(const SVFValue *val)
Get different kinds of syms.
const SVFType * getFlatternedElemType(const SVFType *baseType, u32_t flatten_idx)
Return the type of a flattened element given a flattened index.
u32_t getNumOfFlattenElements(const SVFType *T)
Number of flattened elements of an array or struct.
bool hasValSym(const SVFValue *val)
const Function * getProgFunction(const std::string &funName)
Get program entry function from module.
const Value * stripConstantCasts(const Value *val)
Strip off the constant casts.
bool isHeapAllocExtCallViaRet(const Instruction *inst)
std::pair< s64_t, u64_t > getIntegerValue(const ConstantInt *intValue)
bool isConstDataOrAggData(const Value *val)
Return true if the value refers to constant data, e.g., i32 0.
bool isHeapAllocExtCallViaArg(const Instruction *inst)
bool isMemsetExtFun(const SVFFunction *fun)
bool isMemcpyExtFun(const SVFFunction *fun)
u32_t getHeapAllocHoldingArgPosition(const SVFFunction *fun)
Get the position of argument that holds an allocated heap object.
bool isThreadForkCall(const CallICFGNode *inst)
void writeWrnMsg(const std::string &msg)
Writes a message run through wrnMsg.
const ValVar * getActualParmAtForkSite(const CallICFGNode *cs)
Return sole argument of the thread routine.
const ValVar * getForkedFun(const CallICFGNode *inst)
Return thread fork function.
llvm::Value Value
LLVM Basic classes.
llvm::IRBuilder IRBuilder
llvm::GetElementPtrInst GetElementPtrInst
llvm::ConstantInt ConstantInt
llvm::LLVMContext LLVMContext