r216082 - Coverage mapping: fix mapping for objective-c for statement
Alex Lorenz
arphaman at gmail.com
Wed Aug 20 10:11:53 PDT 2014
Author: arphaman
Date: Wed Aug 20 12:11:53 2014
New Revision: 216082
URL: http://llvm.org/viewvc/llvm-project?rev=216082&view=rev
Log:
Coverage mapping: fix mapping for objective-c for statement
Modified:
cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
cfe/trunk/test/CoverageMapping/objc.m
Modified: cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp?rev=216082&r1=216081&r2=216082&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp (original)
+++ cfe/trunk/lib/CodeGen/CoverageMappingGen.cpp Wed Aug 20 12:11:53 2014
@@ -836,6 +836,7 @@ struct CounterCoverageMappingBuilder
// Counter tracks the body of the loop.
RegionMapper Cnt(this, S);
BreakContinueStack.push_back(BreakContinue());
+ Cnt.beginRegion();
VisitSubStmtRBraceState(S->getBody());
BreakContinue BC = BreakContinueStack.pop_back_val();
Cnt.adjustForControlFlow();
Modified: cfe/trunk/test/CoverageMapping/objc.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CoverageMapping/objc.m?rev=216082&r1=216081&r2=216082&view=diff
==============================================================================
--- cfe/trunk/test/CoverageMapping/objc.m (original)
+++ cfe/trunk/test/CoverageMapping/objc.m Wed Aug 20 12:11:53 2014
@@ -9,3 +9,21 @@ void func(A *a) { // CHECK-NEXT: Fil
if (a)
[a bork: 20 ]; // CHECK-NEXT: File 0, [[@LINE]]:5 -> [[@LINE]]:20 = #1 (HasCodeBefore = 0)
}
+
+ at interface NSArray
++ (NSArray*) arrayWithObjects: (id) first, ...;
+- (unsigned) count;
+ at end
+
+ // CHECK: func2
+void func2(NSArray *array) { // CHECK-NEXT: File 0, [[@LINE]]:28 -> [[@LINE+10]]:2 = #0 (HasCodeBefore = 0)
+ int i = 0;
+ for (NSArray *x in array) { // CHECK-NEXT: File 0, [[@LINE]]:29 -> [[@LINE+6]]:4 = #1 (HasCodeBefore = 0)
+ if (x) { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+2]]:6 = #2 (HasCodeBefore = 0)
+ i = 1;
+ } else { // CHECK-NEXT: File 0, [[@LINE]]:12 -> [[@LINE+2]]:6 = (#1 - #2) (HasCodeBefore = 0)
+ i = -1;
+ }
+ }
+ i = 0;
+}
More information about the cfe-commits
mailing list