Skip to content

[6.2][swift-settings] Now that we aren't using it immediately, remove it from tree. #81334

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 2 commits into from
May 7, 2025
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
1 change: 0 additions & 1 deletion Runtimes/Core/core/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,6 @@ add_library(swiftCore
StringWordBreaking.swift
Substring.swift
SwiftNativeNSArray.swift
SwiftSettings.swift
TemporaryAllocation.swift
ThreadLocalStorage.swift
UIntBuffer.swift
Expand Down
2 changes: 0 additions & 2 deletions include/swift/AST/ASTBridging.h
Original file line number Diff line number Diff line change
Expand Up @@ -3049,8 +3049,6 @@ enum ENUM_EXTENSIBILITY_ATTR(open) BridgedMacroDefinitionKind : size_t {
BridgedBuiltinExternalMacro,
/// The builtin definition for the "isolation" macro.
BridgedBuiltinIsolationMacro,
/// The builtin definition for the "SwiftSetting" macro.
BridgedBuiltinSwiftSettingsMacro,
};

struct BridgedASTType {
Expand Down
15 changes: 0 additions & 15 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -8650,20 +8650,5 @@ GROUPED_WARNING(
"behavior",
(StringRef, DeclAttribute))

//===----------------------------------------------------------------------===//
// MARK: SwiftSettings
//===----------------------------------------------------------------------===//

ERROR(swift_settings_invalid_setting, none,
"Unrecognized setting passed to #SwiftSettings", ())

ERROR(swift_settings_must_be_top_level, none,
"#SwiftSettings can only be invoked as a top level declaration", ())

ERROR(swift_settings_duplicate_setting, none,
"duplicate setting passed to #SwiftSettings", ())
NOTE(swift_settings_duplicate_setting_original_loc, none,
"setting originally passed here", ())

#define UNDEFINE_DIAGNOSTIC_MACROS
#include "DefineDiagnosticMacros.h"
2 changes: 0 additions & 2 deletions include/swift/AST/KnownStdlibTypes.def
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,6 @@ KNOWN_STDLIB_TYPE_DECL(Result, NominalTypeDecl, 2)

KNOWN_STDLIB_TYPE_DECL(InlineArray, NominalTypeDecl, 2)

KNOWN_STDLIB_TYPE_DECL(SwiftSetting, NominalTypeDecl, 0)

KNOWN_STDLIB_TYPE_DECL(MutableSpan, NominalTypeDecl, 1)

#undef KNOWN_STDLIB_TYPE_DECL
3 changes: 0 additions & 3 deletions include/swift/AST/MacroDefinition.h
Original file line number Diff line number Diff line change
Expand Up @@ -77,9 +77,6 @@ enum class BuiltinMacroKind : uint8_t {
ExternalMacro,
/// #isolation, which produces the isolation of the current context
IsolationMacro,
/// #SwiftSettings, which allows for the user to set a compiler setting at
/// the file level
SwiftSettingsMacro,
};

/// A single replacement
Expand Down
12 changes: 0 additions & 12 deletions include/swift/AST/SourceFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,6 @@ enum class RestrictedImportKind {
/// Import that limits the access level of imported entities.
using ImportAccessLevel = std::optional<AttributedImport<ImportedModule>>;

/// Language options only for use with a specific SourceFile.
///
/// Vended by SourceFile::getLanguageOptions().
struct SourceFileLangOptions {
/// If unset, no value was provided. If a Type, that type is the type of the
/// isolation. If set to an empty type, nil was specified explicitly.
std::optional<Type> defaultIsolation;
};

/// A file containing Swift source code.
///
/// This is a .swift or .sil file (or a virtual file, such as the contents of
Expand Down Expand Up @@ -571,9 +562,6 @@ class SourceFile final : public FileUnit {
ObjCSelector selector,
SmallVectorImpl<AbstractFunctionDecl *> &results) const override;

/// File level language options.
SourceFileLangOptions getLanguageOptions() const;

protected:
virtual void
lookupOperatorDirect(Identifier name, OperatorFixity fixity,
Expand Down
20 changes: 0 additions & 20 deletions include/swift/AST/TypeCheckRequests.h
Original file line number Diff line number Diff line change
Expand Up @@ -5313,26 +5313,6 @@ class SemanticAvailabilitySpecRequest
void cacheResult(std::optional<SemanticAvailabilitySpec> value) const;
};

class SourceFileLangOptionsRequest
: public SimpleRequest<SourceFileLangOptionsRequest,
SourceFileLangOptions(SourceFile *),
RequestFlags::Cached> {

public:
using SimpleRequest::SimpleRequest;

private:
friend SimpleRequest;

SourceFileLangOptions evaluate(Evaluator &evaluator,
SourceFile *sourceFile) const;

public:
bool isCached() const { return true; }
std::optional<SourceFileLangOptions> getCachedResult() const;
void cacheResult(SourceFileLangOptions value) const;
};

#define SWIFT_TYPEID_ZONE TypeChecker
#define SWIFT_TYPEID_HEADER "swift/AST/TypeCheckerTypeIDZone.def"
#include "swift/Basic/DefineTypeIDZone.h"
Expand Down
3 changes: 0 additions & 3 deletions include/swift/AST/TypeCheckerTypeIDZone.def
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,3 @@ SWIFT_REQUEST(TypeChecker, SemanticAvailabilitySpecRequest,
std::optional<SemanticAvailabilitySpec>
(const AvailabilitySpec *, const DeclContext *),
SeparatelyCached, NoLocationInfo)

SWIFT_REQUEST(TypeChecker, SourceFileLangOptionsRequest,
SourceFileLangOptions (SourceFile *), Cached, NoLocationInfo)
3 changes: 0 additions & 3 deletions include/swift/Basic/Features.def
Original file line number Diff line number Diff line change
Expand Up @@ -498,9 +498,6 @@ EXPERIMENTAL_FEATURE(CustomAvailability, true)
/// is resilient or not.
EXPERIMENTAL_FEATURE(ExtensibleEnums, true)

/// Allow SwiftSettings
EXPERIMENTAL_FEATURE(SwiftSettings, false)

/// Syntax sugar features for concurrency.
EXPERIMENTAL_FEATURE(ConcurrencySyntaxSugar, true)

Expand Down
3 changes: 0 additions & 3 deletions lib/AST/ASTPrinter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4797,9 +4797,6 @@ void PrintAST::visitMacroDecl(MacroDecl *decl) {
case BuiltinMacroKind::IsolationMacro:
Printer << "IsolationMacro";
break;
case BuiltinMacroKind::SwiftSettingsMacro:
Printer << "SwiftSettingsMacro";
break;
}
break;

Expand Down
8 changes: 0 additions & 8 deletions lib/AST/FeatureSet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -448,14 +448,6 @@ UNINTERESTING_FEATURE(CoroutineAccessorsUnwindOnCallerError)
UNINTERESTING_FEATURE(AllowRuntimeSymbolDeclarations)
UNINTERESTING_FEATURE(CopyBlockOptimization)

static bool usesFeatureSwiftSettings(const Decl *decl) {
// We just need to guard `#SwiftSettings`.
auto *macro = dyn_cast<MacroDecl>(decl);
return macro && macro->isStdlibDecl() &&
macro->getMacroRoles().contains(MacroRole::Declaration) &&
macro->getBaseIdentifier().is("SwiftSettings");
}

bool swift::usesFeatureIsolatedDeinit(const Decl *decl) {
if (auto cd = dyn_cast<ClassDecl>(decl)) {
return cd->getFormalAccess() == AccessLevel::Open &&
Expand Down
Loading