[llvm] r294136 - [llvm-cov] Demangle symbols in function summaries (fixes PR31394)
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Sun Feb 5 12:11:03 PST 2017
Author: vedantk
Date: Sun Feb 5 14:11:03 2017
New Revision: 294136
URL: http://llvm.org/viewvc/llvm-project?rev=294136&view=rev
Log:
[llvm-cov] Demangle symbols in function summaries (fixes PR31394)
Modified:
llvm/trunk/test/tools/llvm-cov/demangle.test
llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
llvm/trunk/tools/llvm-cov/CoverageReport.cpp
llvm/trunk/tools/llvm-cov/CoverageReport.h
Modified: llvm/trunk/test/tools/llvm-cov/demangle.test
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/tools/llvm-cov/demangle.test?rev=294136&r1=294135&r2=294136&view=diff
==============================================================================
--- llvm/trunk/test/tools/llvm-cov/demangle.test (original)
+++ llvm/trunk/test/tools/llvm-cov/demangle.test Sun Feb 5 14:11:03 2017
@@ -4,5 +4,8 @@ RUN: llvm-cov show %S/Inputs/templateIns
RUN: llvm-profdata merge %S/Inputs/hideUnexecutedSubviews.proftext -o %t.profdata
RUN: llvm-cov show %S/Inputs/templateInstantiations.covmapping -instr-profile %t.profdata -Xdemangler sed -Xdemangler 's/_/X/g' -filename-equivalence %S/showTemplateInstantiations.cpp | FileCheck %s
+// Check that we demangle names when printing out function summaries.
+RUN: llvm-cov report %S/Inputs/templateInstantiations.covmapping -instr-profile %S/Inputs/templateInstantiations.profdata -Xdemangler sed -Xdemangler 's/_/X/g' -filename-equivalence %S/showTemplateInstantiations.cpp | FileCheck %s
+
CHECK-DAG: XZ4funcIbEiTX
CHECK-DAG: XZ4funcIiEiTX
Modified: llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CodeCoverage.cpp?rev=294136&r1=294135&r2=294136&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CodeCoverage.cpp (original)
+++ llvm/trunk/tools/llvm-cov/CodeCoverage.cpp Sun Feb 5 14:11:03 2017
@@ -823,7 +823,7 @@ int CodeCoverageTool::report(int argc, c
if (SourceFiles.empty())
Report.renderFileReports(llvm::outs());
else
- Report.renderFunctionReports(SourceFiles, llvm::outs());
+ Report.renderFunctionReports(SourceFiles, DC, llvm::outs());
return 0;
}
Modified: llvm/trunk/tools/llvm-cov/CoverageReport.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CoverageReport.cpp?rev=294136&r1=294135&r2=294136&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CoverageReport.cpp (original)
+++ llvm/trunk/tools/llvm-cov/CoverageReport.cpp Sun Feb 5 14:11:03 2017
@@ -200,12 +200,14 @@ void CoverageReport::render(const FileCo
}
void CoverageReport::render(const FunctionCoverageSummary &Function,
+ const DemangleCache &DC,
raw_ostream &OS) const {
auto FuncCoverageColor =
determineCoveragePercentageColor(Function.RegionCoverage);
auto LineCoverageColor =
determineCoveragePercentageColor(Function.LineCoverage);
- OS << column(Function.Name, FunctionReportColumns[0], Column::RightTrim)
+ OS << column(DC.demangle(Function.Name), FunctionReportColumns[0],
+ Column::RightTrim)
<< format("%*u", FunctionReportColumns[1],
(unsigned)Function.RegionCoverage.NumRegions);
Options.colored_ostream(OS, FuncCoverageColor)
@@ -230,6 +232,7 @@ void CoverageReport::render(const Functi
}
void CoverageReport::renderFunctionReports(ArrayRef<std::string> Files,
+ const DemangleCache &DC,
raw_ostream &OS) {
bool isFirst = true;
for (StringRef Filename : Files) {
@@ -242,7 +245,7 @@ void CoverageReport::renderFunctionRepor
std::vector<StringRef> Funcnames;
for (const auto &F : Functions)
- Funcnames.emplace_back(F.Name);
+ Funcnames.emplace_back(DC.demangle(F.Name));
adjustColumnWidths({}, Funcnames);
OS << "File '" << Filename << "':\n";
@@ -262,12 +265,12 @@ void CoverageReport::renderFunctionRepor
++Totals.ExecutionCount;
Totals.RegionCoverage += Function.RegionCoverage;
Totals.LineCoverage += Function.LineCoverage;
- render(Function, OS);
+ render(Function, DC, OS);
}
if (Totals.ExecutionCount) {
renderDivider(FunctionReportColumns, OS);
OS << "\n";
- render(Totals, OS);
+ render(Totals, DC, OS);
}
}
}
Modified: llvm/trunk/tools/llvm-cov/CoverageReport.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CoverageReport.h?rev=294136&r1=294135&r2=294136&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CoverageReport.h (original)
+++ llvm/trunk/tools/llvm-cov/CoverageReport.h Sun Feb 5 14:11:03 2017
@@ -25,14 +25,16 @@ class CoverageReport {
const coverage::CoverageMapping &Coverage;
void render(const FileCoverageSummary &File, raw_ostream &OS) const;
- void render(const FunctionCoverageSummary &Function, raw_ostream &OS) const;
+ void render(const FunctionCoverageSummary &Function, const DemangleCache &DC,
+ raw_ostream &OS) const;
public:
CoverageReport(const CoverageViewOptions &Options,
const coverage::CoverageMapping &Coverage)
: Options(Options), Coverage(Coverage) {}
- void renderFunctionReports(ArrayRef<std::string> Files, raw_ostream &OS);
+ void renderFunctionReports(ArrayRef<std::string> Files,
+ const DemangleCache &DC, raw_ostream &OS);
/// Prepare file reports for the files specified in \p Files.
static std::vector<FileCoverageSummary>
More information about the llvm-commits
mailing list