diff options
author | Alex Lorenz <arphaman@gmail.com> | 2014-08-08 23:41:24 +0000 |
---|---|---|
committer | Alex Lorenz <arphaman@gmail.com> | 2014-08-08 23:41:24 +0000 |
commit | f2cf38e0208d880e99dbf680060704d8c4a2bcae (patch) | |
tree | 6f60d6a8cf3bc82f9ba0c9ac945afd11889bbfa8 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 1c5a38584df86655fd19e63c5bfa122f6343c379 (diff) | |
download | bcm5719-llvm-f2cf38e0208d880e99dbf680060704d8c4a2bcae.tar.gz bcm5719-llvm-f2cf38e0208d880e99dbf680060704d8c4a2bcae.zip |
Add a cc1 "dump-coverage-mapping" for testing coverage mapping.
Differential Revision: http://reviews.llvm.org/D4799
llvm-svn: 215258
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenModule.cpp | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 5040965161c..1f0dd73e65b 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -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: |