Static Value-Flow Analysis
Loading...
Searching...
No Matches
SVF::LLVMUtil Namespace Reference

Functions

bool isCallSite (const Instruction *inst)
 Whether an instruction is a call or invoke instruction.
bool isCallSite (const Value *val)
 Whether an instruction is a call or invoke instruction.
double getDoubleValue (const ConstantFP *fpValue)
std::pair< s64_t, u64_t > getIntegerValue (const ConstantInt *intValue)
const CallBase * getLLVMCallSite (const Value *value)
 Return LLVM callsite given a value.
const Function * getCallee (const CallBase *cs)
const Function * getLLVMFunction (const Value *val)
 Return LLVM function if this value is.
const Function * getProgFunction (const std::string &funName)
 Get program entry function from module.
bool isProgEntryFunction (const Function *fun)
 Check whether a function is an entry function (i.e., main).
bool isBlackholeSym (const Value *val)
 Check whether this value is a black hole.
bool isNullPtrSym (const Value *val)
 Check whether this value is a black hole.
u32_t getNumOfElements (const Type *ety)
 Return size of this object based on LLVM value.
bool isObject (const Value *ref)
 Return true if this value refers to a object.
bool isUncalledFunction (const Function *fun)
 whether this is a function without any possible caller?
bool ArgInDeadFunction (const Value *val)
 whether this is an argument in dead function
bool ArgInProgEntryFunction (const Value *val)
 Return true if this is an argument of a program entry function (e.g. main).
bool isPtrInUncalledFunction (const Value *value)
 Return true if this is value in a dead function (function without any caller).
bool isNoCallerFunction (const Function *fun)
 Function does not have any possible caller in the call graph.
bool isArgOfUncalledFunction (const Value *val)
 Return true if the argument in a function does not have a caller.
bool basicBlockHasRetInst (const BasicBlock *bb)
 Return true if the function has a return instruction.
bool functionDoesNotRet (const Function *fun)
void getFunReachableBBs (const Function *svfFun, std::vector< const SVFBasicBlock * > &bbs)
 Get reachable basic block from function entry.
const Value * stripConstantCasts (const Value *val)
 Strip off the constant casts.
const Value * stripAllCasts (const Value *val)
 Strip off the all casts.
const Value * getFirstUseViaCastInst (const Value *val)
const ConstantExpr * isGepConstantExpr (const Value *val)
 Return corresponding constant expression, otherwise return nullptr.
const ConstantExpr * isInt2PtrConstantExpr (const Value *val)
const ConstantExpr * isPtr2IntConstantExpr (const Value *val)
const ConstantExpr * isCastConstantExpr (const Value *val)
const ConstantExpr * isSelectConstantExpr (const Value *val)
const ConstantExpr * isTruncConstantExpr (const Value *val)
const ConstantExpr * isCmpConstantExpr (const Value *val)
const ConstantExpr * isBinaryConstantExpr (const Value *val)
const ConstantExpr * isUnaryConstantExpr (const Value *val)
static DataLayout * getDataLayout (Module *mod)
static llvm::Triple getTargetTriple (const Module *mod)
static TargetABI detectTargetABI (const llvm::Triple &triple)
void getNextInsts (const Instruction *curInst, std::vector< const Instruction * > &instList)
 Get the next instructions following control flow.
bool isNoPrecessorBasicBlock (const BasicBlock *bb)
bool isIRFile (const std::string &filename)
 Check whether a file is an LLVM IR file.
void processArguments (int argc, char **argv, int &arg_num, char **arg_value, std::vector< std::string > &moduleNameVec)
 Parse argument for multi-module analysis.
const std::string getSourceLoc (const Value *val)
const std::string getSourceLocOfFunction (const Function *F)
bool isIntrinsicInst (const Instruction *inst)
 Return true if it is an intrinsic instruction.
bool isIntrinsicFun (const Function *func)
std::vector< const Function * > getCalledFunctions (const Function *F)
 Get all called funcions in a parent function.
std::string restoreFuncName (std::string funcName)
bool isExtCall (const Function *fun)
bool isMemcpyExtFun (const Function *fun)
bool isMemsetExtFun (const Function *fun)
u32_t getHeapAllocHoldingArgPosition (const Function *fun)
const FunObjVar * getFunObjVar (const std::string &name)
bool isConstDataOrAggData (const Value *val)
 Return true if the value refers to constant data, e.g., i32 0.
const Value * getGlobalRep (const Value *val)
 find the unique defined global across multiple modules
bool isConstantObjSym (const Value *val)
 Check whether this value points-to a constant object.
void viewCFG (const Function *fun)
void viewCFGOnly (const Function *fun)
std::string dumpValue (const Value *val)
std::string dumpType (const Type *type)
std::string dumpValueAndDbgInfo (const Value *val)
bool isHeapAllocExtCallViaRet (const Instruction *inst)
bool isHeapAllocExtCallViaArg (const Instruction *inst)
bool isHeapAllocExtCall (const Instruction *inst)
bool isStackAllocExtCallViaRet (const Instruction *inst)
bool isStackAllocExtCall (const Instruction *inst)
bool isHeapObj (const Value *val)
bool isStackObj (const Value *val)
bool isNonInstricCallSite (const Instruction *inst)
 Whether an instruction is a callsite in the application code, excluding llvm intrinsic calls.
const Function * getProgEntryFunction (Module &module)
 Get program entry function from module.

Function Documentation

◆ ArgInDeadFunction()

bool SVF::LLVMUtil::ArgInDeadFunction ( const Value * val)
inline

whether this is an argument in dead function

Definition at line 158 of file LLVMUtil.h.

159{
160 return SVFUtil::isa<Argument>(val)
161 && isUncalledFunction(SVFUtil::cast<Argument>(val)->getParent());
162}
bool isUncalledFunction(const Function *fun)
whether this is a function without any possible caller?
Definition LLVMUtil.cpp:159
std::enable_if_t<!is_simple_type< Y >::value, typename cast_retty< X, const Y >::ret_type > cast(const Y &Val)
Definition Casting.h:360
LLVM_NODISCARD bool isa(const Y &Val)
Definition Casting.h:241

◆ ArgInProgEntryFunction()

bool SVF::LLVMUtil::ArgInProgEntryFunction ( const Value * val)
inline

Return true if this is an argument of a program entry function (e.g. main).

Definition at line 166 of file LLVMUtil.h.

