Skip to content

[NFCI]Print LineLocation using its print method to simplify the code. #141545

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
May 27, 2025
Merged
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
14 changes: 4 additions & 10 deletions llvm/lib/ProfileData/SampleProfWriter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -580,12 +580,8 @@ std::error_code SampleProfileWriterText::writeSample(const FunctionSamples &S) {
LineLocation Loc = I->first;
const SampleRecord &Sample = I->second;
OS.indent(Indent + 1);
if (Loc.Discriminator == 0)
OS << Loc.LineOffset << ": ";
else
OS << Loc.LineOffset << "." << Loc.Discriminator << ": ";

OS << Sample.getSamples();
Loc.print(OS);
OS << ": " << Sample.getSamples();

for (const auto &J : Sample.getSortedCallTargets())
OS << " " << J.first << ":" << J.second;
Expand All @@ -601,10 +597,8 @@ std::error_code SampleProfileWriterText::writeSample(const FunctionSamples &S) {
LineLocation Loc = I->first;
const FunctionSamples &CalleeSamples = FS.second;
OS.indent(Indent);
if (Loc.Discriminator == 0)
OS << Loc.LineOffset << ": ";
else
OS << Loc.LineOffset << "." << Loc.Discriminator << ": ";
Loc.print(OS);
OS << ": ";
if (std::error_code EC = writeSample(CalleeSamples))
return EC;
}
Expand Down