diff options
author | Vedant Kumar <vsk@apple.com> | 2016-09-23 18:57:32 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2016-09-23 18:57:32 +0000 |
commit | bc6479850e1d4a4522c6d195f93704d3e78e54e3 (patch) | |
tree | a62afdc088765fcce12312bec7d6ff6d785b044a /llvm/tools/llvm-cov/SourceCoverageViewText.cpp | |
parent | 224ef8d73bb49c765ac8d7a352b244ec7c24807e (diff) | |
download | bcm5719-llvm-bc6479850e1d4a4522c6d195f93704d3e78e54e3.tar.gz bcm5719-llvm-bc6479850e1d4a4522c6d195f93704d3e78e54e3.zip |
[llvm-cov] Get rid of all invalid filename references
We used to append filenames into a vector of std::string, and then
append a reference to each string into a separate vector. This made it
easier to work with the getUniqueSourceFiles API. But it's buggy.
std::string has a small-string optimization, so you can't expect to
capture a reference to one if you're copying it into a growing vector.
Add a test that triggers this invalid reference to std::string scenario,
and kill the issue with fire by just using ArrayRef<std::string>
everywhere.
llvm-svn: 282281
Diffstat (limited to 'llvm/tools/llvm-cov/SourceCoverageViewText.cpp')
-rw-r--r-- | llvm/tools/llvm-cov/SourceCoverageViewText.cpp | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp index f5201d9c808..68891298a07 100644 --- a/llvm/tools/llvm-cov/SourceCoverageViewText.cpp +++ b/llvm/tools/llvm-cov/SourceCoverageViewText.cpp @@ -29,7 +29,7 @@ void CoveragePrinterText::closeViewFile(OwnedStream OS) { } Error CoveragePrinterText::createIndexFile( - ArrayRef<StringRef> SourceFiles, + ArrayRef<std::string> SourceFiles, const coverage::CoverageMapping &Coverage) { auto OSOrErr = createOutputStream("index", "txt", /*InToplevel=*/true); if (Error E = OSOrErr.takeError()) @@ -38,7 +38,7 @@ Error CoveragePrinterText::createIndexFile( raw_ostream &OSRef = *OS.get(); CoverageReport Report(Opts, Coverage); - Report.renderFileReports(OSRef); + Report.renderFileReports(OSRef, SourceFiles); Opts.colored_ostream(OSRef, raw_ostream::CYAN) << "\n" << Opts.getLLVMVersionString(); |