167{
168 return SVFUtil::isa<Argument>(val) &&
170 SVFUtil::cast<Argument>(val)->getParent());
171}
bool isProgEntryFunction(const Function *fun)
Check whether a function is an entry function (i.e., main).
Definition LLVMUtil.h:126

◆ basicBlockHasRetInst()

bool SVF::LLVMUtil::basicBlockHasRetInst ( const BasicBlock * bb)

Return true if the function has a return instruction.

Return true if the basic block has a return instruction

Definition at line 110 of file LLVMUtil.cpp.

111{
112 for (BasicBlock::const_iterator it = bb->begin(), eit = bb->end();
113 it != eit; ++it)
114 {
116 return true;
117 }
118 return false;
119}

◆ detectTargetABI()

TargetABI SVF::LLVMUtil::detectTargetABI ( const llvm::Triple & triple)
inlinestatic

Definition at line 337 of file LLVMUtil.h.

338{
339 if (triple.isWindowsMSVCEnvironment())
340 return TargetABI::MSVC;
341
342 if (triple.isWindowsItaniumEnvironment() ||
343 triple.isWindowsGNUEnvironment() ||
344 triple.isWindowsCygwinEnvironment())
345 return TargetABI::Itanium;
346
347 return TargetABI::Itanium;
348}

◆ dumpType()

std::string SVF::LLVMUtil::dumpType ( const Type * type)

Definition at line 623 of file LLVMUtil.cpp.

624{
625 std::string str;
626 llvm::raw_string_ostream rawstr(str);
627 if (type)
628 rawstr << " " << *type << " ";
629 else
630 rawstr << " llvm type is null";
631 return rawstr.str();
632}
newitem type
Definition cJSON.cpp:2739

◆ dumpValue()

std::string SVF::LLVMUtil::dumpValue ( const Value * val)

Definition at line 612 of file LLVMUtil.cpp.

613{
614 std::string str;
615 llvm::raw_string_ostream rawstr(str);
616 if (val)
617 rawstr << " " << *val << " ";
618 else
619 rawstr << " llvm Value is null";
620 return rawstr.str();
621}

◆ dumpValueAndDbgInfo()

std::string SVF::LLVMUtil::dumpValueAndDbgInfo ( const Value * val)

Definition at line 634 of file LLVMUtil.cpp.

635{
636 std::string str;
637 llvm::raw_string_ostream rawstr(str);
638 if (val)
639 rawstr << dumpValue(val) << getSourceLoc(val);
640 else
641 rawstr << " llvm Value is null";
642 return rawstr.str();
643}
const std::string getSourceLoc(const Value *val)
Definition LLVMUtil.cpp:454
std::string dumpValue(const Value *val)
Definition LLVMUtil.cpp:612

◆ functionDoesNotRet()

bool SVF::LLVMUtil::functionDoesNotRet ( const Function * fun)

Return true if the function has a return instruction reachable from function entry

Definition at line 124 of file LLVMUtil.cpp.

125{
126 if (LLVMUtil::isExtCall(fun))
127 {
128 return fun->getReturnType()->isVoidTy();
129 }
130 std::vector<const BasicBlock*> bbVec;
132 bbVec.push_back(&fun->getEntryBlock());
133 while(!bbVec.empty())
134 {
135 const BasicBlock* bb = bbVec.back();
136 bbVec.pop_back();
137 if (basicBlockHasRetInst(bb))
138 {
139 return false;
140 }
141
142 for (succ_const_iterator sit = succ_begin(bb), esit = succ_end(bb);
143 sit != esit; ++sit)
144 {
145 const BasicBlock* succbb = (*sit);
146 if(visited.find(succbb)==visited.end())
147 visited.insert(succbb);
148 else
149 continue;
150 bbVec.push_back(succbb);
151 }
152 }
153 return true;
154}
bool isExtCall(const Function *fun)
Definition LLVMUtil.cpp:385
bool basicBlockHasRetInst(const BasicBlock *bb)
Return true if the function has a return instruction.
Definition LLVMUtil.cpp:110
llvm::const_succ_iterator succ_const_iterator
LLVM Iterators.
Definition BasicTypes.h:274
llvm::BasicBlock BasicBlock
Definition BasicTypes.h:84
std::unordered_set< Key, Hash, KeyEqual, Allocator > Set
Definition GeneralType.h:51

◆ getCalledFunctions()

std::vector< const Function * > SVF::LLVMUtil::getCalledFunctions ( const Function * F)

Get all called funcions in a parent function.

Definition at line 365 of file LLVMUtil.cpp.

366{
367 std::vector<const Function *> calledFunctions;
368 for (const Instruction &I : instructions(F))
369 {
370 if (const CallBase *callInst = SVFUtil::dyn_cast<CallBase>(&I))
371 {
372 Function *calledFunction = callInst->getCalledFunction();
373 if (calledFunction)
374 {
375 calledFunctions.push_back(calledFunction);
376 std::vector<const Function *> nestedCalledFunctions = getCalledFunctions(calledFunction);
377 calledFunctions.insert(calledFunctions.end(), nestedCalledFunctions.begin(), nestedCalledFunctions.end());
378 }
379 }
380 }
381 return calledFunctions;
382}
std::vector< const Function * > getCalledFunctions(const Function *F)
Get all called funcions in a parent function.
Definition LLVMUtil.cpp:365
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::CallBase CallBase
Definition BasicTypes.h:147
llvm::Function Function
Definition BasicTypes.h:83
llvm::Instruction Instruction
Definition BasicTypes.h:85

◆ getCallee()

const Function * SVF::LLVMUtil::getCallee ( const CallBase * cs)
inline

Definition at line 110 of file LLVMUtil.h.

111{
112 // FIXME: do we need to strip-off the casts here to discover more library functions
113 return SVFUtil::dyn_cast<Function>(cs->getCalledOperand()->stripPointerCasts());
114}

◆ getDataLayout()

DataLayout * SVF::LLVMUtil::getDataLayout ( Module * mod)
inlinestatic

Definition at line 315 of file LLVMUtil.h.

316{
317 static DataLayout *dl = nullptr;
318 if (dl == nullptr)
319#if LLVM_VERSION_MAJOR >= 19
320 dl = new DataLayout(mod->getDataLayout());
321#else
322 dl = new DataLayout(mod);
323#endif
324 return dl;
325}
llvm::DataLayout DataLayout
Definition BasicTypes.h:106

◆ getDoubleValue()

double SVF::LLVMUtil::getDoubleValue ( const ConstantFP * fpValue)
inline

