summaryrefslogtreecommitdiffstats
path: root/clang/lib/CodeGen/CoverageMappingGen.cpp
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2016-06-22 19:57:58 +0000
committerVedant Kumar <vsk@apple.com>2016-06-22 19:57:58 +0000
commit049908b2969f56aba6daf6fb4eb98a4a518ef13a (patch)
treea1ba3c2c8e2ba4c3feafbe2a9267cc3d84775937 /clang/lib/CodeGen/CoverageMappingGen.cpp
parent30afae1a75ea895b3be6bd5f04d8f3c6f6703617 (diff)
downloadbcm5719-llvm-049908b2969f56aba6daf6fb4eb98a4a518ef13a.tar.gz
bcm5719-llvm-049908b2969f56aba6daf6fb4eb98a4a518ef13a.zip
[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. llvm-svn: 273463
Diffstat (limited to 'clang/lib/CodeGen/CoverageMappingGen.cpp')
-rw-r--r--clang/lib/CodeGen/CoverageMappingGen.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/clang/lib/CodeGen/CoverageMappingGen.cpp b/clang/lib/CodeGen/CoverageMappingGen.cpp
index 12bad4b03f7..b56cd077c8b 100644
--- a/clang/lib/CodeGen/CoverageMappingGen.cpp
+++ b/clang/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));
OpenPOWER on IntegriCloud