Skip to content

Commit 8093783

Browse files
committed
AST: Promote ExtensionMacroAttr feature to baseline.
1 parent 99dbbe4 commit 8093783

File tree

5 files changed

+1
-24
lines changed

5 files changed

+1
-24
lines changed

include/swift/AST/PrintOptions.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -608,11 +608,6 @@ struct PrintOptions {
608608
QualifyNestedDeclarations ShouldQualifyNestedDeclarations =
609609
QualifyNestedDeclarations::Never;
610610

611-
/// Whether or not to print `@attached(extension)` attributes on
612-
/// macro declarations. This is used for feature suppression in
613-
/// Swift interface printing.
614-
bool PrintExtensionMacroAttributes = true;
615-
616611
/// If this is not \c nullptr then function bodies (including accessors
617612
/// and constructors) will be printed by this function.
618613
std::function<void(const ValueDecl *, ASTPrinter &)> FunctionBody;

include/swift/Basic/Features.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ BASELINE_LANGUAGE_FEATURE(ParameterPacks, 393, "Value and type parameter packs")
182182
BASELINE_LANGUAGE_FEATURE(LexicalLifetimes, 0, "@_eagerMove/@_noEagerMove/@_lexicalLifetimes annotations")
183183
BASELINE_LANGUAGE_FEATURE(FreestandingMacros, 397, "freestanding declaration macros")
184184
SUPPRESSIBLE_LANGUAGE_FEATURE(RetroactiveAttribute, 364, "@retroactive")
185-
SUPPRESSIBLE_LANGUAGE_FEATURE(ExtensionMacroAttr, 0, "@attached(extension)")
185+
BASELINE_LANGUAGE_FEATURE(ExtensionMacroAttr, 0, "@attached(extension)")
186186
BASELINE_LANGUAGE_FEATURE(TypedThrows, 413, "Typed throws")
187187
CONDITIONALLY_SUPPRESSIBLE_LANGUAGE_FEATURE(OptionalIsolatedParameters, 420, "Optional isolated parameters")
188188
BASELINE_LANGUAGE_FEATURE(Extern, 0, "@_extern")

lib/AST/ASTPrinter.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3027,14 +3027,6 @@ void PrintAST::printExtension(ExtensionDecl *decl) {
30273027
}
30283028
}
30293029

3030-
static void suppressingFeatureExtensionMacroAttr(PrintOptions &options,
3031-
llvm::function_ref<void()> action) {
3032-
bool originalPrintExtensionMacroAttrs = options.PrintExtensionMacroAttributes;
3033-
options.PrintExtensionMacroAttributes = false;
3034-
action();
3035-
options.PrintExtensionMacroAttributes = originalPrintExtensionMacroAttrs;
3036-
}
3037-
30383030
static void suppressingFeatureSpecializeAttributeWithAvailability(
30393031
PrintOptions &options,
30403032
llvm::function_ref<void()> action) {

lib/AST/Attr.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1646,12 +1646,6 @@ bool DeclAttribute::printImpl(ASTPrinter &Printer, const PrintOptions &Options,
16461646
case DeclAttrKind::MacroRole: {
16471647
auto Attr = cast<MacroRoleAttr>(this);
16481648

1649-
// Suppress @attached(extension) if needed.
1650-
if (!Options.PrintExtensionMacroAttributes &&
1651-
Attr->getMacroRole() == MacroRole::Extension) {
1652-
break;
1653-
}
1654-
16551649
switch (Attr->getMacroSyntax()) {
16561650
case MacroSyntax::Freestanding:
16571651
Printer.printAttrName("@freestanding");

lib/AST/FeatureSet.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -148,10 +148,6 @@ static bool usesFeatureRetroactiveAttribute(Decl *decl) {
148148
[](const InheritedEntry &entry) { return entry.isRetroactive(); });
149149
}
150150

151-
static bool usesFeatureExtensionMacroAttr(Decl *decl) {
152-
return usesFeatureExtensionMacros(decl);
153-
}
154-
155151
static bool usesFeatureOptionalIsolatedParameters(Decl *decl) {
156152
auto *value = dyn_cast<ValueDecl>(decl);
157153
if (!value)

0 commit comments

Comments
 (0)