Definition at line 67 of file LLVMUtil.h.

68{
69 double dval = 0;
70 if (fpValue->isNormalFP())
71 {
72 const llvm::fltSemantics& semantics = fpValue->getValueAPF().getSemantics();
73 if (&semantics == &llvm::APFloat::IEEEhalf() ||
74 &semantics == &llvm::APFloat::IEEEsingle() ||
75 &semantics == &llvm::APFloat::IEEEdouble() ||
76 &semantics == &llvm::APFloat::IEEEquad() ||
77 &semantics == &llvm::APFloat::x87DoubleExtended())
78 {
79 dval = fpValue->getValueAPF().convertToDouble();
80 }
81 else
82 {
83 assert (false && "Unsupported floating point type");
84 abort();
85 }
86 }
87 else
88 {
89 // other cfp type, like isZero(), isInfinity(), isNegative(), etc.
90 // do nothing
91 }
92 return dval;
93}

◆ getFirstUseViaCastInst()

const Value * SVF::LLVMUtil::getFirstUseViaCastInst ( const Value * val)

Return the bitcast instruction right next to val, otherwise return nullptr

If type is void* (i8*) and val is immediately used at a bitcast instruction

Definition at line 279 of file LLVMUtil.cpp.

280{
281 assert(SVFUtil::isa<PointerType>(val->getType()) && "this value should be a pointer type!");
283 const Value *latestUse = nullptr;
284 for (const auto &it : val->uses())
285 {
286 if (SVFUtil::isa<BitCastInst>(it.getUser()))
287 latestUse = it.getUser();
288 else
289 latestUse = nullptr;
290 }
291 return latestUse;
292}
llvm::Value Value
LLVM Basic classes.
Definition BasicTypes.h:80

◆ getFunObjVar()

const FunObjVar * SVF::LLVMUtil::getFunObjVar ( const std::string & name)

Definition at line 437 of file LLVMUtil.cpp.

438{
440}
const char *const name
Definition cJSON.h:264
const FunObjVar * getFunObjVar(const Function *fun) const
Definition LLVMModule.h:274
static LLVMModuleSet * getLLVMModuleSet()
Definition LLVMModule.h:137

◆ getFunReachableBBs()

void SVF::LLVMUtil::getFunReachableBBs ( const Function * fun,
std::vector< const SVFBasicBlock * > & reachableBBs )

Get reachable basic block from function entry.

Return reachable bbs from function entry

Definition at line 76 of file LLVMUtil.cpp.

77{
78 assert(!LLVMUtil::isExtCall(fun) && "The calling function cannot be an external function.");
79 //initial DominatorTree
81
83 std::vector<const BasicBlock*> bbVec;
84 bbVec.push_back(&fun->getEntryBlock());
85 while(!bbVec.empty())
86 {
87 const BasicBlock* bb = bbVec.back();
88 bbVec.pop_back();
90 reachableBBs.push_back(svfbb);
91 if(DomTreeNode *dtNode = dt.getNode(const_cast<BasicBlock*>(bb)))
92 {
93 for (DomTreeNode::iterator DI = dtNode->begin(), DE = dtNode->end();
94 DI != DE; ++DI)
95 {
96 const BasicBlock* succbb = (*DI)->getBlock();
97 if(visited.find(succbb)==visited.end())
98 visited.insert(succbb);
99 else
100 continue;
101 bbVec.push_back(succbb);
102 }
103 }
104 }
105}
SVFBasicBlock * getSVFBasicBlock(const BasicBlock *bb)
Definition LLVMModule.h:305
DominatorTree & getDomTree(const Function *fun)
llvm::DomTreeNode DomTreeNode
Definition BasicTypes.h:135
llvm::DominatorTree DominatorTree
LLVM Dominators.
Definition BasicTypes.h:134

◆ getGlobalRep()

const Value * SVF::LLVMUtil::getGlobalRep ( const Value * val)

find the unique defined global across multiple modules

Definition at line 441 of file LLVMUtil.cpp.

442{
444 {
445 if (LLVMModuleSet::getLLVMModuleSet()->hasGlobalRep(gvar))
447 }
448 return val;
449}
GlobalVariable * getGlobalRep(const GlobalVariable *val) const
Definition LLVMModule.h:366
llvm::GlobalVariable GlobalVariable
Definition BasicTypes.h:131

◆ getHeapAllocHoldingArgPosition()

u32_t SVF::LLVMUtil::getHeapAllocHoldingArgPosition ( const Function * fun)

Definition at line 402 of file LLVMUtil.cpp.

403{
405}
s32_t get_alloc_arg_pos(const Function *F)

◆ getIntegerValue()

std::pair< s64_t, u64_t > SVF::LLVMUtil::getIntegerValue ( const ConstantInt * intValue)
inline

Definition at line 95 of file LLVMUtil.h.

96{
97 if (intValue->getBitWidth() <= 64 && intValue->getBitWidth() >= 1)
98 return std::make_pair(intValue->getSExtValue(), intValue->getZExtValue());
99 else
100 return std::make_pair(0,0);
101}

◆ getLLVMCallSite()

const CallBase * SVF::LLVMUtil::getLLVMCallSite ( const Value * value)
inline

Return LLVM callsite given a value.

Definition at line 104 of file LLVMUtil.h.

105{
106 assert(isCallSite(value) && "not a callsite?");
107 return SVFUtil::cast<CallBase>(value);
108}
bool isCallSite(const Instruction *inst)
Whether an instruction is a call or invoke instruction.
Definition LLVMUtil.h:57

◆ getLLVMFunction()

const Function * SVF::LLVMUtil::getLLVMFunction ( const Value * val)
inline

Return LLVM function if this value is.

Definition at line 117 of file LLVMUtil.h.

118{
119 return SVFUtil::dyn_cast<Function>(val->stripPointerCasts());
120}

◆ getNextInsts()

void SVF::LLVMUtil::getNextInsts ( const Instruction * curInst,
std::vector< const Instruction * > & instList )

Get the next instructions following control flow.

Definition at line 585 of file LLVMUtil.cpp.

