Skip to content

Sema: Lift restriction preventing use of #_hasSymbol on non-Darwin-platforms #62329

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Dec 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -6716,8 +6716,6 @@ WARNING(has_symbol_decl_must_be_weak,none,
(DescriptiveDeclKind, DeclName))
ERROR(has_symbol_invalid_expr,none,
"'#_hasSymbol' condition must refer to a declaration", ())
ERROR(has_symbol_unsupported_on_target,none,
"'#_hasSymbol' is unsupported on target '%0'", (StringRef))

//------------------------------------------------------------------------------
// MARK: Type erasure
Expand Down
9 changes: 0 additions & 9 deletions lib/Sema/MiscDiagnostics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4506,15 +4506,6 @@ static bool diagnoseHasSymbolCondition(PoundHasSymbolInfo *info,
return false;

auto &ctx = DC->getASTContext();
if (!ctx.LangOpts.Target.isOSDarwin()) {
// SILGen for #_hasSymbol is currently implemented assuming the target OS
// is a Darwin platform.
ctx.Diags.diagnose(info->getStartLoc(),
diag::has_symbol_unsupported_on_target,
ctx.LangOpts.Target.str());
return true;
}

auto decl = info->getReferencedDecl().getDecl();
if (!decl) {
// Diagnose because we weren't able to interpret the expression as one
Expand Down
2 changes: 1 addition & 1 deletion test/AutoDiff/SILGen/has_symbol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/Library.swiftmodule -parse-as-library %t/Library.swift -enable-library-evolution
// RUN: %target-swift-frontend -emit-silgen %t/Client.swift -I %t -module-name test | %FileCheck %t/Client.swift

// REQUIRES: VENDOR=apple
// UNSUPPORTED: OS=windows-msvc

//--- Library.swift

Expand Down
2 changes: 1 addition & 1 deletion test/IRGen/has_symbol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/has_symbol_helper.swiftmodule -parse-as-library %S/Inputs/has_symbol_helper.swift -enable-library-evolution -disable-availability-checking
// RUN: %target-swift-frontend -emit-irgen %s -I %t -module-name test | %FileCheck %s

// REQUIRES: VENDOR=apple
// UNSUPPORTED: OS=windows-msvc

// rdar://102246128
// REQUIRES: PTRSIZE=64
Expand Down
2 changes: 1 addition & 1 deletion test/IRGen/has_symbol_async.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// RUN: %target-swift-frontend -emit-irgen %s -I %t -module-name test | %FileCheck %s

// REQUIRES: concurrency
// REQUIRES: VENDOR=apple
// UNSUPPORTED: OS=windows-msvc

@_weakLinked import has_symbol_helper

Expand Down
2 changes: 1 addition & 1 deletion test/Interpreter/has_symbol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
// RUN: %target-run %t/test %t/%target-library-name(helper) | %FileCheck %s --check-prefix=NO-ANSWER

// REQUIRES: executable_test
// REQUIRES: VENDOR=apple
// UNSUPPORTED: OS=windows-msvc

// This test requires executable tests to be run on the same machine as the
// compiler, as it links with a dylib that it doesn't arrange to get uploaded
Expand Down
2 changes: 1 addition & 1 deletion test/Parse/has_symbol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/Library.swiftmodule -parse-as-library %t/Library.swift -enable-library-evolution
// RUN: %target-swift-frontend -typecheck -verify %t/Client.swift -I %t

// REQUIRES: VENDOR=apple
// UNSUPPORTED: OS=windows-msvc

//--- Library.swift

Expand Down
2 changes: 1 addition & 1 deletion test/SIL/Parser/has_symbol.sil
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/has_symbol_helper.swiftmodule -parse-as-library -enable-library-evolution %t/has_symbol_helper.swift
// RUN: %target-swift-frontend -emit-sil -verify %s -I %t/

// REQUIRES: vendor=apple
// UNSUPPORTED: OS=windows-msvc

sil_stage raw

Expand Down
2 changes: 1 addition & 1 deletion test/SILGen/has_symbol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// RUN: %target-swift-frontend -emit-module -emit-module-path %t/has_symbol_helper.swiftmodule -parse-as-library %S/Inputs/has_symbol_helper.swift -enable-library-evolution
// RUN: %target-swift-frontend -emit-silgen %s -I %t -module-name test | %FileCheck %s

// REQUIRES: VENDOR=apple
// UNSUPPORTED: OS=windows-msvc

@_weakLinked import has_symbol_helper

Expand Down
2 changes: 1 addition & 1 deletion test/SILOptimizer/has_symbol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// RUN: %target-swift-frontend -O -emit-module -emit-module-path %t/Library.swiftmodule -parse-as-library %t/Library.swift -enable-library-evolution
// RUN: %target-swift-frontend -O -emit-sil %t/Client.swift -I %t -module-name test | %FileCheck %s

// REQUIRES: VENDOR=apple
// UNSUPPORTED: OS=windows-msvc

//--- Library.swift

Expand Down
2 changes: 1 addition & 1 deletion test/Sema/has_symbol.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// RUN: %target-typecheck-verify-swift -disable-availability-checking -I %t
// RUN: %target-typecheck-verify-swift -disable-availability-checking -I %t -enable-experimental-feature ResultBuilderASTTransform

// REQUIRES: VENDOR=apple
// UNSUPPORTED: OS=windows-msvc

@_weakLinked import has_symbol_helper

Expand Down
8 changes: 0 additions & 8 deletions test/Sema/has_symbol_unsupported.swift

This file was deleted.