本文整理汇总了C++中CoverageMapping::getUniqueSourceFiles方法的典型用法代码示例。如果您正苦于以下问题:C++ CoverageMapping::getUniqueSourceFiles方法的具体用法?C++ CoverageMapping::getUniqueSourceFiles怎么用?C++ CoverageMapping::getUniqueSourceFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CoverageMapping
的用法示例。
在下文中一共展示了CoverageMapping::getUniqueSourceFiles方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: removeUnmappedInputs
void CodeCoverageTool::removeUnmappedInputs(const CoverageMapping &Coverage) {
std::vector<StringRef> CoveredFiles = Coverage.getUniqueSourceFiles();
auto UncoveredFilesIt = SourceFiles.end();
if (!CompareFilenamesOnly) {
// The user may have specified source files which aren't in the coverage
// mapping. Filter these files away.
UncoveredFilesIt = std::remove_if(
SourceFiles.begin(), SourceFiles.end(), [&](const std::string &SF) {
return !std::binary_search(CoveredFiles.begin(), CoveredFiles.end(),
SF);
});
} else {
for (auto &SF : SourceFiles) {
StringRef SFBase = sys::path::filename(SF);
for (const auto &CF : CoveredFiles) {
if (SFBase == sys::path::filename(CF)) {
RemappedFilenames[CF] = SF;
SF = CF;
break;
}
}
}
UncoveredFilesIt = std::remove_if(
SourceFiles.begin(), SourceFiles.end(),
[&](const std::string &SF) { return !RemappedFilenames.count(SF); });
}
SourceFiles.erase(UncoveredFilesIt, SourceFiles.end());
}
示例2: renderRoot
/// \brief Render the CoverageMapping object.
void renderRoot() {
// Start Root of JSON object.
emitDictStart();
emitDictElement("version", LLVM_COVERAGE_EXPORT_JSON_STR);
emitDictElement("type", LLVM_COVERAGE_EXPORT_JSON_TYPE_STR);
emitDictKey("data");
// Start List of Exports.
emitArrayStart();
// Start Export.
emitDictStart();
emitDictElement("object", getObjectFilename());
emitDictKey("files");
FileCoverageSummary Totals = FileCoverageSummary("Totals");
std::vector<std::string> SourceFiles;
for (StringRef SF : Coverage.getUniqueSourceFiles())
SourceFiles.emplace_back(SF);
auto FileReports =
CoverageReport::prepareFileReports(Coverage, Totals, SourceFiles);
renderFiles(SourceFiles, FileReports);
emitDictKey("functions");
renderFunctions(Coverage.getCoveredFunctions());
emitDictKey("totals");
renderSummary(Totals);
// End Export.
emitDictEnd();
// End List of Exports.
emitArrayEnd();
// End Root of JSON Object.
emitDictEnd();
assert((State.top() == JsonState::None) &&
"All Elements In JSON were Closed");
}