586{
587 if (!curInst->isTerminator())
588 {
589 const Instruction* nextInst = curInst->getNextNode();
590 if (LLVMUtil::isIntrinsicInst(nextInst))
591 getNextInsts(nextInst, instList);
592 else
593 instList.push_back(nextInst);
594 }
595 else
596 {
597 const BasicBlock *BB = curInst->getParent();
598 // Visit all successors of BB in the CFG
599 for (succ_const_iterator it = succ_begin(BB), ie = succ_end(BB); it != ie; ++it)
600 {
601 const Instruction* nextInst = &((*it)->front());
602 if (LLVMUtil::isIntrinsicInst(nextInst))
603 getNextInsts(nextInst, instList);
604 else
605 instList.push_back(nextInst);
606 }
607 }
608}
bool isIntrinsicInst(const Instruction *inst)
Return true if it is an intrinsic instruction.
Definition LLVMUtil.cpp:204
void getNextInsts(const Instruction *curInst, std::vector< const Instruction * > &instList)
Get the next instructions following control flow.
Definition LLVMUtil.cpp:585

◆ getNumOfElements()

u32_t SVF::LLVMUtil::getNumOfElements ( const Type * ety)

Return size of this object based on LLVM value.

Return size of this Object

Definition at line 297 of file LLVMUtil.cpp.

298{
299 assert(ety && "type is null?");
300 u32_t numOfFields = 1;
302 {
305 else
307 }
308 return numOfFields;
309}
SVFType * getSVFType(const Type *T)
Get or create SVFType and typeinfo.
static Option< bool > ModelArrays
Definition Options.h:180
StInfo * getTypeInfo()
Definition SVFType.h:273
u32_t getNumOfFlattenElements() const
Return number of elements after flattening (including array elements).
Definition SVFType.h:164
u32_t getNumOfFlattenFields() const
Return the number of fields after flattening (ignoring array elements).
Definition SVFType.h:170
unsigned u32_t
Definition GeneralType.h:67

◆ getProgEntryFunction()

const Function * SVF::LLVMUtil::getProgEntryFunction ( Module & module)
inline

Get program entry function from module.

Definition at line 447 of file LLVMUtil.h.

448{
449 for (auto it = module.begin(), eit = module.end(); it != eit; ++it)
450 {
451 const Function *fun = &(*it);
452 if (isProgEntryFunction(fun))
453 return (fun);
454 }
455 return nullptr;
456}

◆ getProgFunction()

const Function * SVF::LLVMUtil::getProgFunction ( const std::string & funName)

Get program entry function from module.

Definition at line 41 of file LLVMUtil.cpp.

42{
43 for (const Module& M : LLVMModuleSet::getLLVMModuleSet()->getLLVMModules())
44 {
45 for (const Function& fun : M)
46 {
47 if (fun.getName() == funName)
48 return &fun;
49 }
50 }
51 return nullptr;
52}
llvm::Module Module
Definition BasicTypes.h:82

◆ getSourceLoc()

const std::string SVF::LLVMUtil::getSourceLoc ( const Value * val)

Get the meta data (line number and file name) info of a LLVM value

Definition at line 454 of file LLVMUtil.cpp.

455{
456 if(val==nullptr) return "{ empty val }";
457
458 std::string str;
459 std::stringstream rawstr(str);
460 rawstr << "{ ";
461
462 if (const Instruction* inst = SVFUtil::dyn_cast<Instruction>(val))
463 {
464 if (SVFUtil::isa<AllocaInst>(inst))
465 {
466#if LLVM_VERSION_MAJOR >= 20
467 for (llvm::DbgVariableRecord *DVR : llvm::findDVRDeclares(const_cast<Instruction*>(inst)))
468 {
469 llvm::DIVariable *DIVar = DVR->getVariable();
470 rawstr << "\"ln\": " << DIVar->getLine() << ", \"fl\": \"" << DIVar->getFilename().str() << "\"";
471 break;
472 }
473#else
474 for (llvm::DbgInfoIntrinsic *DII : llvm::findDbgDeclares(const_cast<Instruction*>(inst)))
475 {
476 if (llvm::DbgDeclareInst *DDI = SVFUtil::dyn_cast<llvm::DbgDeclareInst>(DII))
477 {
478 llvm::DIVariable *DIVar = SVFUtil::cast<llvm::DIVariable>(DDI->getVariable());
479 rawstr << "\"ln\": " << DIVar->getLine() << ", \"fl\": \"" << DIVar->getFilename().str() << "\"";
480 break;
481 }
482 }
483#endif
484 }
485 else if (MDNode *N = inst->getMetadata("dbg")) // Here I is an LLVM instruction
486 {
487 llvm::DILocation* Loc = SVFUtil::cast<llvm::DILocation>(N); // DILocation is in DebugInfo.h
488 unsigned Line = Loc->getLine();
489 unsigned Column = Loc->getColumn();
490 std::string File = Loc->getFilename().str();
491 //StringRef Dir = Loc.getDirectory();
492 if(File.empty() || Line == 0)
493 {
494 auto inlineLoc = Loc->getInlinedAt();
495 if(inlineLoc)
496 {
497 Line = inlineLoc->getLine();
498 Column = inlineLoc->getColumn();
499 File = inlineLoc->getFilename().str();
500 }
501 }
502 rawstr << "\"ln\": " << Line << ", \"cl\": " << Column << ", \"fl\": \"" << File << "\"";
503 }
504 }
505 else if (const Argument* argument = SVFUtil::dyn_cast<Argument>(val))
506 {
507 if (argument->getArgNo()%10 == 1)
508 rawstr << argument->getArgNo() << "st";
509 else if (argument->getArgNo()%10 == 2)
510 rawstr << argument->getArgNo() << "nd";
511 else if (argument->getArgNo()%10 == 3)
512 rawstr << argument->getArgNo() << "rd";
513 else
514 rawstr << argument->getArgNo() << "th";
515 rawstr << " arg " << argument->getParent()->getName().str() << " "
516 << getSourceLocOfFunction(argument->getParent());
517 }
518 else if (const GlobalVariable* gvar = SVFUtil::dyn_cast<GlobalVariable>(val))
519 {
520 rawstr << "Glob ";
521 NamedMDNode* CU_Nodes = gvar->getParent()->getNamedMetadata("llvm.dbg.cu");
522 if(CU_Nodes)
523 {
524 for (unsigned i = 0, e = CU_Nodes->getNumOperands(); i != e; ++i)
525 {
526 llvm::DICompileUnit *CUNode = SVFUtil::cast<llvm::DICompileUnit>(CU_Nodes->getOperand(i));
527 for (llvm::DIGlobalVariableExpression *GV : CUNode->getGlobalVariables())
528 {
529 llvm::DIGlobalVariable * DGV = GV->getVariable();
530
531 if(DGV->getName() == gvar->getName())
532 {
533 rawstr << "\"ln\": " << DGV->getLine() << ", \"fl\": \"" << DGV->getFilename().str() << "\"";
534 }
535
536 }
537 }
538 }
539 }
540 else if (const Function* func = SVFUtil::dyn_cast<Function>(val))
541 {
542 rawstr << getSourceLocOfFunction(func);
543 }
544 else if (const BasicBlock* bb = SVFUtil::dyn_cast<BasicBlock>(val))
545 {
546 auto nonPhiIt = bb->getFirstNonPHIIt();
547 rawstr << "\"basic block\": " << bb->getName().str() << ", \"location\": " << getSourceLoc(nonPhiIt != bb->end() ? &*nonPhiIt : nullptr);
548 }
550 {
551 rawstr << "constant data";
552 }
553 else
554 {
555 rawstr << "N/A";
556 }
557 rawstr << " }";
558
559 if(rawstr.str()=="{ }")
560 return "";
561 return rawstr.str();
562}
const std::string getSourceLocOfFunction(const Function *F)
Definition LLVMUtil.cpp:568
bool isConstDataOrAggData(const Value *val)
Return true if the value refers to constant data, e.g., i32 0.
Definition LLVMUtil.h:397
llvm::NamedMDNode NamedMDNode
LLVM metadata and debug information.
Definition BasicTypes.h:109
llvm::Argument Argument
Definition BasicTypes.h:146
llvm::MDNode MDNode
Definition BasicTypes.h:110

