Add a cc1 "dump-coverage-mapping" for testing coverage mapping.

Differential Revision: http://reviews.llvm.org/D4799

llvm-svn: 215258
This commit is contained in:
Alex Lorenz
2014-08-08 23:41:24 +00:00
parent 1c5a38584d
commit f2cf38e020
7 changed files with 71 additions and 5 deletions

View File

@@ -3198,10 +3198,20 @@ void CodeGenModule::ClearUnusedCoverageMapping(const Decl *D) {
}
void CodeGenModule::EmitDeferredUnusedCoverageMappings() {
std::vector<const Decl *> DeferredDecls;
for (const auto I : DeferredEmptyCoverageMappingDecls) {
if (!I.second)
continue;
const auto *D = I.first;
DeferredDecls.push_back(I.first);
}
// Sort the declarations by their location to make sure that the tests get a
// predictable order for the coverage mapping for the unused declarations.
if (CodeGenOpts.DumpCoverageMapping)
std::sort(DeferredDecls.begin(), DeferredDecls.end(),
[] (const Decl *LHS, const Decl *RHS) {
return LHS->getLocStart() < RHS->getLocStart();
});
for (const auto *D : DeferredDecls) {
switch (D->getKind()) {
case Decl::CXXConversion:
case Decl::CXXMethod: