Skip to content

Commit b75f9ee

Browse files
authored
Merge pull request #24811 from ChrisBrough/cbrough/50821146-review
[5.1] Upgrade PCMacro/PlaygroundTransform to support module/file IDs
2 parents b8722fd + 87e8627 commit b75f9ee

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

54 files changed

+455
-153
lines changed

lib/Frontend/Frontend.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,18 @@ void CompilerInstance::parseAndCheckTypesUpTo(
807807
options.WarnLongExpressionTypeChecking,
808808
options.SolverExpressionTimeThreshold,
809809
options.SwitchCheckingInvocationThreshold);
810+
811+
if (!Context->hadError() && Invocation.getFrontendOptions().PCMacro) {
812+
performPCMacro(SF, PersistentState.getTopLevelContext());
813+
}
814+
815+
// Playground transform knows to look out for PCMacro's changes and not
816+
// to playground log them.
817+
if (!Context->hadError() &&
818+
Invocation.getFrontendOptions().PlaygroundTransform) {
819+
performPlaygroundTransform(
820+
SF, Invocation.getFrontendOptions().PlaygroundHighPerformance);
821+
}
810822
});
811823

812824
if (Invocation.isCodeCompletion()) {
@@ -947,17 +959,6 @@ void CompilerInstance::parseAndTypeCheckMainFileUpTo(
947959
performDebuggerTestingTransform(MainFile);
948960
}
949961

950-
if (mainIsPrimary && !Context->hadError() &&
951-
Invocation.getFrontendOptions().PCMacro) {
952-
performPCMacro(MainFile, PersistentState.getTopLevelContext());
953-
}
954-
955-
// Playground transform knows to look out for PCMacro's changes and not
956-
// to playground log them.
957-
if (mainIsPrimary && !Context->hadError() &&
958-
Invocation.getFrontendOptions().PlaygroundTransform)
959-
performPlaygroundTransform(
960-
MainFile, Invocation.getFrontendOptions().PlaygroundHighPerformance);
961962
if (!mainIsPrimary) {
962963
performNameBinding(MainFile);
963964
}

lib/Sema/InstrumenterSupport.cpp

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@
1717

1818
#include "InstrumenterSupport.h"
1919
#include "swift/AST/DiagnosticSuppression.h"
20+
#include "swift/Demangling/Punycode.h"
21+
#include "llvm/Support/Path.h"
2022

2123
using namespace swift;
2224
using namespace swift::instrumenter_support;
@@ -75,6 +77,41 @@ class ErrorFinder : public ASTWalker {
7577
};
7678
} // end anonymous namespace
7779

80+
InstrumenterBase::InstrumenterBase(ASTContext &C, DeclContext *DC)
81+
: Context(C), TypeCheckDC(DC), CF(*this) {
82+
// Prefixes for module and file vars
83+
const std::string builtinPrefix = "__builtin";
84+
const std::string modulePrefix = "_pg_module_";
85+
const std::string filePrefix = "_pg_file_";
86+
87+
// Setup Module identifier
88+
std::string moduleName = TypeCheckDC->getParentModule()->getName().str();
89+
Identifier moduleIdentifier =
90+
Context.getIdentifier(builtinPrefix + modulePrefix + moduleName);
91+
92+
SmallVector<ValueDecl *, 1> results;
93+
TypeCheckDC->getParentModule()->lookupValue(
94+
{}, moduleIdentifier, NLKind::UnqualifiedLookup, results);
95+
96+
ModuleIdentifier = (results.size() == 1) ? moduleIdentifier : Identifier();
97+
98+
// Setup File identifier
99+
StringRef filePath = TypeCheckDC->getParentSourceFile()->getFilename();
100+
StringRef fileName = llvm::sys::path::stem(filePath);
101+
102+
std::string filePunycodeName;
103+
Punycode::encodePunycodeUTF8(fileName, filePunycodeName, true);
104+
Identifier fileIdentifier =
105+
Context.getIdentifier(builtinPrefix + modulePrefix + moduleName +
106+
filePrefix + filePunycodeName);
107+
108+
results.clear();
109+
TypeCheckDC->getParentModule()->lookupValue(
110+
{}, fileIdentifier, NLKind::UnqualifiedLookup, results);
111+
112+
FileIdentifier = (results.size() == 1) ? fileIdentifier : Identifier();
113+
}
114+
78115
void InstrumenterBase::anchor() {}
79116

