Skip to content

Commit 63d5d3d

Browse files
committed
[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>.
1 parent 4652e6a commit 63d5d3d

35 files changed

+223
-223
lines changed

lib/Sema/PlaygroundTransform.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -705,7 +705,7 @@ class Instrumenter : InstrumenterBase {
705705
PatternBindingDecl *&ArgPattern,
706706
VarDecl *&ArgVariable) {
707707
const char *LoggerName =
708-
isDebugPrint ? "$builtin_debugPrint" : "$builtin_print";
708+
isDebugPrint ? "__builtin_debugPrint" : "__builtin_print";
709709

710710
UnresolvedDeclRefExpr *LoggerRef = new (Context) UnresolvedDeclRefExpr(
711711
Context.getIdentifier(LoggerName), DeclRefKind::Ordinary,
@@ -724,7 +724,7 @@ class Instrumenter : InstrumenterBase {
724724
}
725725

726726
Added<Stmt *> logPostPrint(SourceRange SR) {
727-
return buildLoggerCallWithArgs("$builtin_postPrint",
727+
return buildLoggerCallWithArgs("__builtin_postPrint",
728728
MutableArrayRef<Expr *>(), SR);
729729
}
730730

@@ -780,7 +780,7 @@ class Instrumenter : InstrumenterBase {
780780

781781
Expr *LoggerArgExprs[] = {*E, NameExpr, IDExpr};
782782

783-
return buildLoggerCallWithArgs("$builtin_log_with_id",
783+
return buildLoggerCallWithArgs("__builtin_log_with_id",
784784
MutableArrayRef<Expr *>(LoggerArgExprs), SR);
785785
}
786786

@@ -794,7 +794,7 @@ class Instrumenter : InstrumenterBase {
794794

795795
Added<Stmt *> buildScopeCall(SourceRange SR, bool IsExit) {
796796
const char *LoggerName =
797-
IsExit ? "$builtin_log_scope_exit" : "$builtin_log_scope_entry";
797+
IsExit ? "__builtin_log_scope_exit" : "__builtin_log_scope_entry";
798798

799799
return buildLoggerCallWithArgs(LoggerName, MutableArrayRef<Expr *>(), SR);
800800
}
@@ -870,7 +870,7 @@ class Instrumenter : InstrumenterBase {
870870
AccessSemantics::Ordinary, Apply->getType());
871871

872872
UnresolvedDeclRefExpr *SendDataRef = new (Context)
873-
UnresolvedDeclRefExpr(Context.getIdentifier("$builtin_send_data"),
873+
UnresolvedDeclRefExpr(Context.getIdentifier("__builtin_send_data"),
874874
DeclRefKind::Ordinary, DeclNameLoc());
875875

876876
SendDataRef->setImplicit(true);

test/PCMacro/Inputs/SilentPlaygroundsRuntime.swift

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,27 +35,27 @@ class LogRecord {
3535
}
3636
}
3737

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))
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))
4040
}
4141

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))
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))
4444
}
4545

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))
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))
4848
}
4949

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))
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))
5252
}
5353

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))
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))
5656
}
5757

58-
func $builtin_send_data(_ object:AnyObject?) {
58+
func __builtin_send_data(_ object:AnyObject?) {
5959
let would_print = ((object as! LogRecord).text)
6060
}
6161

test/PCMacro/didset.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: cp %s %t/main.swift
33
// RUN: %target-build-swift -Xfrontend -pc-macro -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift
44
// RUN: %target-run %t/main | %FileCheck %s
5-
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
5+
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
66
// RUN: %target-run %t/main | %FileCheck %s
77
// REQUIRES: executable_test
88

test/PCMacro/else.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: cp %s %t/main.swift
33
// RUN: %target-build-swift -Xfrontend -pc-macro -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift
44
// RUN: %target-run %t/main | %FileCheck %s
5-
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
5+
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
66
// RUN: %target-run %t/main | %FileCheck %s
77
// REQUIRES: executable_test
88

test/PCMacro/elseif.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: cp %s %t/main.swift
33
// RUN: %target-build-swift -Xfrontend -pc-macro -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift
44
// RUN: %target-run %t/main | %FileCheck %s
5-
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
5+
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
66
// RUN: %target-run %t/main | %FileCheck %s
77
// REQUIRES: executable_test
88
// XFAIL: *

test/PCMacro/for.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: cp %s %t/main.swift
33
// RUN: %target-build-swift -Xfrontend -pc-macro -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift
44
// RUN: %target-run %t/main | %FileCheck %s
5-
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
5+
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
66
// RUN: %target-run %t/main | %FileCheck %s
77
// REQUIRES: executable_test
88

test/PCMacro/func_decls.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: cp %s %t/main.swift
33
// RUN: %target-build-swift -Xfrontend -pc-macro -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift
44
// RUN: %target-run %t/main | %FileCheck %s
5-
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
5+
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
66
// RUN: %target-run %t/main | %FileCheck %s
77
// REQUIRES: executable_test
88

test/PCMacro/func_throw_notype.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: cp %s %t/main.swift
33
// RUN: %target-build-swift -Xfrontend -pc-macro -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift
44
// RUN: %target-run %t/main | %FileCheck %s
5-
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
5+
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
66
// RUN: %target-run %t/main | %FileCheck %s
77
// REQUIRES: executable_test
88
// XFAIL: *

test/PCMacro/getset.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: cp %s %t/main.swift
33
// RUN: %target-build-swift -Xfrontend -pc-macro -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift
44
// RUN: %target-run %t/main | %FileCheck %s
5-
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
5+
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
66
// RUN: %target-run %t/main | %FileCheck %s
77
// REQUIRES: executable_test
88
// XFAIL: *

test/PCMacro/if.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// RUN: cp %s %t/main.swift
33
// RUN: %target-build-swift -Xfrontend -pc-macro -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift
44
// RUN: %target-run %t/main | %FileCheck %s
5-
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -Xfrontend -debugger-support -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
5+
// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -o %t/main %S/Inputs/PCMacroRuntime.swift %t/main.swift %S/Inputs/SilentPlaygroundsRuntime.swift
66
// RUN: %target-run %t/main | %FileCheck %s
77
// REQUIRES: executable_test
88

0 commit comments

Comments
 (0)