Skip to content

Commit b9319d8

Browse files
authored
Merge branch 'main' into wip-experimental-isolated-deinit
2 parents e345665 + dacdb8f commit b9319d8

File tree

66 files changed

+825
-2224
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+825
-2224
lines changed

docs/README.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -356,8 +356,6 @@ provide greater clarity to contributors wanting to add new documentation.
356356
- [Testing.md](/docs/Testing.md):
357357
TODO: Consider splitting into a how-to guide on writing a new test case
358358
and an explanation for how the compiler is tested.
359-
- [SwiftIndent.md](/docs/SwiftIndent.md):
360-
TODO: Unclear if this is intended to be an explanation or a reference guide.
361359
- [Random.md](/docs/Random.md): Stub.
362360

363361
### Archive

docs/SwiftIndent.md

Lines changed: 0 additions & 56 deletions
This file was deleted.

include/swift/AST/IRGenOptions.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -480,6 +480,10 @@ class IRGenOptions {
480480

481481
unsigned EmitAsyncFramePushPopMetadata : 1;
482482

483+
// Whether to force emission of a frame for all async functions
484+
// (LLVM's 'frame-pointer=all').
485+
unsigned AsyncFramePointerAll : 1;
486+
483487
/// The number of threads for multi-threaded code generation.
484488
unsigned NumThreads = 0;
485489

@@ -570,6 +574,7 @@ class IRGenOptions {
570574
ColocateTypeDescriptors(true), UseRelativeProtocolWitnessTables(false),
571575
UseFragileResilientProtocolWitnesses(false),
572576
EnableHotColdSplit(false), EmitAsyncFramePushPopMetadata(false),
577+
AsyncFramePointerAll(false),
573578
CmdArgs(), SanitizeCoverage(llvm::SanitizerCoverageOptions()),
574579
TypeInfoFilter(TypeInfoDumpFilter::All),
575580
PlatformCCallingConvention(llvm::CallingConv::C), UseCASBackend(false),

include/swift/AST/PackConformance.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,8 @@ class alignas(1 << DeclAlignInBits) PackConformance final
7474

7575
PackConformance *getCanonicalConformance() const;
7676

77-
PackType *getAssociatedType(Type assocType) const;
77+
PackType *getTypeWitness(AssociatedTypeDecl *assocType,
78+
SubstOptions options=std::nullopt) const;
7879

7980
PackConformance *
8081
getAssociatedConformance(Type assocType, ProtocolDecl *protocol) const;

include/swift/AST/ProtocolConformanceRef.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,11 @@ class ProtocolConformanceRef {
170170
/// Map contextual types to interface types in the conformance.
171171
ProtocolConformanceRef mapConformanceOutOfContext() const;
172172

173+
/// Look up the type witness for an associated type declaration in this
174+
/// conformance.
175+
Type getTypeWitness(Type origType, AssociatedTypeDecl *assocType,
176+
SubstOptions options = std::nullopt) const;
177+
173178
/// Given a dependent type (expressed in terms of this conformance's
174179
/// protocol), follow it from the conforming type.
175180
Type getAssociatedType(Type origType, Type dependentType) const;

include/swift/Driver/Driver.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,7 +180,6 @@ class Driver {
180180
SwiftDependencyTool, // swift-dependency-tool
181181
SwiftLLVMOpt, // swift-llvm-opt
182182
AutolinkExtract, // swift-autolink-extract
183-
SwiftIndent, // swift-indent
184183
SymbolGraph, // swift-symbolgraph
185184
APIDigester, // swift-api-digester
186185
CacheTool, // swift-cache-tool

include/swift/IRGen/Linking.h

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,9 +89,23 @@ inline bool isEmbedded(CanType t) {
8989
return t->getASTContext().LangOpts.hasFeature(Feature::Embedded);
9090
}
9191

92+
// Metadata is not generated and not allowed to be referenced in Embedded Swift,
93+
// expect for classes (both generic and non-generic), dynamic self, and
94+
// class-bound existentials.
9295
inline bool isMetadataAllowedInEmbedded(CanType t) {
93-
return isa<ClassType>(t) || isa<BoundGenericClassType>(t) ||
94-
isa<DynamicSelfType>(t);
96+
if (isa<ClassType>(t) || isa<BoundGenericClassType>(t) ||
97+
isa<DynamicSelfType>(t)) {
98+
return true;
99+
}
100+
if (auto existentialTy = dyn_cast<ExistentialType>(t)) {
101+
if (existentialTy->requiresClass())
102+
return true;
103+
}
104+
if (auto archeTy = dyn_cast<ArchetypeType>(t)) {
105+
if (archeTy->requiresClass())
106+
return true;
107+
}
108+
return false;
95109
}
96110

97111
inline bool isEmbedded(Decl *d) {
@@ -1062,7 +1076,10 @@ class LinkEntity {
10621076
}
10631077

10641078
static LinkEntity forProtocolWitnessTable(const RootProtocolConformance *C) {
1065-
assert(!isEmbedded(C));
1079+
if (isEmbedded(C)) {
1080+
assert(C->getProtocol()->requiresClass());
1081+
}
1082+
10661083
LinkEntity entity;
10671084
entity.setForProtocolConformance(Kind::ProtocolWitnessTable, C);
10681085
return entity;

include/swift/Option/FrontendOptions.td

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,6 +1324,13 @@ def disable_async_frame_push_pop_metadata :
13241324
Flag<["-"], "disable-async-frame-push-pop-metadata">,
13251325
HelpText<"Disable async frame push pop metadata">;
13261326

1327+
def enable_async_frame_pointer_all :
1328+
Flag<["-"], "enable-async-frame-pointer-all">,
1329+
HelpText<"Always emit async frame stack frames (frame-pointer=all)">;
1330+
def disable_async_frame_pointer_all:
1331+
Flag<["-"], "disable-async-frame-pointer-all">,
1332+
HelpText<"Disable always emit async frame stack frames">;
1333+
13271334
def enable_split_cold_code :
13281335
Flag<["-"], "enable-split-cold-code">,
13291336
HelpText<"Enable splitting of cold code when optimizing">;

include/swift/Option/Options.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ namespace options {
3333
DoesNotAffectIncrementalBuild = (1 << 8),
3434
AutolinkExtractOption = (1 << 9),
3535
ModuleWrapOption = (1 << 10),
36-
SwiftIndentOption = (1 << 11),
36+
// 1 << 11 was previously `SwiftIndentOption`
3737
ArgumentIsPath = (1 << 12),
3838
ModuleInterfaceOption = (1 << 13),
3939
SupplementaryOutput = (1 << 14),

include/swift/Option/Options.td

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,6 @@ def AutolinkExtractOption : OptionFlag;
2929
// The option should be accepted by swift -modulewrap
3030
def ModuleWrapOption : OptionFlag;
3131

32-
// The option should be accepted by swift-indent
33-
def SwiftIndentOption : OptionFlag;
34-
3532
// The option should not be accepted by the driver.
3633
def NoDriverOption : OptionFlag;
3734

@@ -218,7 +215,6 @@ def driver_mode : Joined<["--"], "driver-mode=">, Flags<[HelpHidden]>,
218215

219216
def help : Flag<["-", "--"], "help">,
220217
Flags<[FrontendOption, AutolinkExtractOption, ModuleWrapOption,
221-
SwiftIndentOption,
222218
SwiftSymbolGraphExtractOption, SwiftAPIDigesterOption]>,
223219
HelpText<"Display available options">;
224220
def h : Flag<["-"], "h">, Alias<help>;
@@ -268,8 +264,8 @@ def _DASH_DASH : Option<["--"], "", KIND_REMAINING_ARGS>,
268264

269265
def o : JoinedOrSeparate<["-"], "o">,
270266
Flags<[FrontendOption, AutolinkExtractOption, ModuleWrapOption,
271-
NoInteractiveOption, SwiftIndentOption, ArgumentIsPath,
272-
SwiftAPIDigesterOption, CacheInvariant]>,
267+
NoInteractiveOption, ArgumentIsPath, SwiftAPIDigesterOption,
268+
CacheInvariant]>,
273269
HelpText<"Write output to <file>">, MetaVarName<"<file>">;
274270

275271
def j : JoinedOrSeparate<["-"], "j">, Flags<[DoesNotAffectIncrementalBuild]>,
@@ -1146,28 +1142,28 @@ def AssertConfig : Separate<["-"], "assert-config">,
11461142
def code_formatting_Group : OptionGroup<"<code formatting options>">;
11471143

11481144
def use_tabs : Flag<["-"], "use-tabs">, Group<code_formatting_Group>,
1149-
Flags<[NoInteractiveOption, NoBatchOption, SwiftIndentOption]>,
1145+
Flags<[NoInteractiveOption, NoBatchOption]>,
11501146
HelpText<"Use tabs for indentation.">;
11511147

11521148
def indent_switch_case : Flag<["-"], "indent-switch-case">,
11531149
Group<code_formatting_Group>,
1154-
Flags<[NoInteractiveOption, NoBatchOption, SwiftIndentOption]>,
1150+
Flags<[NoInteractiveOption, NoBatchOption]>,
11551151
HelpText<"Indent cases in switch statements.">;
11561152

11571153
def in_place : Flag<["-"], "in-place">, Group<code_formatting_Group>,
1158-
Flags<[NoInteractiveOption, NoBatchOption, SwiftIndentOption]>,
1154+
Flags<[NoInteractiveOption, NoBatchOption]>,
11591155
HelpText<"Overwrite input file with formatted file.">;
11601156

11611157
def tab_width : Separate<["-"], "tab-width">, Group<code_formatting_Group>,
1162-
Flags<[NoInteractiveOption, NoBatchOption, SwiftIndentOption]>,
1158+
Flags<[NoInteractiveOption, NoBatchOption]>,
11631159
HelpText<"Width of tab character.">, MetaVarName<"<n>">;
11641160

11651161
def indent_width : Separate<["-"], "indent-width">, Group<code_formatting_Group>,
1166-
Flags<[NoInteractiveOption, NoBatchOption, SwiftIndentOption]>,
1162+
Flags<[NoInteractiveOption, NoBatchOption]>,
11671163
HelpText<"Number of characters to indent.">, MetaVarName<"<n>">;
11681164

11691165
def line_range : Separate<["-"], "line-range">, Group<code_formatting_Group>,
1170-
Flags<[NoInteractiveOption, NoBatchOption, SwiftIndentOption]>,
1166+
Flags<[NoInteractiveOption, NoBatchOption]>,
11711167
HelpText<"<start line>:<end line>. Formats a range of lines (1-based). "
11721168
"Can only be used with one input file.">, MetaVarName<"<n:n>">;
11731169

0 commit comments

Comments
 (0)