◆ getSourceLocOfFunction()

const std::string SVF::LLVMUtil::getSourceLocOfFunction ( const Function * F)

Get source code line number of a function according to debug info

Definition at line 568 of file LLVMUtil.cpp.

569{
570 std::string str;
571 std::stringstream rawstr(str);
572 /*
573 * https://reviews.llvm.org/D18074?id=50385
574 * looks like the relevant
575 */
576 if (llvm::DISubprogram *SP = F->getSubprogram())
577 {
578 if (SP->describes(F))
579 rawstr << "\"ln\": " << SP->getLine() << ", \"file\": \"" << SP->getFilename().str() << "\"";
580 }
581 return rawstr.str();
582}

◆ getTargetTriple()

llvm::Triple SVF::LLVMUtil::getTargetTriple ( const Module * mod)
inlinestatic

Definition at line 327 of file LLVMUtil.h.

328{
329 assert(mod && "null module");
330#if LLVM_VERSION_MAJOR >= 21
331 return mod->getTargetTriple();
332#else
333 return llvm::Triple(mod->getTargetTriple());
334#endif
335}

◆ isArgOfUncalledFunction()

bool SVF::LLVMUtil::isArgOfUncalledFunction ( const Value * val)
inline

Return true if the argument in a function does not have a caller.

Definition at line 187 of file LLVMUtil.h.

188{
189 return SVFUtil::isa<Argument>(val)
190 && isNoCallerFunction(SVFUtil::cast<Argument>(val)->getParent());
191}
bool isNoCallerFunction(const Function *fun)
Function does not have any possible caller in the call graph.
Definition LLVMUtil.h:181

◆ isBinaryConstantExpr()

const ConstantExpr * SVF::LLVMUtil::isBinaryConstantExpr ( const Value * val)
inline

Definition at line 292 of file LLVMUtil.h.

293{
294 if (const ConstantExpr* constExpr = SVFUtil::dyn_cast<ConstantExpr>(val))
295 {
296 if ((constExpr->getOpcode() >= Instruction::BinaryOpsBegin) &&
297 (constExpr->getOpcode() <= Instruction::BinaryOpsEnd))
298 return constExpr;
299 }
300 return nullptr;
301}
llvm::ConstantExpr ConstantExpr
Definition BasicTypes.h:118

◆ isBlackholeSym()

bool SVF::LLVMUtil::isBlackholeSym ( const Value * val)
inline

Check whether this value is a black hole.

Definition at line 133 of file LLVMUtil.h.

134{
135 return SVFUtil::isa<UndefValue>(val);
136}

◆ isCallSite() [1/2]

bool SVF::LLVMUtil::isCallSite ( const Instruction * inst)
inline

Whether an instruction is a call or invoke instruction.

Definition at line 57 of file LLVMUtil.h.

58{
59 return SVFUtil::isa<CallBase>(inst);
60}

◆ isCallSite() [2/2]

bool SVF::LLVMUtil::isCallSite ( const Value * val)
inline

Whether an instruction is a call or invoke instruction.

Definition at line 62 of file LLVMUtil.h.

63{
64 return SVFUtil::isa<CallBase>(val);
65}

◆ isCastConstantExpr()

const ConstantExpr * SVF::LLVMUtil::isCastConstantExpr ( const Value * val)
inline

Definition at line 247 of file LLVMUtil.h.

248{
249 if (const ConstantExpr* constExpr = SVFUtil::dyn_cast<ConstantExpr>(val))
250 {
251 if (constExpr->getOpcode() == Instruction::BitCast)
252 return constExpr;
253 }
254 return nullptr;
255}

◆ isCmpConstantExpr()

const ConstantExpr * SVF::LLVMUtil::isCmpConstantExpr ( const Value * val)
inline

Definition at line 281 of file LLVMUtil.h.

282{
283 if (const ConstantExpr* constExpr = SVFUtil::dyn_cast<ConstantExpr>(val))
284 {
285 if (constExpr->getOpcode() == Instruction::ICmp ||
286 constExpr->getOpcode() == Instruction::FCmp)
287 return constExpr;
288 }
289 return nullptr;
290}

◆ isConstantObjSym()

bool SVF::LLVMUtil::isConstantObjSym ( const Value * val)

Check whether this value points-to a constant object.

Check whether this value points-to a constant object

Definition at line 705 of file CppUtil.cpp.

