[llvm] r282286 - [llvm-cov] Factor out logic to remove unmapped inputs (NFC)
Vedant Kumar via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 23 13:13:42 PDT 2016
Author: vedantk
Date: Fri Sep 23 15:13:41 2016
New Revision: 282286
URL: http://llvm.org/viewvc/llvm-project?rev=282286&view=rev
Log:
[llvm-cov] Factor out logic to remove unmapped inputs (NFC)
Modified:
llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
Modified: llvm/trunk/tools/llvm-cov/CodeCoverage.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-cov/CodeCoverage.cpp?rev=282286&r1=282285&r2=282286&view=diff
==============================================================================
--- llvm/trunk/tools/llvm-cov/CodeCoverage.cpp (original)
+++ llvm/trunk/tools/llvm-cov/CodeCoverage.cpp Fri Sep 23 15:13:41 2016
@@ -92,6 +92,9 @@ private:
/// \brief Load the coverage mapping data. Return nullptr if an error occured.
std::unique_ptr<CoverageMapping> load();
+ /// \brief Remove input source files which aren't mapped by \p Coverage.
+ void removeUnmappedInputs(const CoverageMapping &Coverage);
+
/// \brief If a demangler is available, demangle all symbol names.
void demangleSymbols(const CoverageMapping &Coverage);
@@ -332,7 +335,16 @@ std::unique_ptr<CoverageMapping> CodeCov
if (Mismatched)
warning(utostr(Mismatched) + " functions have mismatched data");
- std::vector<StringRef> CoveredFiles = Coverage.get()->getUniqueSourceFiles();
+ if (!SourceFiles.empty())
+ removeUnmappedInputs(*Coverage);
+
+ demangleSymbols(*Coverage);
+
+ return Coverage;
+}
+
+void CodeCoverageTool::removeUnmappedInputs(const CoverageMapping &Coverage) {
+ std::vector<StringRef> CoveredFiles = Coverage.getUniqueSourceFiles();
auto UncoveredFilesIt = SourceFiles.end();
if (!CompareFilenamesOnly) {
@@ -360,10 +372,6 @@ std::unique_ptr<CoverageMapping> CodeCov
}
SourceFiles.erase(UncoveredFilesIt, SourceFiles.end());
-
- demangleSymbols(*Coverage);
-
- return Coverage;
}
void CodeCoverageTool::demangleSymbols(const CoverageMapping &Coverage) {
More information about the llvm-commits
mailing list