mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[ModuleInterface] Print normally unprinted attributes
We need @_transparent to control mandatory inlining; @_fixed_layout to control, well, layout; and @_effects to help optimization. We still don't need the ImplicitlyUnwrappedOptional attribute, and we don't need access control attributes (because we handle that uniformly). This also fixes up the printing of the '_effects' attribute to include its underscore, so that it matches the source spelling.
This commit is contained in:
@@ -110,9 +110,7 @@ PrintOptions PrintOptions::printTextualInterfaceFile() {
|
||||
// the default to 'public' and mark the 'internal' things.
|
||||
result.PrintAccess = true;
|
||||
|
||||
result.ExcludeAttrList.push_back(DAK_AccessControl);
|
||||
|
||||
// FIXME: We'll need the actual default parameter expression.
|
||||
result.ExcludeAttrList = {DAK_ImplicitlyUnwrappedOptional, DAK_AccessControl};
|
||||
result.PrintDefaultParameterPlaceholder = false;
|
||||
|
||||
return result;
|
||||
|
||||
@@ -610,15 +610,15 @@ StringRef DeclAttribute::getAttrName() const {
|
||||
case DAK_Effects:
|
||||
switch (cast<EffectsAttr>(this)->getKind()) {
|
||||
case EffectsKind::ReadNone:
|
||||
return "effects(readnone)";
|
||||
return "_effects(readnone)";
|
||||
case EffectsKind::ReadOnly:
|
||||
return "effects(readonly)";
|
||||
return "_effects(readonly)";
|
||||
case EffectsKind::ReleaseNone:
|
||||
return "effects(releasenone)";
|
||||
return "_effects(releasenone)";
|
||||
case EffectsKind::ReadWrite:
|
||||
return "effects(readwrite)";
|
||||
return "_effects(readwrite)";
|
||||
case EffectsKind::Unspecified:
|
||||
return "effects(unspecified)";
|
||||
return "_effects(unspecified)";
|
||||
}
|
||||
case DAK_AccessControl:
|
||||
case DAK_SetterAccess: {
|
||||
|
||||
16
test/ModuleInterface/attrs.swift
Normal file
16
test/ModuleInterface/attrs.swift
Normal file
@@ -0,0 +1,16 @@
|
||||
// RUN: %target-swift-frontend -emit-interface-path %t.swiftinterface -enable-resilience -emit-module -o /dev/null %s
|
||||
// RUN: %FileCheck %s < %t.swiftinterface
|
||||
|
||||
// CHECK: @_transparent public func glass() -> Int{{$}}
|
||||
@_transparent public func glass() -> Int { return 0 }
|
||||
|
||||
// CHECK: @_effects(readnone) public func illiterate(){{$}}
|
||||
@_effects(readnone) public func illiterate() {}
|
||||
|
||||
// CHECK-LABEL: @_fixed_layout public struct Point {
|
||||
@_fixed_layout public struct Point {
|
||||
// CHECK-NEXT: public var x: Int
|
||||
public var x: Int
|
||||
// CHECK-NEXT: public var y: Int
|
||||
public var y: Int
|
||||
} // CHECK-NEXT: {{^}$}}
|
||||
Reference in New Issue
Block a user