File tree Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Expand file tree Collapse file tree 2 files changed +18
-1
lines changed Original file line number Diff line number Diff line change @@ -461,7 +461,14 @@ class Instrumenter : InstrumenterBase {
461461 }
462462 } else if (auto *AE = dyn_cast<ApplyExpr>(E)) {
463463 bool Handled = false ;
464- if (auto *DRE = dyn_cast<DeclRefExpr>(AE->getFn ())) {
464+ DeclRefExpr *DRE = nullptr ;
465+ // With Swift 6 the print() function decl is a sub expression
466+ // of a function conversion expression.
467+ if (auto *FCE = dyn_cast<FunctionConversionExpr>(AE->getFn ()))
468+ DRE = dyn_cast<DeclRefExpr>(FCE->getSubExpr ());
469+ else
470+ DRE = dyn_cast<DeclRefExpr>(AE->getFn ());
471+ if (DRE) {
465472 auto *FnD = dyn_cast<AbstractFunctionDecl>(DRE->getDecl ());
466473 if (FnD && FnD->getModuleContext () == Context.TheStdlibModule ) {
467474 DeclBaseName FnName = FnD->getBaseName ();
Original file line number Diff line number Diff line change 11// RUN: %empty-directory(%t)
22// RUN: cp %s %t/main.swift
33// RUN: %target-build-swift -whole-module-optimization -module-name PlaygroundSupport -emit-module-path %t/PlaygroundSupport.swiftmodule -parse-as-library -c -o %t/PlaygroundSupport.o %S/Inputs/SilentPCMacroRuntime.swift %S/Inputs/PlaygroundsRuntime.swift
4+ //
5+ // Default Swift version
46// RUN: %target-build-swift -Xfrontend -playground -o %t/main -I=%t %t/PlaygroundSupport.o %t/main.swift
57// RUN: %target-codesign %t/main
68// RUN: %target-run %t/main | %FileCheck %s
79// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -o %t/main2 -I=%t %t/PlaygroundSupport.o %t/main.swift
810// RUN: %target-codesign %t/main2
911// RUN: %target-run %t/main2 | %FileCheck %s
12+ //
13+ // Swift version 6
14+ // RUN: %target-build-swift -swift-version 6 -Xfrontend -playground -o %t/main3 -I=%t %t/PlaygroundSupport.o %t/main.swift
15+ // RUN: %target-codesign %t/main3
16+ // RUN: %target-run %t/main3 | %FileCheck %s
17+ // RUN: %target-build-swift -swift-version 6 -Xfrontend -pc-macro -Xfrontend -playground -o %t/main4 -I=%t %t/PlaygroundSupport.o %t/main.swift
18+ // RUN: %target-codesign %t/main4
19+ // RUN: %target-run %t/main4 | %FileCheck %s
1020// REQUIRES: executable_test
1121
1222import PlaygroundSupport
You can’t perform that action at this time.
0 commit comments