Commit Graph

19 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
Chris Miles
2e675c9bea Fix instrumenting print and debugPrint for Swift 6.
With Swift 6 the print()/debugPrint() function decl is a sub expression of a function conversion expression.

Added tests for print() capture with -swift-version 6.

rdar://136858280
2024-10-01 09:36:29 -07: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
Dmitri Gribenko
984210aa53 tests: replace '// RUN: rm -rf' '// RUN: mkdir' pairs with '%empty-directory(...)'
These changes were made using a script.
2017-06-04 11:08:39 -07:00
Maxwell Swadling
214efbfc3c Added a new AST Walker that instruments the AST to provide callbacks that simulate a program counter
Based off the PlaygroundTransform, this new ASTWalker leaves calls to __builtin_pc_before and __builtin_pc_after before and after a user would expect a program counter to enter a range of source code.
2016-12-19 10:56:40 -08:00
Dmitri Gribenko
55864d10cb Tests: use 'mkdir -p' 2016-09-02 21:36:45 -07:00
Dmitri Gribenko
d175b3b66d Migrate FileCheck to %FileCheck in tests 2016-08-10 23:52:02 -07:00
Dmitri Gribenko
0e1c488f9a stdlib: print, debugPrint: 'toStream:' => 'to:' 2016-02-15 23:48:02 -08:00
Joe Pamer
828eb68e72 Commit DaveA's API changes to 'print', along with the compiler changes necessary to support them.
There's still work left to do. In terms of next steps, there's still rdar://problem/22126141, which covers removing the 'workaround' overloads for print (that prevent bogus overload resolution failures), as well as providing a decent diagnostic when users invoke print with 'appendNewline'.

Swift SVN r30976
2015-08-04 01:57:11 +00:00
Sean Callanan
8a0b1a7244 Updated PlaygroundTransform to call a function after print() is called.
We no longer try to change the print() statement.  I updated the tests, too.

<rdar://problem/22079705> ER: PlaygroundTransform support for print() API


Swift SVN r30891
2015-07-31 23:39:47 +00:00
Sean Callanan
1d9cdbbfeb PlaygroundTransform now forwards print() arguments to $builtin_print() exactly.
We put the argument to be printed (so not the stream or the appendNewline:) into
a temporary variable to avoid type-checking nastiness.  I also made the test
case considerably more comprehensive.

<rdar://problem/21905513> [Swift submission] playgrounds need to handle print with weird arguments


Swift SVN r30457
2015-07-21 18:30:51 +00:00
Arnold Schwaighofer
f7771859d8 Rename the optimize_test feature to executable_test and document that feature.
Swift SVN r29213
2015-06-01 23:44:13 +00:00
Arnold Schwaighofer
3643c614a3 Run tests in optimize test modes
This runs all files that have a target-build-swift or target-run-stdlib-swift
RUN line in optimize test mode.

Swift SVN r29206
2015-06-01 21:23:31 +00:00
Sean Callanan
33b0079a95 Made the PlaygroundTransform instrument the print()/
debugPrint() APIs correctly.  PlaygroundLogger implements
APIs that always take a boolean as their second argument.
If print()/debugPrint() are called with just one argument,
we add "true" as the second argument and replace the call
with a call to the appropriate PlaygroundLogger API.

Also modified the testcase to verify that this is happening
correctly, including when the boolean argument comes from a
more complicated expression.

<rdar://problem/21084145> [Swift integration] Playground AST rewrites not updated for latest Swift standard library changes


Swift SVN r28946
2015-05-23 02:07:25 +00:00
Sean Callanan
032eefaed9 Make the PlaygroundLogger be able to deal with
all the strange and wonderful new ways of printing
things.  Also addeed a testcase.

Note: this does not yet pass information about
which version (print vs. debugPrint) is called and
whether a newline is desired or not; that will be
in a future commit once the PlaygroundLogger
support for that is in a build.

<rdar://problem/20859024>


Swift SVN r28518
2015-05-13 18:12:16 +00:00