Commit Graph

14 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
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
486cab447d tests: replace 'rm -rf %t && mkdir -p %t' with '%empty-directory(%t)'
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
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
Joe Groff
db0fea590e stdlib: Use unqualified names in 'print'.
Leave the qualification off of enum cases and type names when 'print'-ing them, but keep them on 'debugPrint'. (At least, at the outermost level; since ad-hoc printing of structs and tuples uses debugPrint, we'll still get qualification at depth, which kind of sucks but needs more invasive state management in print to make possible.) Implements rdar://problem/21788604.

Swift SVN r30166
2015-07-13 21:42:11 +00:00
Sean Callanan
872a1c8592 Sequester expressions the PlaygroundTransform adds, isolating type-check errors.
We had a bit of back-and-forth over how to handle type-check errors in added
expressions.  Obviously all added expressions *should* type-check -- but we
don't want the compiler (and, by extension, the XPC playground service) crashing
when they don't.  So the ErrorTypes from failed type-checks must not leak into
existing code.

In this solution, we use a convenience class (Added) that wraps an expression.
It marks expressions we've constructed -- and we're only allowed to type-check
Added<Expr*>s.  (This isn't fully enforced -- you could still have Added<Expr*>s
that refer to existing Expr*s) but adding this and plumbing it through caught
most of the problems.

I also added checks to various places that weren't checking whether type
checking succeeded.  In one case where we were emitting a source location for
one element in a TupleExpr but not emitting source locations for the others
(which caused dumping to assert) I eliminated that source location.

Finally I added several test cases.  These cases used to crash; one of them
works perfectly now and I've XFAILed the other two.

<rdar://problem/20444876>


Swift SVN r29842
2015-07-01 17:53:06 +00:00