From 98550b04062a55674e8030035db0cf079a9a984b Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Tue, 27 Feb 2024 09:38:34 -0800 Subject: [PATCH 1/2] =?UTF-8?q?Revert=20"[PlaygroundTransform]=20Disable?= =?UTF-8?q?=20logging=20`~Copyable`=20types=20as=20they=20can=E2=80=99t=20?= =?UTF-8?q?be=20passed=20to=20the=20generic=20logging=20function"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/Sema/PlaygroundTransform.cpp | 31 +++---------------- .../noncopyable_assignment.swift | 24 -------------- .../noncopyable_declaration.swift | 22 ------------- .../noncopyable_functions.swift | 24 -------------- 4 files changed, 5 insertions(+), 96 deletions(-) delete mode 100644 test/PlaygroundTransform/noncopyable_assignment.swift delete mode 100644 test/PlaygroundTransform/noncopyable_declaration.swift delete mode 100644 test/PlaygroundTransform/noncopyable_functions.swift diff --git a/lib/Sema/PlaygroundTransform.cpp b/lib/Sema/PlaygroundTransform.cpp index 35a6fbf46bb60..1162f5a6b438d 100644 --- a/lib/Sema/PlaygroundTransform.cpp +++ b/lib/Sema/PlaygroundTransform.cpp @@ -429,7 +429,7 @@ class Instrumenter : InstrumenterBase { ++EI; } } - } else if (shouldLog(AE->getSrc())) { + } else { std::pair PV = buildPatternAndVariable(AE->getSrc()); DeclRefExpr *DRE = new (Context) @@ -521,7 +521,7 @@ class Instrumenter : InstrumenterBase { } Handled = true; // Never log () } - if (!Handled && shouldLog(E)) { + if (!Handled) { // do the same as for all other expressions std::pair PV = buildPatternAndVariable(E); @@ -539,7 +539,7 @@ class Instrumenter : InstrumenterBase { } } } else { - if (E->getType()->getCanonicalType() != Context.TheEmptyTupleType && shouldLog(E)) { + if (E->getType()->getCanonicalType() != Context.TheEmptyTupleType) { std::pair PV = buildPatternAndVariable(E); Added Log = buildLoggerCall( @@ -559,7 +559,7 @@ class Instrumenter : InstrumenterBase { } else if (auto *S = Element.dyn_cast()) { S->walk(CF); if (auto *RS = dyn_cast(S)) { - if (RS->hasResult() && shouldLog(RS->getResult())) { + if (RS->hasResult()) { std::pair PV = buildPatternAndVariable(RS->getResult()); DeclRefExpr *DRE = new (Context) DeclRefExpr( @@ -620,7 +620,7 @@ class Instrumenter : InstrumenterBase { if (PL && Options.LogFunctionParameters) { size_t EI = 0; for (const auto &PD : *PL) { - if (PD->hasName() && shouldLog(PD)) { + if (PD->hasName()) { DeclBaseName Name = PD->getName(); Expr *PVVarRef = new (Context) DeclRefExpr(PD, DeclNameLoc(), /*implicit=*/true, @@ -657,10 +657,6 @@ class Instrumenter : InstrumenterBase { // after or instead of the expression they're looking at. Only call this // if the variable has an initializer. Added logVarDecl(VarDecl *VD) { - if (!shouldLog(VD)) { - return nullptr; - } - if (isa(TypeCheckDC) && VD->getNameStr().equals("self")) { // Don't log "self" in a constructor return nullptr; @@ -677,10 +673,6 @@ class Instrumenter : InstrumenterBase { if (auto *DRE = dyn_cast(*RE)) { VarDecl *VD = cast(DRE->getDecl()); - if (!shouldLog(VD)) { - return nullptr; - } - if (isa(TypeCheckDC) && VD->getBaseName() == "self") { // Don't log "self" in a constructor return nullptr; @@ -694,10 +686,6 @@ class Instrumenter : InstrumenterBase { Expr *B = MRE->getBase(); ConcreteDeclRef M = MRE->getMember(); - if (!shouldLog(M.getDecl())) { - return nullptr; - } - if (isa(TypeCheckDC) && digForName(B) == "self") { // Don't log attributes of "self" in a constructor return nullptr; @@ -797,15 +785,6 @@ class Instrumenter : InstrumenterBase { return std::make_pair(PBD, VD); } - bool shouldLog(ASTNode node) { - // Don't try to log ~Copyable types, as we can't pass them to the generic logging functions yet. - if (auto *VD = dyn_cast_or_null(node.dyn_cast())) - return VD->hasInterfaceType() ? !VD->getInterfaceType()->isNoncopyable() : true; - if (auto *E = node.dyn_cast()) - return !E->getType()->isNoncopyable(); - return true; - } - Added buildLoggerCall(Added E, SourceRange SR, StringRef Name) { Expr *NameExpr = new (Context) StringLiteralExpr( diff --git a/test/PlaygroundTransform/noncopyable_assignment.swift b/test/PlaygroundTransform/noncopyable_assignment.swift deleted file mode 100644 index 7c7c98098837a..0000000000000 --- a/test/PlaygroundTransform/noncopyable_assignment.swift +++ /dev/null @@ -1,24 +0,0 @@ -// RUN: %empty-directory(%t) -// RUN: cp %s %t/main.swift -// 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 -// RUN: %target-build-swift -Xfrontend -playground -o %t/main -I=%t %t/PlaygroundSupport.o %t/main.swift -// RUN: %target-codesign %t/main -// RUN: %target-run %t/main | %FileCheck %s -// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -o %t/main2 -I=%t %t/PlaygroundSupport.o %t/main.swift -module-name main -// RUN: %target-codesign %t/main2 -// RUN: %target-run %t/main2 | %FileCheck %s -// REQUIRES: executable_test - -import PlaygroundSupport - -struct A: ~Copyable {} - -var a: A -a = A() - -struct B {} - -var b: B -b = B() -// note: a should not be logged (at least until move-only types can be passed to the generic logging functions) -// CHECK: [{{.*}}] __builtin_log[b='B()'] diff --git a/test/PlaygroundTransform/noncopyable_declaration.swift b/test/PlaygroundTransform/noncopyable_declaration.swift deleted file mode 100644 index ca675228adc8b..0000000000000 --- a/test/PlaygroundTransform/noncopyable_declaration.swift +++ /dev/null @@ -1,22 +0,0 @@ -// RUN: %empty-directory(%t) -// RUN: cp %s %t/main.swift -// 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 -// RUN: %target-build-swift -Xfrontend -playground -o %t/main -I=%t %t/PlaygroundSupport.o %t/main.swift -// RUN: %target-codesign %t/main -// RUN: %target-run %t/main | %FileCheck %s -// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -o %t/main2 -I=%t %t/PlaygroundSupport.o %t/main.swift -module-name main -// RUN: %target-codesign %t/main2 -// RUN: %target-run %t/main2 | %FileCheck %s -// REQUIRES: executable_test - -import PlaygroundSupport - -struct A: ~Copyable {} - -let a = A() - -struct B {} - -let b = B() -// note: a should not be logged (at least until move-only types can be passed to the generic logging functions) -// CHECK: [{{.*}}] __builtin_log[b='B()'] diff --git a/test/PlaygroundTransform/noncopyable_functions.swift b/test/PlaygroundTransform/noncopyable_functions.swift deleted file mode 100644 index 51bff4209c3a7..0000000000000 --- a/test/PlaygroundTransform/noncopyable_functions.swift +++ /dev/null @@ -1,24 +0,0 @@ -// RUN: %empty-directory(%t) -// RUN: cp %s %t/main.swift -// 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 -// RUN: %target-build-swift -Xfrontend -playground -o %t/main -I=%t %t/PlaygroundSupport.o %t/main.swift -// RUN: %target-codesign %t/main -// RUN: %target-run %t/main | %FileCheck %s -// RUN: %target-build-swift -Xfrontend -pc-macro -Xfrontend -playground -o %t/main2 -I=%t %t/PlaygroundSupport.o %t/main.swift -module-name main -// RUN: %target-codesign %t/main2 -// RUN: %target-run %t/main2 | %FileCheck %s -// REQUIRES: executable_test - -import PlaygroundSupport - -struct A: ~Copyable {} - -func f(_ a: consuming A) -> A { - return a -} - -f(A()) -// note: a should not be logged (at least until move-only types can be passed to the generic logging functions) -// CHECK: [{{.*}}] __builtin_log_scope_entry -// CHECK-NEXT: [{{.*}}] __builtin_log_scope_exit -// CHECK-NOT: __builtin_log From 79b830fb57dd0613849c7514a4976c0f0ad2bddd Mon Sep 17 00:00:00 2001 From: Alex Hoppen Date: Wed, 28 Feb 2024 08:40:58 -0800 Subject: [PATCH 2/2] DNM Just checking --- utils/build-presets.ini | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-) diff --git a/utils/build-presets.ini b/utils/build-presets.ini index 666321ea0565d..74bd156b103dc 100644 --- a/utils/build-presets.ini +++ b/utils/build-presets.ini @@ -845,10 +845,10 @@ test-installable-package toolchain-benchmarks # Path to the root of the installation filesystem. -install-destdir=%(install_destdir)s +install-destdir=/home/build-user/swift-nightly-install # Path to the .tar.gz package we would create. -installable-package=%(installable_package)s +installable-package=/home/build-user/swift-DEVELOPMENT-SNAPSHOT-2024-02-27-a-amazonlinux2.tar.gz # This ensures the default module cache # location is local to this run, allowing @@ -911,21 +911,21 @@ no-assertions [preset: mixin_buildbot_linux,no_test] -skip-test-cmark -skip-test-lldb -skip-test-swift -skip-test-llbuild -skip-test-swiftpm -skip-test-swift-driver -skip-test-xctest -skip-test-foundation -skip-test-libdispatch -skip-test-playgroundsupport -skip-test-libicu -skip-test-indexstore-db -skip-test-sourcekit-lsp -skip-test-swiftdocc -skip-test-wasm-stdlib +; skip-test-cmark +; skip-test-lldb +; skip-test-swift +; skip-test-llbuild +; skip-test-swiftpm +; skip-test-swift-driver +; skip-test-xctest +; skip-test-foundation +; skip-test-libdispatch +; skip-test-playgroundsupport +; skip-test-libicu +; skip-test-indexstore-db +; skip-test-sourcekit-lsp +; skip-test-swiftdocc +; skip-test-wasm-stdlib # Linux package with out test [preset: buildbot_linux,no_test]