706{
708 {
709 if (cppUtil::isValVtbl(v))
710 return false;
711 else if (!v->hasInitializer())
712 {
713 return !v->isExternalLinkage(v->getLinkage());
714 }
715 else
716 {
717 StInfo *stInfo = LLVMModuleSet::getLLVMModuleSet()->getSVFType(v->getInitializer()->getType())->getTypeInfo();
718 const std::vector<const SVFType*> &fields = stInfo->getFlattenFieldTypes();
719 for (std::vector<const SVFType*>::const_iterator it = fields.begin(), eit = fields.end(); it != eit; ++it)
720 {
721 const SVFType* elemTy = *it;
722 assert(!SVFUtil::isa<SVFFunctionType>(elemTy) && "Initializer of a global is a function?");
724 return false;
725 }
726
727 return v->isConstant();
728 }
729 }
731}
std::vector< const SVFType * > & getFlattenFieldTypes()
Definition SVFType.h:131
bool isValVtbl(const Value *val)
A carefully crafted input such as FakeVTable _ZTV1A = {{nullptr, nullptr}}; can forge a vtable; detec...
Definition CppUtil.cpp:295

◆ isConstDataOrAggData()

bool SVF::LLVMUtil::isConstDataOrAggData ( const Value * val)
inline

Return true if the value refers to constant data, e.g., i32 0.

Definition at line 397 of file LLVMUtil.h.

398{
401}
llvm::ConstantData ConstantData
Definition BasicTypes.h:114
llvm::MetadataAsValue MetadataAsValue
Definition BasicTypes.h:100
llvm::ConstantAggregate ConstantAggregate
Definition BasicTypes.h:115
llvm::BlockAddress BlockAddress
Definition BasicTypes.h:89

◆ isExtCall()

bool SVF::LLVMUtil::isExtCall ( const Function * fun)

Definition at line 385 of file LLVMUtil.cpp.

386{
387 return fun && LLVMModuleSet::getLLVMModuleSet()->is_ext(fun);
388}
bool is_ext(const Function *F)

◆ isGepConstantExpr()

const ConstantExpr * SVF::LLVMUtil::isGepConstantExpr ( const Value * val)
inline

Return corresponding constant expression, otherwise return nullptr.

Definition at line 217 of file LLVMUtil.h.

218{
219 if (const ConstantExpr* constExpr = SVFUtil::dyn_cast<ConstantExpr>(val))
220 {
221 if (constExpr->getOpcode() == Instruction::GetElementPtr)
222 return constExpr;
223 }
224 return nullptr;
225}

◆ isHeapAllocExtCall()

bool SVF::LLVMUtil::isHeapAllocExtCall ( const Instruction * inst)
inline

Definition at line 425 of file LLVMUtil.h.

426{
428}
bool isHeapAllocExtCallViaRet(const Instruction *inst)
Definition LLVMUtil.cpp:645
bool isHeapAllocExtCallViaArg(const Instruction *inst)
Definition LLVMUtil.cpp:660

◆ isHeapAllocExtCallViaArg()

bool SVF::LLVMUtil::isHeapAllocExtCallViaArg ( const Instruction * inst)

Definition at line 660 of file LLVMUtil.cpp.

661{
662 if (const CallBase* call = SVFUtil::dyn_cast<CallBase>(inst))
663 {
664 const Function* fun = call->getCalledFunction();
665 return fun &&
667 }
668 else
669 {
670 return false;
671 }
672}
bool is_arg_alloc(const Function *F)

◆ isHeapAllocExtCallViaRet()

bool SVF::LLVMUtil::isHeapAllocExtCallViaRet ( const Instruction * inst)

Definition at line 645 of file LLVMUtil.cpp.

646{
648 bool isPtrTy = inst->getType()->isPointerTy();
649 if (const CallBase* call = SVFUtil::dyn_cast<CallBase>(inst))
650 {
651 const Function* fun = call->getCalledFunction();
652 return fun && isPtrTy &&
653 (pSet->is_alloc(fun) ||
654 pSet->is_realloc(fun));
655 }
656 else
657 return false;
658}
bool is_alloc(const Function *F)
bool is_realloc(const Function *F)

◆ isHeapObj()

bool SVF::LLVMUtil::isHeapObj ( const Value * val)

Check if a given value represents a heap object.

Parameters
valThe value to check.
Returns
True if the value represents a heap object, false otherwise.

Definition at line 694 of file LLVMUtil.cpp.

