Skip to content

Commit

Permalink
Merge pull request #1562 from jumormt/fix
Browse files Browse the repository at this point in the history
add frontendValueToString
  • Loading branch information
yuleisui authored Oct 6, 2024
2 parents 84e517d + 69de0e8 commit e910a99
Show file tree
Hide file tree
Showing 10 changed files with 22 additions and 23 deletions.
2 changes: 1 addition & 1 deletion svf-llvm/lib/LLVMUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -685,7 +685,7 @@ std::string SVFValue::toString() const
}


const std::string SVFBaseNode::toString() const
const std::string SVFBaseNode::valueOnlyToString() const
{
std::string str;
llvm::raw_string_ostream rawstr(str);
Expand Down
2 changes: 1 addition & 1 deletion svf-llvm/lib/SVFIRBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ void SVFIRBuilder::visitCallSite(CallBase* cs)
return;

DBOUT(DPAGBuild,
outs() << "process callsite " << svfcall->toString() << "\n");
outs() << "process callsite " << svfcall->valueOnlyToString() << "\n");


CallICFGNode* callBlockNode = llvmModuleSet()->getCallICFGNode(cs);
Expand Down
2 changes: 1 addition & 1 deletion svf/include/Graphs/GenericGraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -283,7 +283,7 @@ class SVFBaseNode
return sourceLoc;
}

const std::string toString() const;
const std::string valueOnlyToString() const;


protected:
Expand Down
6 changes: 3 additions & 3 deletions svf/lib/Graphs/ICFG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ const std::string IntraICFGNode::toString() const
for (const SVFStmt *stmt : getSVFStmts())
rawstr << "\n" << stmt->toString();
if(getSVFStmts().empty())
rawstr << "\n" << SVFBaseNode::toString();
rawstr << "\n" << valueOnlyToString();
return rawstr.str();
}

Expand Down Expand Up @@ -137,7 +137,7 @@ const std::string CallICFGNode::toString() const
for (const SVFStmt *stmt : getSVFStmts())
rawstr << "\n" << stmt->toString();
if(getSVFStmts().empty())
rawstr << "\n" << SVFBaseNode::toString();
rawstr << "\n" << valueOnlyToString();
return rawstr.str();
}

Expand All @@ -150,7 +150,7 @@ const std::string RetICFGNode::toString() const
for (const SVFStmt *stmt : getSVFStmts())
rawstr << "\n" << stmt->toString();
if(getSVFStmts().empty())
rawstr << "\n" << SVFBaseNode::toString();
rawstr << "\n" << valueOnlyToString();
return rawstr.str();
}

Expand Down
6 changes: 3 additions & 3 deletions svf/lib/Graphs/SVFG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ const std::string ActualINSVFGNode::toString() const
{
std::string str;
std::stringstream rawstr(str);
rawstr << "ActualINSVFGNode ID: " << getId() << " at callsite: " << (getCallSite())->toString() << " {fun: " << getFun()->getName() << "}";
rawstr << "ActualINSVFGNode ID: " << getId() << " at callsite: " << (getCallSite())->valueOnlyToString() << " {fun: " << getFun()->getName() << "}";
rawstr << "CSMU(" << getMRVer()->getMR()->getMRID() << "V_" << getMRVer()->getSSAVersion() << ")\n";
rawstr << getMRVer()->getMR()->dumpStr() << "\n";
rawstr << "CS[" << getCallSite()->getSourceLoc() << "]";
Expand All @@ -90,7 +90,7 @@ const std::string ActualOUTSVFGNode::toString() const
{
std::string str;
std::stringstream rawstr(str);
rawstr << "ActualOUTSVFGNode ID: " << getId() << " at callsite: " << (getCallSite())->toString() << " {fun: " << getFun()->getName() << "}";
rawstr << "ActualOUTSVFGNode ID: " << getId() << " at callsite: " << (getCallSite())->valueOnlyToString() << " {fun: " << getFun()->getName() << "}";
rawstr << getMRVer()->getMR()->getMRID() << "V_" << getMRVer()->getSSAVersion() <<
" = CSCHI(MR_" << getMRVer()->getMR()->getMRID() << "V_" << getMRVer()->getSSAVersion() << ")\n";
rawstr << getMRVer()->getMR()->dumpStr() << "\n";
Expand Down Expand Up @@ -142,7 +142,7 @@ const std::string InterMSSAPHISVFGNode::toString() const
if(isFormalINPHI())
rawstr << "FormalINPHISVFGNode ID: " << getId() << " {fun: " << getFun()->getName() << "}";
else
rawstr << "ActualOUTPHISVFGNode ID: " << getId() << " at callsite: " << (getCallSite())->toString() << " {fun: " << getFun()->getName() << "}";
rawstr << "ActualOUTPHISVFGNode ID: " << getId() << " at callsite: " << (getCallSite())->valueOnlyToString() << " {fun: " << getFun()->getName() << "}";
rawstr << MSSAPHISVFGNode::toString();
return rawstr.str();
}
Expand Down
2 changes: 1 addition & 1 deletion svf/lib/MTA/TCT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,7 @@ void TCT::dumpCxt(CallStrCxt& cxt)
for(CallStrCxt::const_iterator it = cxt.begin(), eit = cxt.end(); it!=eit; ++it)
{
rawstr << " ' "<< *it << " ' ";
rawstr << (tcg->getCallSite(*it))->toString();
rawstr << (tcg->getCallSite(*it))->valueOnlyToString();
rawstr << " call " << tcg->getCallSite(*it)->getCaller()->getName() << "-->" << tcg->getCalleeOfCallSite(*it)->getName() << ", \n";
}
rawstr << " ]";
Expand Down
8 changes: 4 additions & 4 deletions svf/lib/SABER/DoubleFreeChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,14 +94,14 @@ void DoubleFreeChecker::validateSuccessTests(ProgSlice *slice, const SVFFunction
if (success)
{
outs() << sucMsg("\t SUCCESS :") << funName << " check <src id:" << source->getId()
<< ", cs id:" << (getSrcCSID(source))->toString() << "> at ("
<< ", cs id:" << (getSrcCSID(source))->valueOnlyToString() << "> at ("
<< cs->getSourceLoc() << ")\n";
outs() << "\t\t double free path: \n" << slice->evalFinalCond() << "\n";
}
else
{
SVFUtil::errs() << errMsg("\t FAILURE :") << funName << " check <src id:" << source->getId()
<< ", cs id:" << (getSrcCSID(source))->toString() << "> at ("
<< ", cs id:" << (getSrcCSID(source))->valueOnlyToString() << "> at ("
<< cs->getSourceLoc() << ")\n";
SVFUtil::errs() << "\t\t double free path: \n" << slice->evalFinalCond() << "\n";
assert(false && "test case failed!");
Expand Down Expand Up @@ -140,15 +140,15 @@ void DoubleFreeChecker::validateExpectedFailureTests(ProgSlice *slice, const SVF
if (expectedFailure)
{
outs() << sucMsg("\t EXPECTED-FAILURE :") << funName << " check <src id:" << source->getId()
<< ", cs id:" << (getSrcCSID(source))->toString() << "> at ("
<< ", cs id:" << (getSrcCSID(source))->valueOnlyToString() << "> at ("
<< cs->getSourceLoc() << ")\n";
outs() << "\t\t double free path: \n" << slice->evalFinalCond() << "\n";
}
else
{
SVFUtil::errs() << errMsg("\t UNEXPECTED FAILURE :") << funName
<< " check <src id:" << source->getId()
<< ", cs id:" << (getSrcCSID(source))->toString() << "> at ("
<< ", cs id:" << (getSrcCSID(source))->valueOnlyToString() << "> at ("
<< cs->getSourceLoc() << ")\n";
SVFUtil::errs() << "\t\t double free path: \n" << slice->evalFinalCond() << "\n";
assert(false && "test case failed!");
Expand Down
8 changes: 4 additions & 4 deletions svf/lib/SABER/LeakChecker.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,13 +231,13 @@ void LeakChecker::validateSuccessTests(const SVFGNode* source, const SVFFunction
if (success)
{
outs() << sucMsg("\t SUCCESS :") << funName << " check <src id:" << source->getId()
<< ", cs id:" << (getSrcCSID(source))->toString() << "> at ("
<< ", cs id:" << (getSrcCSID(source))->valueOnlyToString() << "> at ("
<< cs->getSourceLoc() << ")\n";
}
else
{
SVFUtil::errs() << errMsg("\t FAILURE :") << funName << " check <src id:" << source->getId()
<< ", cs id:" << (getSrcCSID(source))->toString() << "> at ("
<< ", cs id:" << (getSrcCSID(source))->valueOnlyToString() << "> at ("
<< cs->getSourceLoc() << ")\n";
assert(false && "test case failed!");
}
Expand Down Expand Up @@ -281,14 +281,14 @@ void LeakChecker::validateExpectedFailureTests(const SVFGNode* source, const SVF
if (expectedFailure)
{
outs() << sucMsg("\t EXPECTED-FAILURE :") << funName << " check <src id:" << source->getId()
<< ", cs id:" << (getSrcCSID(source))->toString() << "> at ("
<< ", cs id:" << (getSrcCSID(source))->valueOnlyToString() << "> at ("
<< cs->getSourceLoc() << ")\n";
}
else
{
SVFUtil::errs() << errMsg("\t UNEXPECTED FAILURE :") << funName
<< " check <src id:" << source->getId()
<< ", cs id:" << (getSrcCSID(source))->toString() << "> at ("
<< ", cs id:" << (getSrcCSID(source))->valueOnlyToString() << "> at ("
<< cs->getSourceLoc() << ")\n";
assert(false && "test case failed!");
}
Expand Down
4 changes: 2 additions & 2 deletions svf/lib/Util/SVFUtil.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -399,8 +399,8 @@ bool SVFUtil::isProgExitCall(const CallICFGNode* cs)
}

__attribute__((weak))
const std::string SVFBaseNode::toString() const
const std::string SVFBaseNode::valueOnlyToString() const
{
assert("SVFBaseNode::toString should be implemented or supported by fronted" && false);
assert("SVFBaseNode::valueOnlyToString should be implemented or supported by fronted" && false);
abort();
}
5 changes: 2 additions & 3 deletions svf/lib/WPA/Andersen.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -247,7 +247,7 @@ void AndersenBase::connectCaller2ForkedFunParams(const CallICFGNode* cs, const S
assert(F);

DBOUT(DAndersen, outs() << "connect parameters from indirect forksite "
<< cs.getInstruction()->toString() << " to forked function "
<< cs->valueOnlyToString() << " to forked function "
<< *F << "\n");

ThreadCallGraph *tdCallGraph = SVFUtil::dyn_cast<ThreadCallGraph>(callgraph);
Expand Down Expand Up @@ -276,8 +276,7 @@ void AndersenBase::connectCaller2CalleeParams(const CallICFGNode* cs,
{
assert(F);

DBOUT(DAndersen, outs() << "connect parameters from indirect callsite " <<
cs.getInstruction()->toString() << " to callee " << *F << "\n");
DBOUT(DAndersen, outs() << "connect parameters from indirect callsite " << cs->valueOnlyToString() << " to callee " << *F << "\n");

const CallICFGNode* callBlockNode = cs;
const RetICFGNode* retBlockNode = cs->getRetICFGNode();
Expand Down

0 comments on commit e910a99

Please sign in to comment.