diff options
author | Vedant Kumar <vsk@apple.com> | 2016-06-22 19:57:58 +0000 |
---|---|---|
committer | Vedant Kumar <vsk@apple.com> | 2016-06-22 19:57:58 +0000 |
commit | c35b5c603db3fa9afd201ab99c154e63f21df50d (patch) | |
tree | 6fe02afbc5b31d0e113353f5f020faeec4b8ab70 /lib/CodeGen/CoverageMappingGen.cpp | |
parent | f6e13ce923d836fb3866ac524422475d82ef027e (diff) |
[Coverage] Push a new region when handling CXXTryStmts
Push a new region for the try block and propagate execution counts
through it. This ensures that catch statements get a region counter
distinct from the try block's counter.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@273463 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CoverageMappingGen.cpp')
-rw-r--r-- | lib/CodeGen/CoverageMappingGen.cpp | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/CodeGen/CoverageMappingGen.cpp b/lib/CodeGen/CoverageMappingGen.cpp index 12bad4b03f..b56cd077c8 100644 --- a/lib/CodeGen/CoverageMappingGen.cpp +++ b/lib/CodeGen/CoverageMappingGen.cpp @@ -867,7 +867,12 @@ struct CounterCoverageMappingBuilder void VisitCXXTryStmt(const CXXTryStmt *S) { extendRegion(S); - Visit(S->getTryBlock()); + // Handle macros that generate the "try" but not the rest. + extendRegion(S->getTryBlock()); + + Counter ParentCount = getRegion().getCounter(); + propagateCounts(ParentCount, S->getTryBlock()); + for (unsigned I = 0, E = S->getNumHandlers(); I < E; ++I) Visit(S->getHandler(I)); |