This is an archive of the discontinued LLVM Phabricator instance.

[Coverage] Push a region and propagate counts through try blocks
AbandonedPublic

Authored by vsk on Jun 1 2016, 2:59 PM.

Details

Summary

This lets us handle expansions in the try block properly. Here's how the final report changes:

Before:

       |   20|// CHECK: Z3fn4v:
      1|   21|#define TRY2 try { // CHECK-DAG: File 1, [[@LINE]]:18 -> [[@LINE]]:19 = #1
      1|   22|void fn4() TRY2 // CHECK-DAG: Expansion,File 0, [[@LINE]]:12 -> [[@LINE]]:16 = #1 (Expanded file = 1)
                         ^1  ^1
      1|   23|  for (;;)
      1|   24|    return;
      1|   25|}
      0|   26|catch (...) {}
       |   27|
       |   28|// CHECK: Z3fn5v:
       |   29|#define TRY3 try { return; } catch (...) // CHECK-DAG: File 2, [[@LINE]]:18 -> [[@LINE]]:29 = #1
      0|   30|#define TRY4 try { TRY3 { return; } } catch (...) // CHECK-DAG: Expansion,File 1, [[@LINE]]:20 -> [[@LINE]]:24 = #1 (Expanded file = 2)
      1|   31|void fn5() {
      1|   32|  for (;;) {
      0|   33|    TRY4 { return; } // CHECK-DAG: Expansion,File 0, [[@LINE]]:5 -> [[@LINE]]:9 = #1 (Expanded file = 1)
                  ^0   ^0
      1|   34|  }                  // CHECK-DAG: File 0, [[@LINE-1]]:10 -> [[@LINE-1]]:21 = #5
      1|   35|}


After:

       |   20|// CHECK: Z3fn4v:
      1|   21|#define TRY2 try { // CHECK-DAG: File 1, [[@LINE]]:18 -> [[@LINE]]:19 = #1
                           ^1  ^1
      1|   22|void fn4() TRY2 // CHECK-DAG: Expansion,File 0, [[@LINE]]:12 -> [[@LINE]]:16 = #1 (Expanded file = 1)
                         ^1  ^1
      1|   23|  for (;;)
      1|   24|    return;
      1|   25|}
      0|   26|catch (...) {}
       |   27|
       |   28|// CHECK: Z3fn5v:
      1|   29|#define TRY3 try { return; } catch (...) // CHECK-DAG: File 2, [[@LINE]]:18 -> [[@LINE]]:29 = #1
      1|   30|#define TRY4 try { TRY3 { return; } } catch (...) // CHECK-DAG: Expansion,File 1, [[@LINE]]:20 -> [[@LINE]]:24 = #1 (Expanded file = 2)
                               ^1^1   ^0
      1|   31|void fn5() {
      1|   32|  for (;;) {
      1|   33|    TRY4 { return; } // CHECK-DAG: Expansion,File 0, [[@LINE]]:5 -> [[@LINE]]:9 = #1 (Expanded file = 1)
                  ^1   ^0
      1|   34|  }                  // CHECK-DAG: File 0, [[@LINE-1]]:10 -> [[@LINE-1]]:21 = #5
      1|   35|}

Diff Detail

Event Timeline

vsk updated this revision to Diff 59285.Jun 1 2016, 2:59 PM
vsk retitled this revision from to [Coverage] Push a region and propagate counts through try blocks.
vsk updated this object.
vsk added a subscriber: cfe-commits.
vsk updated this object.Jun 1 2016, 3:31 PM
vsk abandoned this revision.Jun 22 2016, 1:05 PM

This change is probably too minor for pre-commit review. I rebased the patch and committed r273463: I'd be happy to make any changes to it if requested.