Commit Graph

11 Commits

Author SHA1 Message Date
Chris Miles
f301746f52 Simplifies PlaygroundTransform tests by moving boilerplate code to a macro.
Defines the %target-playground-build-run-swift macro in the local lit config for PlaygroundTransform which contains all the boilerplate code used by most PlaygroundTransform tests:
* Build a PlaygroundSupport module
* Build the test source into an executable, linking PlaygroundSupport
* Codesign and run the executable
2024-12-07 13:15:09 -08:00
Chris Miles
d287715778 Updated PlaygroundTransform tests to cover Swift 5 and 6.
PlaygroundTransform tests now compile test cases for both Swift language modes 5 and 6.
2024-11-07 11:26:59 -08:00
Anders Bertelrud
8eb931d617 [Sema] Playground transform should also log function and closure parameter values (#63929)
Add logging of function and closure parameter values when the playground transform is enabled and its "high-performance" mode is off.

MOTIVATION

The goal of the optional "playground transform" step in Sema is to instrument the code by inserting calls to `__builtin_log()` and similar log functions, in order to record the execution of the compiled code. Some IDEs (such as Xcode) enable this transform by passing -playground and provide implementations of the logger functions that record information that can then be shown in the IDE.

The playground transform currently logs variable assignments and return statements, but it doesn't log the input parameters received by functions and closures. Knowing these values can be very useful in order to understand the behaviour of functions and closures.

CHANGES

- add a `ParameterList` parameter to `InstrumenterSupport::transformBraceStmt()`
  - this is an optional parameter list that, if given, specifies the parameters that should be logged at the start of the brace statement
  - this has to be passed into the function because it comes from the owner of the BraceStmt
- adjust `PlaygroundTransform.cpp` to make use of this list
  - the transform will insert calls to `__builtin_log()` for each of the parameters, in order
- adjust `PCMacro.cpp` to accept the parameter, though this instrumenter doesn't currently make use of the new information
- add two new unit tests (one for functions and one for closures)
- adjust four existing unit tests to account for the new log calls

REMARKS

- this is currently guarded by the existing "high performance" option (parameter logging is omitted in that case)

rdar://104974072
2023-03-03 12:37:31 -08:00
David Zarzycki
5dcc32f98f Remove all uses of -force-single-frontend-invocation
The `-force-single-frontend-invocation` flag predates WMO and is now an
alias for `-whole-module-optimization`. We should use the latter and let
the former fade into history.
2020-05-08 06:37:41 -04:00
Chris Brough
87e8627f2d [5.1] Upgrade PCMacro/PlaygroundTransform to support module/file IDs
This change PCMacro and PlaygroundTransform to return an a moduleID and
fileID in addition to the source location information. The Frontend has
been changed to run PCMacro and PlaygroundTransform on all input files
instead of the main file only.

The tests have been updated to conform to these changes with an addition
of module and file ID specific tests. The Playgrounds related tests were
adjusted to make a module out of the stub interface files since those
files should not have PCMacro and PlaygroundTransform applied to them.

rdar://problem/50821146
2019-05-28 14:20:59 -07:00
Arnold Schwaighofer
5027df5a41 Codesign test/Playground 2018-08-10 07:48:36 -07:00
Connor Wakamo
451778591e [PlaygroundTransform] Replace "$builtin" with "__builtin".
Currently, the playground transform requires the use of dollar-identifiers as the functions are prefixed with "$builtin".
This commit removes that requirement by replacing "$builtin" with "__builtin".
This aligns with the PC macro.

This addresses <rdar://problem/36031860>.
2018-07-06 13:03:02 -07:00
Saleem Abdulrasool
b67d5f0cf7 test: convert rm -rf && mkdir -p into %empty-directory
This converts the instances of the pattern for which we have a proper
substitution in lit.  This will make it easier to replace it
appropriately with Windows equivalents.
2018-03-06 14:30:54 -08:00
Slava Pestov
5d8bfb09e7 Re-apply "Playground Transform: Fix assertion failure in generic code" (#6747)
This regression was introduced in the following commit:
<6cbb494ad2>

Fixes <rdar://problem/29935266>.
2017-01-11 19:47:20 -08:00
Arnold Schwaighofer
dbab7257bf Revert "Playground Transform: Fix assertion failure in generic code" 2017-01-11 09:02:38 -08:00
Slava Pestov
d38c65dff5 Playground Transform: Fix assertion failure in generic code
This regression was introduced in the following commit:
<6cbb494ad2>

Fixes <rdar://problem/29935266>.
2017-01-10 16:23:12 -08:00