diff options
author | Igor Kudrin <ikudrin.dev@gmail.com> | 2016-05-04 15:38:26 +0000 |
---|---|---|
committer | Igor Kudrin <ikudrin.dev@gmail.com> | 2016-05-04 15:38:26 +0000 |
commit | b5f1f3cacdb0ba272db85083a72495d6b76d6093 (patch) | |
tree | 7dc152c5cda11d50b06179346bf596e4a50fb909 /test/CoverageMapping | |
parent | 346d1b48180296f0c0bbbf9c3ae6d3d55d54738f (diff) |
[Coverage] Fix an issue where a coverage region might not be created for a macro containing a loop statement.
The issue happened when a macro contained a full for or
while statement, which body ended at the end of the macro.
Differential Revision: http://reviews.llvm.org/D19725
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@268511 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CoverageMapping')
-rw-r--r-- | test/CoverageMapping/macroscopes.cpp | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/test/CoverageMapping/macroscopes.cpp b/test/CoverageMapping/macroscopes.cpp index 7aed39d282..f5fd55c731 100644 --- a/test/CoverageMapping/macroscopes.cpp +++ b/test/CoverageMapping/macroscopes.cpp @@ -22,6 +22,17 @@ #define starts_a_while while (x < 5) #define simple_stmt ++x +#define macro_with_for \ + x = 3; \ + for (int i = 0; i < x; ++i) { \ + } + +#define macro_with_while \ + x = 4; \ + while (x < 5) { \ + ++x; \ + } + // CHECK: main // CHECK-NEXT: File 0, [[@LINE+1]]:12 -> {{[0-9]+}}:2 = #0 int main() { @@ -64,6 +75,11 @@ int main() { simple_stmt; ends_a_scope + // CHECK-NEXT: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:17 = #0 + macro_with_for + // CHECK-NEXT: Expansion,File 0, [[@LINE+1]]:3 -> [[@LINE+1]]:19 = #0 + macro_with_while + return 0; } @@ -103,3 +119,10 @@ int main() { // CHECK-NEXT: File 11, 22:31 -> 22:36 = (#0 + #9) // CHECK-NEXT: File 12, 23:21 -> 23:24 = #9 // CHECK-NEXT: File 13, 6:3 -> 7:4 = #9 +// CHECK-NEXT: File 14, 26:3 -> 28:4 = #0 +// CHECK-NEXT: File 14, 27:19 -> 27:24 = (#0 + #10) +// CHECK-NEXT: File 14, 27:26 -> 27:29 = #10 +// CHECK-NEXT: File 14, 27:31 -> 28:4 = #10 +// CHECK-NEXT: File 15, 31:3 -> 34:4 = #0 +// CHECK-NEXT: File 15, 32:10 -> 32:15 = (#0 + #11) +// CHECK-NEXT: File 15, 32:17 -> 34:4 = #11 |