From dbcfadedf97afd4e8c61827f5caf214aaef06068 Mon Sep 17 00:00:00 2001 From: Eli Friedman Date: Wed, 13 Dec 2017 00:14:17 +0000 Subject: [Coverage] Always emit unused coverage mappings in the same order. Non-determinism is confusing at best. Differential Revision: https://reviews.llvm.org/D41140 llvm-svn: 320533 --- clang/lib/CodeGen/CodeGenModule.cpp | 16 +++------------- 1 file changed, 3 insertions(+), 13 deletions(-) (limited to 'clang/lib/CodeGen/CodeGenModule.cpp') diff --git a/clang/lib/CodeGen/CodeGenModule.cpp b/clang/lib/CodeGen/CodeGenModule.cpp index 7f64fd062dc..421a1ad3d0d 100644 --- a/clang/lib/CodeGen/CodeGenModule.cpp +++ b/clang/lib/CodeGen/CodeGenModule.cpp @@ -4286,20 +4286,10 @@ void CodeGenModule::ClearUnusedCoverageMapping(const Decl *D) { } void CodeGenModule::EmitDeferredUnusedCoverageMappings() { - std::vector DeferredDecls; - for (const auto &I : DeferredEmptyCoverageMappingDecls) { - if (!I.second) + for (const auto &Entry : DeferredEmptyCoverageMappingDecls) { + if (!Entry.second) continue; - 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) { + const Decl *D = Entry.first; switch (D->getKind()) { case Decl::CXXConversion: case Decl::CXXMethod: -- cgit v1.2.3