8000 refactor valueonlytostring by jumormt · Pull Request #1660 · SVF-tools/SVF · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

refactor valueonlytostring #1660

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Feb 18, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 10 additions & 26 deletions svf-llvm/lib/LLVMUtil.cpp
< 8000 td class="blob-code blob-code-deletion js-file-line"> baseNode = valVar->getBaseNode();
Original file line number Diff line number Diff line change
Expand Up @@ -767,33 +767,17 @@
{
std::string str;
llvm::raw_string_ostream rawstr(str);
if (const SVF::CallGraphNode* fun = SVFUtil::dyn_cast<CallGraphNode>(this))
{
rawstr << "Function: " << fun->getFunction()->getName() << " ";
}
assert(

Check warning on line 770 in svf-llvm/lib/LLVMUtil.cpp

View check run for this annotation

Codecov / codecov/patch

svf-llvm/lib/LLVMUtil.cpp#L770

Added line #L770 was not covered by tests
!SVFUtil::isa<GepObjVar>(this) && !SVFUtil::isa<GepValVar>(this) &&
!SVFUtil::isa<DummyObjVar>(this) &&!SVFUtil::isa<DummyValVar>(this) &&
!SVFUtil::isa<BlackHoleValVar>(this) &&
"invalid value, refer to their toString method");
auto llvmVal =
LLVMModuleSet::getLLVMModuleSet()->getLLVMValue(this);
if (llvmVal)
rawstr << " " << *llvmVal << " ";
else
{
const SVFValue* baseNode = this;
if (const GepValVar* valVar = SVFUtil::dyn_cast<GepValVar>(this))
{
}
else if (const GepObjVar* objVar = SVFUtil::dyn_cast<GepObjVar>(this))
{
baseNode = objVar->getBaseObj();
}
if (SVFUtil::isa<DummyObjVar, DummyValVar, BlackHoleValVar>(baseNode))
rawstr << "";
else
{
auto llvmVal =
LLVMModuleSet::getLLVMModuleSet()->getLLVMValue(baseNode);
if (llvmVal)
rawstr << " " << *llvmVal << " ";
else
rawstr << "";
}
}
rawstr << "";

Check warning on line 780 in svf-llvm/lib/LLVMUtil.cpp

View check run for this annotation

Codecov / codecov/patch

svf-llvm/lib/LLVMUtil.cpp#L780

Added line #L780 was not covered by tests
rawstr << getSourceLoc();
return rawstr.str();
}
Expand Down
2 changes: 1 addition & 1 deletion svf-llvm/tools/Example/svf-ex.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ std::string printPts(PointerAnalysis* pta, const SVFVar* svfval)
{
rawstr << " " << *ii << " ";
PAGNode* targetObj = pta->getPAG()->getGNode(*ii);
rawstr << "(" << targetObj->valueOnlyToString() << ")\t ";
rawstr << "(" << targetObj->toString() << ")\t ";
}

return rawstr.str();
Expand Down
4 changes: 2 additions & 2 deletions svf/lib/SVFIR/SVFVariables.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@
if (Options::ShowSVFIRValue())
{
rawstr << "\n";
rawstr << valueOnlyToString();
rawstr << getBaseNode()->valueOnlyToString();

Check warning on line 172 in svf/lib/SVFIR/SVFVariables.cpp

View check run for this annotation

Codecov / codecov/patch

svf/lib/SVFIR/SVFVariables.cpp#L172

Added line #L172 was not covered by tests
}
return rawstr.str();
}
Expand Down Expand Up @@ -203,7 +203,7 @@
if (Options::ShowSVFIRValue())
{
rawstr << "\n";
rawstr << valueOnlyToString();
rawstr << getBaseObj()->valueOnlyToString();
}
return rawstr.str();
}
Expand Down
Loading
0