Use __attribute__((noescape)) on block arguments of XCTestCase performance methods

Originator:brian.s.croom
Number:rdar://26224596 Date Originated:11-May-2016 01:50 PM
Status:Open Resolved:
Product:Developer Tools Product Version:Xcode 7.3
Classification: Reproducible:
 
Summary:
The `-[XCTestCase measureBlock:]` and `-[XCTestCase measureMetrics:automaticallyStartMeasuring:forBlock:]` methods each take blocks for which `noescape` semantics apply. That is, no reference to the block parameters remains once the methods return. Adding the `__attribute__((noescape))` annotation to these parameters would make this fact explicit, and allow the Swift importer to mark the params as `@noescape` in Swift, which in turn would remove the need to explicitly reference `self` when using members within the blocks.

Specifically, it is currently necessary to fully spell out `self.startMeasuring()` and `self.stopMeasuring()`, like this:

```
measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: false) {
    self.startMeasuring()
    // Do work
    self.stopMeasuring()
}
```

With the added annotation, it can be simplified like this:

```
measureMetrics([XCTPerformanceMetric_WallClockTime], automaticallyStartMeasuring: false) {
    startMeasuring()
    // Do work
    stopMeasuring()
}
```

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!