695{
696 // Check if the value is an argument in the program entry function
697 if (ArgInProgEntryFunction(val))
698 {
699 // Return true if the value does not have a first use via cast instruction
700 return !getFirstUseViaCastInst(val);
701 }
702 // Check if the value is an instruction and if it is a heap allocation external call
703 else if (SVFUtil::isa<Instruction>(val) &&
705 {
706 return true;
707 }
708 // Return false if none of the above conditions are met
709 return false;
710}
const Value * getFirstUseViaCastInst(const Value *val)
Definition LLVMUtil.cpp:279
bool isHeapAllocExtCall(const Instruction *inst)
Definition LLVMUtil.h:425
bool ArgInProgEntryFunction(const Value *val)
Return true if this is an argument of a program entry function (e.g. main).
Definition LLVMUtil.h:166

◆ isInt2PtrConstantExpr()

const ConstantExpr * SVF::LLVMUtil::isInt2PtrConstantExpr ( const Value * val)
inline

Definition at line 227 of file LLVMUtil.h.

228{
229 if (const ConstantExpr* constExpr = SVFUtil::dyn_cast<ConstantExpr>(val))
230 {
231 if (constExpr->getOpcode() == Instruction::IntToPtr)
232 return constExpr;
233 }
234 return nullptr;
235}

◆ isIntrinsicFun()

bool SVF::LLVMUtil::isIntrinsicFun ( const Function * func)

Definition at line 191 of file LLVMUtil.cpp.

192{
193 if (func && (func->getIntrinsicID() == llvm::Intrinsic::donothing ||
194 func->getIntrinsicID() == llvm::Intrinsic::dbg_declare ||
195 func->getIntrinsicID() == llvm::Intrinsic::dbg_label ||
196 func->getIntrinsicID() == llvm::Intrinsic::dbg_value))
197 {
198 return true;
199 }
200 return false;
201}

◆ isIntrinsicInst()

bool SVF::LLVMUtil::isIntrinsicInst ( const Instruction * inst)

Return true if it is an intrinsic instruction.

Definition at line 204 of file LLVMUtil.cpp.

205{
206 if (const CallBase* call = SVFUtil::dyn_cast<CallBase>(inst))
207 {
208 const Function* func = call->getCalledFunction();
209 if (isIntrinsicFun(func))
210 {
211 return true;
212 }
213 }
214 return false;
215}
bool isIntrinsicFun(const Function *func)
Definition LLVMUtil.cpp:191

◆ isIRFile()

bool SVF::LLVMUtil::isIRFile ( const std::string & filename)

Check whether a file is an LLVM IR file.

Definition at line 316 of file LLVMUtil.cpp.

317{
318 llvm::LLVMContext context;
319 llvm::SMDiagnostic err;
320
321 // Parse the input LLVM IR file into a module
322 std::unique_ptr<llvm::Module> module = llvm::parseIRFile(filename, err, context);
323
324 // Check if the parsing succeeded
325 if (!module)
326 {
327 err.print("isIRFile", llvm::errs());
328 return false; // Not an LLVM IR file
329 }
330
331 return true; // It is an LLVM IR file
332}

◆ isMemcpyExtFun()

bool SVF::LLVMUtil::isMemcpyExtFun ( const Function * fun)

Definition at line 390 of file LLVMUtil.cpp.

391{
392 return fun && LLVMModuleSet::getLLVMModuleSet()->is_memcpy(fun);
393}
bool is_memcpy(const Function *F)

◆ isMemsetExtFun()

bool SVF::LLVMUtil::isMemsetExtFun ( const Function * fun)

Definition at line 396 of file LLVMUtil.cpp.

397{
398 return fun && LLVMModuleSet::getLLVMModuleSet()->is_memset(fun);
399}
bool is_memset(const Function *F)

◆ isNoCallerFunction()

bool SVF::LLVMUtil::isNoCallerFunction ( const Function * fun)
inline

Function does not have any possible caller in the call graph.

Return true if the function does not have a caller (either it is a main function or a dead function)

Definition at line 181 of file LLVMUtil.h.

182{
184}

◆ isNonInstricCallSite()

bool SVF::LLVMUtil::isNonInstricCallSite ( const Instruction * inst)

Whether an instruction is a callsite in the application code, excluding llvm intrinsic calls.

Definition at line 732 of file LLVMUtil.cpp.

733{
734 bool res = false;
735
736 if(isIntrinsicInst(inst))
737 res = false;
738 else
739 res = isCallSite(inst);
740 return res;
741}

◆ isNoPrecessorBasicBlock()

bool SVF::LLVMUtil::isNoPrecessorBasicBlock ( const BasicBlock * bb)
inline

Basic block does not have predecessors map-1.cpp.bc try.cont: ; No predecessors! call void @llvm.trap() unreachable

Definition at line 360 of file LLVMUtil.h.

361{
362 return bb != &bb->getParent()->getEntryBlock() &&
363 pred_empty(bb);
364}

◆ isNullPtrSym()

bool SVF::LLVMUtil::isNullPtrSym ( const Value * val)
inline

Check whether this value is a black hole.

Definition at line 139 of file LLVMUtil.h.

140{
142}

◆ isObject()

bool SVF::LLVMUtil::isObject ( const Value * ref)

Return true if this value refers to a object.

A value represents an object if it is 1) function, 2) global 3) stack 4) heap

Definition at line 61 of file LLVMUtil.cpp.

62{
64 return true;
66 return true;
68 return true;
69
70 return false;
71}

◆ isProgEntryFunction()

bool SVF::LLVMUtil::isProgEntryFunction ( const Function * fun)
inline

Check whether a function is an entry function (i.e., main).

Definition at line 126 of file LLVMUtil.h.

127{
128 const char* main_name=Options::SVFMain() ? "svf.main" : "main";
129 return fun && fun->getName() == main_name;
130}
static Option< bool > SVFMain
Definition Options.h:175

◆ isPtr2IntConstantExpr()

const ConstantExpr * SVF::LLVMUtil::isPtr2IntConstantExpr ( const Value * val)
inline

Definition at line 237 of file LLVMUtil.h.

238{
239 if (const ConstantExpr* constExpr = SVFUtil::dyn_cast<ConstantExpr>(val))
240 {
241 if (constExpr->getOpcode() == Instruction::PtrToInt)
242 return constExpr;
243 }
244 return nullptr;
245}

◆ isPtrInUncalledFunction()

bool SVF::LLVMUtil::isPtrInUncalledFunction ( const Value * value)

Return true if this is value in a dead function (function without any caller).

Return true if this is a value in a dead function (function without any caller)

Definition at line 176 of file LLVMUtil.cpp.

177{
178 if(const Instruction* inst = SVFUtil::dyn_cast<Instruction>(value))
179 {
180 if(isUncalledFunction(inst->getParent()->getParent()))
181 return true;
182 }
183 else if(const Argument* arg = SVFUtil::dyn_cast<Argument>(value))
184 {
185 if(isUncalledFunction(arg->getParent()))
186 return true;
187 }
188 return false;
189}

◆ isSelectConstantExpr()

const ConstantExpr * SVF::LLVMUtil::isSelectConstantExpr ( const Value * val)
inline

Definition at line 257 of file LLVMUtil.h.

258{
259 if (const ConstantExpr* constExpr = SVFUtil::dyn_cast<ConstantExpr>(val))
260 {
261 if (constExpr->getOpcode() == Instruction::Select)
262 return constExpr;
263 }
264 return nullptr;
265}

◆ isStackAllocExtCall()

bool SVF::LLVMUtil::isStackAllocExtCall ( const Instruction * inst)
inline

Definition at line 432 of file LLVMUtil.h.

433{
434 return isStackAllocExtCallViaRet(inst);
435}
bool isStackAllocExtCallViaRet(const Instruction *inst)
Definition LLVMUtil.cpp:674

◆ isStackAllocExtCallViaRet()

bool SVF::LLVMUtil::isStackAllocExtCallViaRet ( const Instruction * inst)

Definition at line 674 of file LLVMUtil.cpp.

675{
677 bool isPtrTy = inst->getType()->isPointerTy();
678 if (const CallBase* call = SVFUtil::dyn_cast<CallBase>(inst))
679 {
680 const Function* fun = call->getCalledFunction();
681 return fun && isPtrTy &&
682 pSet->is_alloc_stack_ret(fun);
683 }
684 else
685 return false;
686}
bool is_alloc_stack_ret(const Function *F)

◆ isStackObj()

bool SVF::LLVMUtil::isStackObj ( const Value * val)
Parameters
valThe value to check.
Returns
True if the value represents a stack object, false otherwise.

Definition at line 716 of file LLVMUtil.cpp.

717{
719 {
720 return true;
721 }
722 // Check if the value is an instruction and if it is a stack allocation external call
723 else if (SVFUtil::isa<Instruction>(val) &&
725 {
726 return true;
727 }
728 // Return false if none of the above conditions are met
729 return false;
730}
bool isStackAllocExtCall(const Instruction *inst)
Definition LLVMUtil.h:432

◆ isTruncConstantExpr()

const ConstantExpr * SVF::LLVMUtil::isTruncConstantExpr ( const Value * val)
inline

Definition at line 267 of file LLVMUtil.h.

268{
269 if (const ConstantExpr* constExpr = SVFUtil::dyn_cast<ConstantExpr>(val))
270 {
271 if (constExpr->getOpcode() == Instruction::Trunc ||
272 constExpr->getOpcode() == Instruction::FPTrunc ||
273 constExpr->getOpcode() == Instruction::ZExt ||
274 constExpr->getOpcode() == Instruction::SExt ||
275 constExpr->getOpcode() == Instruction::FPExt)
276 return constExpr;
277 }
278 return nullptr;
279}

◆ isUnaryConstantExpr()

const ConstantExpr * SVF::LLVMUtil::isUnaryConstantExpr ( const Value * val)
inline

Definition at line 303 of file LLVMUtil.h.

304{
305 if (const ConstantExpr* constExpr = SVFUtil::dyn_cast<ConstantExpr>(val))
306 {
307 if ((constExpr->getOpcode() >= Instruction::UnaryOpsBegin) &&
308 (constExpr->getOpcode() <= Instruction::UnaryOpsEnd))
309 return constExpr;
310 }
311 return nullptr;
312}

◆ isUncalledFunction()

bool SVF::LLVMUtil::isUncalledFunction ( const Function * fun)

whether this is a function without any possible caller?

Method for dead function, which does not have any possible caller function address is not taken and never be used in call or invoke instruction

Return true if this is a function without any possible caller

Definition at line 159 of file LLVMUtil.cpp.

160{
161 if(fun->hasAddressTaken())
162 return false;
164 return false;
165 for (Value::const_user_iterator i = fun->user_begin(), e = fun->user_end(); i != e; ++i)
166 {
167 if (LLVMUtil::isCallSite(*i))
168 return false;
169 }
170 return true;
171}

◆ processArguments()

void SVF::LLVMUtil::processArguments ( int argc,
char ** argv,
int & arg_num,
char ** arg_value,
std::vector< std::string > & moduleNameVec )

Parse argument for multi-module analysis.

Get the names of all modules into a vector And process arguments

Definition at line 337 of file LLVMUtil.cpp.

339{
340 bool first_ir_file = true;
341 for (int i = 0; i < argc; ++i)
342 {
343 std::string argument(argv[i]);
344 if (LLVMUtil::isIRFile(argument))
345 {
346 if (find(moduleNameVec.begin(), moduleNameVec.end(), argument)
347 == moduleNameVec.end())
348 moduleNameVec.push_back(argument);
349 if (first_ir_file)
350 {
351 arg_value[arg_num] = argv[i];
352 arg_num++;
353 first_ir_file = false;
354 }
355 }
356 else
357 {
358 arg_value[arg_num] = argv[i];
359 arg_num++;
360 }
361 }
362}
bool isIRFile(const std::string &filename)
Check whether a file is an LLVM IR file.
Definition LLVMUtil.cpp:316

◆ restoreFuncName()

std::string SVF::LLVMUtil::restoreFuncName ( std::string funcName)

Definition at line 408 of file LLVMUtil.cpp.

409{
410 assert(!funcName.empty() && "Empty function name");
411 // Some function names change due to mangling, such as "fopen" to "\01_fopen" on macOS.
412 // Since C function names cannot include '.', change the function name from llvm.memcpy.p0i8.p0i8.i64 to llvm_memcpy_p0i8_p0i8_i64."
413 bool hasSpecialPrefix = funcName[0] == '\01';
414 bool hasDot = funcName.find('.') != std::string::npos;
415
416 if (!hasDot && !hasSpecialPrefix)
417 return funcName;
418
419 // Remove prefix "\01_" or "\01"
420 if (hasSpecialPrefix)
421 {
422 const std::string prefix1 = "\01_";
423 const std::string prefix2 = "\01";
424 if (funcName.substr(0, prefix1.length()) == prefix1)
425 funcName = funcName.substr(prefix1.length());
426 else if (funcName.substr(0, prefix2.length()) == prefix2)
427 funcName = funcName.substr(prefix2.length());
428 }
429 // Replace '.' with '_'
430 if (hasDot)
431 std::replace(funcName.begin(), funcName.end(), '.', '_');
432
433 return funcName;
434}

◆ stripAllCasts()

const Value * SVF::LLVMUtil::stripAllCasts ( const Value * val)

Strip off the all casts.

Strip all casts

Definition at line 251 of file LLVMUtil.cpp.

252{
253 while (true)
254 {
255 if (const CastInst *ci = SVFUtil::dyn_cast<CastInst>(val))
256 {
257 val = ci->getOperand(0);
258 }
259 else if (const ConstantExpr *ce = SVFUtil::dyn_cast<ConstantExpr>(val))
260 {
261 if(ce->isCast())
262 val = ce->getOperand(0);
263 else
264 return val;
265 }
266 else
267 {
268 return val;
269 }
270 }
271 return nullptr;
272}
llvm::CastInst CastInst
Definition BasicTypes.h:159

◆ stripConstantCasts()

const Value * SVF::LLVMUtil::stripConstantCasts ( const Value * val)

Strip off the constant casts.

Strip constant casts

Definition at line 220 of file LLVMUtil.cpp.

221{
223 return val;
224 else if (const ConstantExpr *CE = SVFUtil::dyn_cast<ConstantExpr>(val))
225 {
226 if (Instruction::isCast(CE->getOpcode()))
227 return stripConstantCasts(CE->getOperand(0));
228 }
229 return val;
230}
const Value * stripConstantCasts(const Value *val)
Strip off the constant casts.
Definition LLVMUtil.cpp:220
const ConstantExpr * isInt2PtrConstantExpr(const Value *val)
Definition LLVMUtil.h:227

◆ viewCFG()

void SVF::LLVMUtil::viewCFG ( const Function * fun)

Definition at line 232 of file LLVMUtil.cpp.

233{
234 if (fun != nullptr)
235 {
236 fun->viewCFG();
237 }
238}

◆ viewCFGOnly()

void SVF::LLVMUtil::viewCFGOnly ( const Function * fun)

Definition at line 240 of file LLVMUtil.cpp.

241{
242 if (fun != nullptr)
243 {
244 fun->viewCFGOnly();
245 }
246}