summaryrefslogtreecommitdiff
path: root/test/CoverageMapping
diff options
context:
space:
mode:
authorVedant Kumar <vsk@apple.com>2018-11-19 20:10:22 +0000
committerVedant Kumar <vsk@apple.com>2018-11-19 20:10:22 +0000
commit6345f58fdb731a4cd616a77d02492be803661d72 (patch)
treebeb31877e6b39fa6f6f78d8d78a8f46adf377c99 /test/CoverageMapping
parentfd846d8d28f8c89f422658771c363abc6532096d (diff)
downloadclang-6345f58fdb731a4cd616a77d02492be803661d72.tar.gz
[Coverage] Fix PR39258: support coverage regions that start deeper than they end
popRegions used to assume that the start location of a region can't be nested deeper than the end location, which is not always true. Patch by Orivej Desh! Differential Revision: https://reviews.llvm.org/D53244 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@347262 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CoverageMapping')
-rw-r--r--test/CoverageMapping/macros.c10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/CoverageMapping/macros.c b/test/CoverageMapping/macros.c
index 95fe37ed7e..39cd190b2a 100644
--- a/test/CoverageMapping/macros.c
+++ b/test/CoverageMapping/macros.c
@@ -4,6 +4,7 @@
#define MACRO_2 bar()
#define MACRO_1 return; MACRO_2
#define MACRO_3 MACRO_2
+#define GOTO goto
void bar() {}
@@ -56,6 +57,15 @@ void func5() { // CHECK-NEXT: File 0, [[@LINE]]:14 -> [[@LINE+4]]:2 = #0
// CHECK-NEXT: Expansion,File 1, 6:17 -> 6:24 = #1
// CHECK-NEXT: File 2, 4:17 -> 4:22 = #1
+// CHECK-NEXT: func6
+void func6(unsigned count) { // CHECK-NEXT: File 0, [[@LINE]]:28 -> [[@LINE+4]]:2 = #0
+begin: // CHECK-NEXT: File 0, [[@LINE]]:1 -> [[@LINE+3]]:2 = #1
+ if (count--) // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE]]:16 = #1
+ GOTO begin; // CHECK-NEXT: File 0, [[@LINE]]:9 -> [[@LINE]]:19 = #2
+}
+// CHECK-NEXT: Expansion,File 0, [[@LINE-2]]:9 -> [[@LINE-2]]:13 = #2
+// CHECK-NEXT: File 1, 7:14 -> 7:18 = #2
+
int main(int argc, const char *argv[]) {
func();
func2();