Skip to content

Commit

Permalink
SVF code formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
yuleisui committed Jan 17, 2025
1 parent 89b8815 commit 8068f98
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 16 deletions.
6 changes: 4 additions & 2 deletions svf-llvm/lib/SVFIRBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -356,9 +356,11 @@ void SVFIRBuilder::initialiseNodes()
}
}

for (auto& it : SymbolTableInfo::SymbolInfo()->idToObjTypeInfoMap()) {
for (auto& it : SymbolTableInfo::SymbolInfo()->idToObjTypeInfoMap())
{
NodeID id = it.first;
if (BaseObjVar* obj = SVFUtil::dyn_cast<BaseObjVar>(pag->getGNode(id))) {
if (BaseObjVar* obj = SVFUtil::dyn_cast<BaseObjVar>(pag->getGNode(id)))
{
if (!obj->hasValue())
continue;

Expand Down
7 changes: 4 additions & 3 deletions svf-llvm/lib/SymbolTableBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,10 @@ ObjTypeInfo* SymbolTableBuilder::createBlkObjTypeInfo(SymID symId)
{
assert(symInfo->isBlkObj(symId));
LLVMModuleSet* llvmset = LLVMModuleSet::getLLVMModuleSet();
if (symInfo->objTypeInfoMap.find(symId)==symInfo->objTypeInfoMap.end()) {
if (symInfo->objTypeInfoMap.find(symId)==symInfo->objTypeInfoMap.end())
{
ObjTypeInfo* ti =symInfo->createObjTypeInfo(llvmset->getSVFType(
IntegerType::get(llvmset->getContext(), 32)));
IntegerType::get(llvmset->getContext(), 32)));
symInfo->objTypeInfoMap[symId] = ti;
}
ObjTypeInfo* ti = symInfo->objTypeInfoMap[symId];
Expand All @@ -64,7 +65,7 @@ ObjTypeInfo* SymbolTableBuilder::createConstantObjTypeInfo(SymID symId)
if (symInfo->objTypeInfoMap.find(symId)==symInfo->objTypeInfoMap.end())
{
ObjTypeInfo* ti = symInfo->createObjTypeInfo(
llvmset->getSVFType(IntegerType::get(llvmset->getContext(), 32)));
llvmset->getSVFType(IntegerType::get(llvmset->getContext(), 32)));
symInfo->objTypeInfoMap[symId] = ti;
}
ObjTypeInfo* ti = symInfo->objTypeInfoMap[symId];
Expand Down
6 changes: 4 additions & 2 deletions svf/include/SVFIR/SVFIR.h
Original file line number Diff line number Diff line change
Expand Up @@ -705,12 +705,14 @@ class SVFIR : public IRGraph
}
inline NodeID addDummyObjNode(NodeID i, const SVFType* type)
{
if (symInfo->idToObjTypeInfoMap().find(i) == symInfo->idToObjTypeInfoMap().end()) {
if (symInfo->idToObjTypeInfoMap().find(i) == symInfo->idToObjTypeInfoMap().end())
{
ObjTypeInfo* ti = symInfo->createObjTypeInfo(type);
symInfo->idToObjTypeInfoMap()[i] = ti;
return addObjNode(nullptr, new DummyObjVar(i, ti));
}
else {
else
{
return addObjNode(nullptr, new DummyObjVar(i, symInfo->getObjTypeInfo(i)));
}
}
Expand Down
10 changes: 6 additions & 4 deletions svf/include/SVFIR/SVFVariables.h
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,8 @@ class BaseObjVar : public ObjVar
{
}

virtual const BaseObjVar* getBaseMemObj() const {
virtual const BaseObjVar* getBaseMemObj() const
{
return this;
}

Expand Down Expand Up @@ -723,7 +724,8 @@ class BaseObjVar : public ObjVar
//@}

/// Clean up memory
void destroy() {
void destroy()
{
delete typeInfo;
typeInfo = nullptr;
}
Expand Down Expand Up @@ -867,7 +869,7 @@ class HeapObjVar: public BaseObjVar
/// Constructor
HeapObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti,
const SVFFunction* f, PNODEK ty = HeapObjNode):
BaseObjVar(val, i, ti, ty)
BaseObjVar(val, i, ti, ty)
{
isPtr = val->getType()->isPointerTy();
func = f;
Expand Down Expand Up @@ -933,7 +935,7 @@ class StackObjVar: public BaseObjVar
/// Constructor
StackObjVar(const SVFValue* val, NodeID i, ObjTypeInfo* ti,
const SVFFunction* fun, PNODEK ty = StackObjNode):
BaseObjVar(val, i, ti, ty)
BaseObjVar(val, i, ti, ty)
{
isPtr = val->getType()->isPointerTy();
func = fun;
Expand Down
6 changes: 4 additions & 2 deletions svf/lib/SABER/SaberSVFGBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -232,9 +232,11 @@ bool SaberSVFGBuilder::isStrongUpdate(const SVFGNode* node, NodeID& singleton, B
singleton = *it;

// Strong update can be made if this points-to target is not heap, array or field-insensitive.
if (!pta->isHeapMemObj(singleton) && !pta->isArrayMemObj(singleton)) {
if (!pta->isHeapMemObj(singleton) && !pta->isArrayMemObj(singleton))
{
if (SVFIR::getPAG()->getBaseObject(singleton)->isFieldInsensitive() == false
&& !pta->isLocalVarInRecursiveFun(singleton)) {
&& !pta->isLocalVarInRecursiveFun(singleton))
{
isSU = true;
}
}
Expand Down
3 changes: 2 additions & 1 deletion svf/lib/SVFIR/SymbolTableInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ void SymbolTableInfo::destroy()

const ObjTypeInfo* SymbolTableInfo::createDummyObjTypeInfo(SymID symId, const SVFType* type)
{
if (objTypeInfoMap.find(symId)==objTypeInfoMap.end()) {
if (objTypeInfoMap.find(symId)==objTypeInfoMap.end())
{
ObjTypeInfo* ti = createObjTypeInfo(type);
objTypeInfoMap[symId] = ti;
}
Expand Down
6 changes: 4 additions & 2 deletions svf/lib/WPA/FlowSensitive.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,10 +670,12 @@ bool FlowSensitive::isStrongUpdate(const SVFGNode* node, NodeID& singleton)
singleton = *it;

// Strong update can be made if this points-to target is not heap, array or field-insensitive.
if (!isHeapMemObj(singleton) && !isArrayMemObj(singleton)) {
if (!isHeapMemObj(singleton) && !isArrayMemObj(singleton))
{
assert(pag->getBaseObject(singleton)->isFieldInsensitive() == pag->getBaseObject(singleton)->isFieldInsensitive());
if (pag->getBaseObject(singleton)->isFieldInsensitive() == false
&& !isLocalVarInRecursiveFun(singleton)) {
&& !isLocalVarInRecursiveFun(singleton))
{
isSU = true;
}
}
Expand Down

0 comments on commit 8068f98

Please sign in to comment.