80117
bool InstrumenterBase::doTypeCheckImpl(ASTContext &Ctx, DeclContext *DC,

lib/Sema/InstrumenterSupport.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,12 @@ template <class E> class Added {
4040
class InstrumenterBase {
4141

4242
protected:
43-
InstrumenterBase() : CF(*this) {}
43+
ASTContext &Context;
44+
DeclContext *TypeCheckDC;
45+
Identifier ModuleIdentifier;
46+
Identifier FileIdentifier;
47+
48+
InstrumenterBase(ASTContext &C, DeclContext *DC);
4449
virtual ~InstrumenterBase() = default;
4550
virtual void anchor();
4651
virtual BraceStmt *transformBraceStmt(BraceStmt *BS,

lib/Sema/PCMacro.cpp

Lines changed: 33 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,11 @@ namespace {
3838

3939
class Instrumenter : InstrumenterBase {
4040
private:
41-
ASTContext &Context;
42-
DeclContext *TypeCheckDC;
4341
unsigned &TmpNameIndex;
4442

4543
public:
4644
Instrumenter(ASTContext &C, DeclContext *DC, unsigned &TmpNameIndex)
47-
: Context(C), TypeCheckDC(DC), TmpNameIndex(TmpNameIndex) {}
45+
: InstrumenterBase(C, DC), TmpNameIndex(TmpNameIndex) {}
4846

4947
Stmt *transformStmt(Stmt *S) {
5048
switch (S->getKind()) {
@@ -536,15 +534,28 @@ class Instrumenter : InstrumenterBase {
536534
Expr *StartColumn = IntegerLiteralExpr::createFromUnsigned(Context, StartLC.second);
537535
Expr *EndColumn = IntegerLiteralExpr::createFromUnsigned(Context, EndLC.second);
538536

539-
llvm::SmallVector<Expr *, 5> ArgsWithSourceRange{};
537+
Expr *ModuleExpr =
538+
!ModuleIdentifier.empty()
539+
? (Expr *)new (Context) UnresolvedDeclRefExpr(
540+
ModuleIdentifier, DeclRefKind::Ordinary, DeclNameLoc(SR.End))
541+
: (Expr *)IntegerLiteralExpr::createFromUnsigned(Context, 0);
540542

541-
ArgsWithSourceRange.append({StartLine, EndLine, StartColumn, EndColumn});
543+
Expr *FileExpr =
544+
!FileIdentifier.empty()
545+
? (Expr *)new (Context) UnresolvedDeclRefExpr(
546+
FileIdentifier, DeclRefKind::Ordinary, DeclNameLoc(SR.End))
547+
: (Expr *)IntegerLiteralExpr::createFromUnsigned(Context, 0);
548+
549+
llvm::SmallVector<Expr *, 6> ArgsWithSourceRange{};
550+
551+
ArgsWithSourceRange.append(
552+
{StartLine, EndLine, StartColumn, EndColumn, ModuleExpr, FileExpr});
542553

543554
UnresolvedDeclRefExpr *BeforeLoggerRef = new (Context)
544555
UnresolvedDeclRefExpr(Context.getIdentifier("__builtin_pc_before"),
545556
DeclRefKind::Ordinary, DeclNameLoc(SR.End));
546557
BeforeLoggerRef->setImplicit(true);
547-
SmallVector<Identifier, 4> ArgLabels(ArgsWithSourceRange.size(),
558+
SmallVector<Identifier, 6> ArgLabels(ArgsWithSourceRange.size(),
548559
Identifier());
549560
ApplyExpr *BeforeLoggerCall = CallExpr::createImplicit(
550561
Context, BeforeLoggerRef, ArgsWithSourceRange, ArgLabels);
@@ -603,17 +614,30 @@ class Instrumenter : InstrumenterBase {
603614
Expr *StartColumn = IntegerLiteralExpr::createFromUnsigned(Context, StartLC.second);
604615
Expr *EndColumn = IntegerLiteralExpr::createFromUnsigned(Context, EndLC.second);
605616

606-
llvm::SmallVector<Expr *, 4> ArgsWithSourceRange{};
617+
Expr *ModuleExpr =
618+
!ModuleIdentifier.empty()
619+
? (Expr *)new (Context) UnresolvedDeclRefExpr(
620+
ModuleIdentifier, DeclRefKind::Ordinary, DeclNameLoc(SR.End))
621+
: (Expr *)IntegerLiteralExpr::createFromUnsigned(Context, 0);
622+
623+
Expr *FileExpr =
624+
!FileIdentifier.empty()
625+
? (Expr *)new (Context) UnresolvedDeclRefExpr(
626+
FileIdentifier, DeclRefKind::Ordinary, DeclNameLoc(SR.End))
627+
: (Expr *)IntegerLiteralExpr::createFromUnsigned(Context, 0);
628+
629+
llvm::SmallVector<Expr *, 6> ArgsWithSourceRange{};
607630

608-
ArgsWithSourceRange.append({StartLine, EndLine, StartColumn, EndColumn});
631+
ArgsWithSourceRange.append(
632+
{StartLine, EndLine, StartColumn, EndColumn, ModuleExpr, FileExpr});
609633

610634
UnresolvedDeclRefExpr *LoggerRef = new (Context)
611635
UnresolvedDeclRefExpr(Context.getIdentifier(LoggerName),
612636
DeclRefKind::Ordinary, DeclNameLoc(SR.End));
613637

614638
LoggerRef->setImplicit(true);
615639

616-
SmallVector<Identifier, 4> ArgLabels(ArgsWithSourceRange.size(),
640+
SmallVector<Identifier, 6> ArgLabels(ArgsWithSourceRange.size(),
617641
Identifier());
618642
ApplyExpr *LoggerCall = CallExpr::createImplicit(
619643
Context, LoggerRef, ArgsWithSourceRange, ArgLabels);

lib/Sema/PlaygroundTransform.cpp

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ namespace {
3838
class Instrumenter : InstrumenterBase {
3939
private:
4040
std::mt19937_64 &RNG;
41-
ASTContext &Context;
42-
DeclContext *TypeCheckDC;
4341
unsigned &TmpNameIndex;
4442
bool HighPerformance;
4543

@@ -117,7 +115,7 @@ class Instrumenter : InstrumenterBase {
117115
public:
118116
Instrumenter(ASTContext &C, DeclContext *DC, std::mt19937_64 &RNG, bool HP,
119117
unsigned &TmpNameIndex)
120-
: RNG(RNG), Context(C), TypeCheckDC(DC), TmpNameIndex(TmpNameIndex),
118+
: InstrumenterBase(C, DC), RNG(RNG), TmpNameIndex(TmpNameIndex),
121119
HighPerformance(HP) {}
122120

123121
Stmt *transformStmt(Stmt *S) {
@@ -811,17 +809,30 @@ class Instrumenter : InstrumenterBase {
811809
Expr *StartColumn = IntegerLiteralExpr::createFromUnsigned(Context, StartLC.second);
812810
Expr *EndColumn = IntegerLiteralExpr::createFromUnsigned(Context, EndLC.second);
813811

812+
Expr *ModuleExpr =
813+
!ModuleIdentifier.empty()
814+
? (Expr *)new (Context) UnresolvedDeclRefExpr(
815+
ModuleIdentifier, DeclRefKind::Ordinary, DeclNameLoc(SR.End))
816+
: (Expr *)IntegerLiteralExpr::createFromUnsigned(Context, 0);
817+
818+
Expr *FileExpr =
819+
!FileIdentifier.empty()
820+
? (Expr *)new (Context) UnresolvedDeclRefExpr(
821+
FileIdentifier, DeclRefKind::Ordinary, DeclNameLoc(SR.End))
822+
: (Expr *)IntegerLiteralExpr::createFromUnsigned(Context, 0);
823+
814824
llvm::SmallVector<Expr *, 6> ArgsWithSourceRange(Args.begin(), Args.end());
815825

816-
ArgsWithSourceRange.append({StartLine, EndLine, StartColumn, EndColumn});
826+
ArgsWithSourceRange.append(
827+
{StartLine, EndLine, StartColumn, EndColumn, ModuleExpr, FileExpr});
817828

818829
UnresolvedDeclRefExpr *LoggerRef = new (Context)
819830
UnresolvedDeclRefExpr(Context.getIdentifier(LoggerName),
820831
DeclRefKind::Ordinary, DeclNameLoc(SR.End));
821832

822833
LoggerRef->setImplicit(true);
823834

824-
SmallVector<Identifier, 4> ArgLabels(ArgsWithSourceRange.size(),
835+
SmallVector<Identifier, 6> ArgLabels(ArgsWithSourceRange.size(),
825836
Identifier());
826837
ApplyExpr *LoggerCall = CallExpr::createImplicit(
827838
Context, LoggerRef, ArgsWithSourceRange, ArgLabels);

test/IRGen/playground.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@ import Swift
1010
@objc class C { }
1111

1212
private func __builtin_log_scope_entry(_ startLine: Int, _ startColumn: Int,
13-
_ endLine: Int, _ endColumn: Int) { }
13+
_ endLine: Int, _ endColumn: Int, _ moduleID: Int, _ fileID: Int) { }
1414
private func __builtin_log_scope_exit(_ startLine: Int, _ startColumn: Int,
15-
_ endLine: Int, _ endColumn: Int) { }
15+
_ endLine: Int, _ endColumn: Int, _ moduleID: Int, _ fileID: Int) { }
1616
private func __builtin_send_data<T>(_ object: T) { }
1717

1818
public func anchor() {}
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
// This is the minimal amount of runtime required to operate
22
// lib/Sema/PCMacro.cpp successfully.
33

4-
func __builtin_pc_before(_ sl : Int, _ el : Int, _ sc : Int, _ ec: Int) {
5-
print("[\(sl):\(sc)-\(el):\(ec)] pc before")
4+
public func __builtin_pc_before(_ sl : Int, _ el : Int, _ sc : Int, _ ec: Int, _ moduleId : Int, _ fileId : Int) {
5+
print("[\(moduleId):\(fileId)] [\(sl):\(sc)-\(el):\(ec)] pc before")
66
}
77

8-
func __builtin_pc_after(_ sl : Int, _ el : Int, _ sc : Int, _ ec: Int) {
9-
print("[\(sl):\(sc)-\(el):\(ec)] pc after")
8+
public func __builtin_pc_after(_ sl : Int, _ el : Int, _ sc : Int, _ ec: Int, _ moduleId : Int, _ fileId : Int) {
9+
print("[\(moduleId):\(fileId)] [\(sl):\(sc)-\(el):\(ec)] pc after")
1010
}
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// test (module-name) -> 1 (module-id)
2+
internal let __builtin_pg_module_test: Int = 1
3+
4+
// test (module-name) -> 1 (module-id)
5+
internal let __builtin_pg_module_test2: Int = 1
6+
7+
// test (module-name), main (file-name), main_ (file-name-punycode) -> 2 (file-id)
8+
internal let __builtin_pg_module_test_pg_file_main_: Int = 2
9+
10+
// test (module-name), main (file-name), main_ (file-name-punycode) -> 2 (file-id)
11+
internal let __builtin_pg_module_test2_pg_file_main_: Int = 2

test/PCMacro/Inputs/SilentPlaygroundsRuntime.swift

Lines changed: 32 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -12,50 +12,63 @@ struct SourceRange {
1212
}
1313
}
1414

15+
struct ModuleFileIdentifier {
16+
let moduleId : Int
17+
let fileId : Int
18+
var text : String {
19+
return "[\(moduleId):\(fileId)]"
20+
}
21+
}
22+
1523
class LogRecord {
1624
let text : String
1725

18-
init(api : String, object : Any, name : String, id : Int, range : SourceRange) {
26+
init(api : String, object : Any, name : String, id : Int, range : SourceRange, moduleFileId : ModuleFileIdentifier) {
1927
var object_description : String = ""
2028
print(object, terminator: "", to: &object_description)
21-
text = range.text + " " + api + "[" + name + "='" + object_description + "']"
29+
text = moduleFileId.text + " " + range.text + " " + api + "[" + name + "='" + object_description + "']"
2230
}
23-
init(api : String, object : Any, name : String, range : SourceRange) {
31+
init(api : String, object : Any, name : String, range : SourceRange, moduleFileId : ModuleFileIdentifier) {
2432
var object_description : String = ""
2533
print(object, terminator: "", to: &object_description)
26-
text = range.text + " " + api + "[" + name + "='" + object_description + "']"
34+
text = moduleFileId.text + " " + range.text + " " + api + "[" + name + "='" + object_description + "']"
2735
}
28-
init(api : String, object: Any, range : SourceRange) {
36+
init(api : String, object: Any, range : SourceRange, moduleFileId : ModuleFileIdentifier) {
2937
var object_description : String = ""
3038
print(object, terminator: "", to: &object_description)
31-
text = range.text + " " + api + "['" + object_description + "']"
39+
text = moduleFileId.text + " " + range.text + " " + api + "['" + object_description + "']"
3240
}
33-
init(api: String, range : SourceRange) {
34-
text = range.text + " " + api
41+
init(api: String, range : SourceRange, moduleFileId : ModuleFileIdentifier) {
42+
text = moduleFileId.text + " " + range.text + " " + api
3543
}
3644
}
3745

38-
func __builtin_log<T>(_ object : T, _ name : String, _ sl : Int, _ el : Int, _ sc : Int, _ ec: Int) -> AnyObject? {
39-
return LogRecord(api:"__builtin_log", object:object, name:name, range : SourceRange(sl:sl, el:el, sc:sc, ec:ec))
46+
public func __builtin_log<T>(_ object : T, _ name : String, _ sl : Int, _ el : Int, _ sc : Int, _ ec: Int, _ moduleId : Int, _ fileId : Int) -> AnyObject? {
47+
let moduleFileId = ModuleFileIdentifier(moduleId:moduleId, fileId:fileId)
48+
return LogRecord(api:"__builtin_log", object:object, name:name, range:SourceRange(sl:sl, el:el, sc:sc, ec:ec), moduleFileId:moduleFileId)
4049
}
4150

42-
func __builtin_log_with_id<T>(_ object : T, _ name : String, _ id : Int, _ sl : Int, _ el : Int, _ sc : Int, _ ec: Int) -> AnyObject? {
43-
return LogRecord(api:"__builtin_log", object:object, name:name, id:id, range : SourceRange(sl:sl, el:el, sc:sc, ec:ec))
51+
public func __builtin_log_with_id<T>(_ object : T, _ name : String, _ id : Int, _ sl : Int, _ el : Int, _ sc : Int, _ ec: Int, _ moduleId : Int, _ fileId : Int) -> AnyObject? {
52+
let moduleFileId = ModuleFileIdentifier(moduleId:moduleId, fileId:fileId)
53+
return LogRecord(api:"__builtin_log", object:object, name:name, id:id, range:SourceRange(sl:sl, el:el, sc:sc, ec:ec), moduleFileId:moduleFileId)
4454
}
4555

46-
func __builtin_log_scope_entry(_ sl : Int, _ el : Int, _ sc : Int, _ ec: Int) -> AnyObject? {
47-
return LogRecord(api:"__builtin_log_scope_entry", range : SourceRange(sl:sl, el:el, sc:sc, ec:ec))
56+
public func __builtin_log_scope_entry(_ sl : Int, _ el : Int, _ sc : Int, _ ec: Int, _ moduleId : Int, _ fileId : Int) -> AnyObject? {
57+
let moduleFileId = ModuleFileIdentifier(moduleId:moduleId, fileId:fileId)
58+
return LogRecord(api:"__builtin_log_scope_entry", range:SourceRange(sl:sl, el:el, sc:sc, ec:ec), moduleFileId:moduleFileId)
4859
}
4960

50-
func __builtin_log_scope_exit(_ sl : Int, _ el : Int, _ sc : Int, _ ec: Int) -> AnyObject? {
51-
return LogRecord(api:"__builtin_log_scope_exit", range : SourceRange(sl:sl, el:el, sc:sc, ec:ec))
61+
public func __builtin_log_scope_exit(_ sl : Int, _ el : Int, _ sc : Int, _ ec: Int, _ moduleId : Int, _ fileId : Int) -> AnyObject? {
62+
let moduleFileId = ModuleFileIdentifier(moduleId:moduleId, fileId:fileId)
63+
return LogRecord(api:"__builtin_log_scope_exit", range:SourceRange(sl:sl, el:el, sc:sc, ec:ec), moduleFileId:moduleFileId)
5264
}
5365

54-
func __builtin_postPrint(_ sl : Int, _ el : Int, _ sc : Int, _ ec: Int) -> AnyObject? {
55-
return LogRecord(api:"__builtin_postPrint", range : SourceRange(sl:sl, el:el, sc:sc, ec:ec))
66+
public func __builtin_postPrint(_ sl : Int, _ el : Int, _ sc : Int, _ ec: Int, _ moduleId : Int, _ fileId : Int) -> AnyObject? {
67+
let moduleFileId = ModuleFileIdentifier(moduleId:moduleId, fileId:fileId)
68+
return LogRecord(api:"__builtin_postPrint", range:SourceRange(sl:sl, el:el, sc:sc, ec:ec), moduleFileId:moduleFileId)
5669
}
5770

58-
func __builtin_send_data(_ object:AnyObject?) {
71+
public func __builtin_send_data(_ object:AnyObject?) {
5972
let would_print = ((object as! LogRecord).text)
6073
}
6174

test/PCMacro/defer.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
// RUN: %empty-directory(%t)
22
// RUN: cp %s %t/main.swift
3-
// RUN: %target-build-swift -Xfrontend -pc-macro -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift
3+
// RUN: %target-build-swift -force-single-frontend-invocation -module-name PlaygroundSupport -emit-module-path %t/PlaygroundSupport.swiftmodule -parse-as-library -c -o %t/PlaygroundSupport.o %S/Inputs/PCMacroRuntime.swift %S/Inputs/SilentPlaygroundsRuntime.swift
4+
// RUN: %target-build-swift -Xfrontend -pc-macro -o %t/main -I=%t %t/PlaygroundSupport.o %t/main.swift
45
// RUN: %target-codesign %t/main
56
// RUN: %target-run %t/main | %FileCheck %s
6-
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -Xfrontend -debugger-support -o %t/main2 %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
7+
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -Xfrontend -debugger-support -o %t/main2 -I=%t %t/PlaygroundSupport.o %t/main.swift
78
// RUN: %target-codesign %t/main2
89
// RUN: %target-run %t/main2 | %FileCheck %s
910
// REQUIRES: executable_test
1011

1112
// FIXME: rdar://problem/30234450 PCMacro tests fail on linux in optimized mode
1213
// UNSUPPORTED: OS=linux-gnu
1314

15+
import PlaygroundSupport
16+
1417
#sourceLocation(file: "main.swift", line: 8)
1518
func foo() {
1619
defer {

test/PCMacro/didset.swift

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,19 @@
11
// RUN: %empty-directory(%t)
22
// RUN: cp %s %t/main.swift
3-
// RUN: %target-build-swift -Xfrontend -pc-macro -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift
3+
// RUN: %target-build-swift -force-single-frontend-invocation -module-name PlaygroundSupport -emit-module-path %t/PlaygroundSupport.swiftmodule -parse-as-library -c -o %t/PlaygroundSupport.o %S/Inputs/PCMacroRuntime.swift %S/Inputs/SilentPlaygroundsRuntime.swift
4+
// RUN: %target-build-swift -Xfrontend -pc-macro -o %t/main -I=%t %t/PlaygroundSupport.o %t/main.swift
45
// RUN: %target-codesign %t/main
56
// RUN: %target-run %t/main | %FileCheck %s
6-
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -o %t/main2 %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
7+
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -Xfrontend -debugger-support -o %t/main2 -I=%t %t/PlaygroundSupport.o %t/main.swift
78
// RUN: %target-codesign %t/main2
89
// RUN: %target-run %t/main2 | %FileCheck %s
910
// REQUIRES: executable_test
1011

1112
// FIXME: rdar://problem/30234450 PCMacro tests fail on linux in optimized mode
1213
// UNSUPPORTED: OS=linux-gnu
1314

15+
import PlaygroundSupport
16+
1417
#sourceLocation(file: "main.swift", line: 10)
1518
struct S {
1619
var a : [Int] = [] {

0 commit comments

Comments
 (0)