vsk created this revision. vsk added reviewers: bogner, MaggieYi, phillip.power. vsk added a subscriber: cfe-commits.
There are three possible scenarios when entering a CXXTryStmt: 1. No exceptions thrown. 2. An exception is thrown but caught by one of the handlers. 3. An exception is thrown but not caught by one of the handlers. The region we push after a CXXTryStmt isn't useful in scenarios (1) or (2). In these cases, if control flows to the try block it must flow to the region following the CXXTryStmt. This may not be the case in situation (3). However, we don't handle this scenario anywhere else (e.g after function calls). Having a dedicated region here could only be helpful if its counter expression differed from the try block, and even then it's questionable. http://reviews.llvm.org/D20878 Files: lib/CodeGen/CoverageMappingGen.cpp test/CoverageMapping/trycatch.cpp Index: test/CoverageMapping/trycatch.cpp =================================================================== --- test/CoverageMapping/trycatch.cpp +++ test/CoverageMapping/trycatch.cpp @@ -33,5 +33,5 @@ catch(const Warning &w) { // CHECK-NEXT: File 0, [[@LINE]]:27 -> [[@LINE+2]]:4 = #4 j = 0; } - return 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = #1 + return 0; } Index: lib/CodeGen/CoverageMappingGen.cpp =================================================================== --- lib/CodeGen/CoverageMappingGen.cpp +++ lib/CodeGen/CoverageMappingGen.cpp @@ -850,9 +850,6 @@ Visit(S->getTryBlock()); for (unsigned I = 0, E = S->getNumHandlers(); I < E; ++I) Visit(S->getHandler(I)); - - Counter ExitCount = getRegionCounter(S); - pushRegion(ExitCount); } void VisitCXXCatchStmt(const CXXCatchStmt *S) {
Index: test/CoverageMapping/trycatch.cpp =================================================================== --- test/CoverageMapping/trycatch.cpp +++ test/CoverageMapping/trycatch.cpp @@ -33,5 +33,5 @@ catch(const Warning &w) { // CHECK-NEXT: File 0, [[@LINE]]:27 -> [[@LINE+2]]:4 = #4 j = 0; } - return 0; // CHECK-NEXT: File 0, [[@LINE]]:3 -> [[@LINE]]:11 = #1 + return 0; } Index: lib/CodeGen/CoverageMappingGen.cpp =================================================================== --- lib/CodeGen/CoverageMappingGen.cpp +++ lib/CodeGen/CoverageMappingGen.cpp @@ -850,9 +850,6 @@ Visit(S->getTryBlock()); for (unsigned I = 0, E = S->getNumHandlers(); I < E; ++I) Visit(S->getHandler(I)); - - Counter ExitCount = getRegionCounter(S); - pushRegion(ExitCount); } void VisitCXXCatchStmt(const CXXCatchStmt *S) {
_______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits