Skip to content

Commit 013016f

Browse files
Merge pull request #5161 from swiftwasm/main
[pull] swiftwasm from main
2 parents 148d642 + cfa7d37 commit 013016f

File tree

136 files changed

+11169
-1256
lines changed

Some content is hidden

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

136 files changed

+11169
-1256
lines changed

include/swift/AST/ASTContext.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1369,7 +1369,8 @@ class ASTContext final {
13691369
///
13701370
/// This drops the parameter pack bit from each generic parameter,
13711371
/// and converts same-element requirements to same-type requirements.
1372-
CanGenericSignature getOpenedElementSignature(CanGenericSignature baseGenericSig);
1372+
CanGenericSignature getOpenedElementSignature(CanGenericSignature baseGenericSig,
1373+
CanType shapeClass);
13731374

13741375
GenericSignature getOverrideGenericSignature(const ValueDecl *base,
13751376
const ValueDecl *derived);

include/swift/AST/Decl.h

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1101,17 +1101,21 @@ class alignas(1 << DeclAlignInBits) Decl : public ASTAllocated<Decl> {
11011101
/// Retrieve the @available attribute that provides the OS version range that
11021102
/// this declaration is available in.
11031103
///
1104-
/// The attribute may come from another declaration, since availability
1105-
/// could be inherited from a parent declaration.
1104+
/// This attribute may come from an enclosing decl since availability is
1105+
/// inherited. The second member of the returned pair is the decl that owns
1106+
/// the attribute.
11061107
Optional<std::pair<const AvailableAttr *, const Decl *>>
11071108
getSemanticAvailableRangeAttr() const;
11081109

11091110
/// Retrieve the @available attribute that makes this declaration unavailable,
11101111
/// if any.
11111112
///
1112-
/// The attribute may come from another declaration, since unavailability
1113-
/// could be inherited from a parent declaration. This is a broader notion of
1114-
/// unavailability than is checked by \c AvailableAttr::isUnavailable.
1113+
/// This attribute may come from an enclosing decl since availability is
1114+
/// inherited. The second member of the returned pair is the decl that owns
1115+
/// the attribute.
1116+
///
1117+
/// Note that this notion of unavailability is broader than that which is
1118+
/// checked by \c AvailableAttr::isUnavailable.
11151119
Optional<std::pair<const AvailableAttr *, const Decl *>>
11161120
getSemanticUnavailableAttr() const;
11171121

include/swift/AST/DiagnosticsSema.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6786,6 +6786,10 @@ ERROR(external_macro_not_found,none,
67866786
"external macro implementation type '%0.%1' could not be found for "
67876787
"macro %2; the type must be public and provided via "
67886788
"'-load-plugin-library'", (StringRef, StringRef, DeclName))
6789+
ERROR(macro_must_be_defined,none,
6790+
"macro %0 requires a definition", (DeclName))
6791+
ERROR(external_macro_outside_macro_definition,none,
6792+
"macro 'externalMacro' can only be used to define another macro", ())
67896793
NOTE(macro_note, none,
67906794
"%1 (in macro %0)", (DeclName, StringRef))
67916795
WARNING(macro_warning, none,

include/swift/AST/GenericEnvironment.h

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ struct OpenedExistentialEnvironmentData {
6767
/// Extra data in a generic environment for an opened pack element.
6868
struct OpenedElementEnvironmentData {
6969
UUID uuid;
70+
CanType shapeClass;
7071
SubstitutionMap outerSubstitutions;
7172
};
7273

@@ -140,7 +141,8 @@ class alignas(1 << DeclAlignInBits) GenericEnvironment final
140141
Type existential, GenericSignature parentSig, UUID uuid);
141142

142143
/// Private constructor for opened element environments.
143-
explicit GenericEnvironment(GenericSignature signature, UUID uuid,
144+
explicit GenericEnvironment(GenericSignature signature,
145+
UUID uuid, CanType shapeClass,
144146
SubstitutionMap outerSubs);
145147

146148
friend ArchetypeType;
@@ -187,6 +189,9 @@ class alignas(1 << DeclAlignInBits) GenericEnvironment final
187189
/// opened pack element generic environment.
188190
SubstitutionMap getPackElementContextSubstitutions() const;
189191

192+
/// Retrieve the shape equivalence class for an opened element environment.
193+
CanType getOpenedElementShapeClass() const;
194+
190195
/// Retrieve the UUID for an opened element environment.
191196
UUID getOpenedElementUUID() const;
192197

@@ -222,10 +227,12 @@ class alignas(1 << DeclAlignInBits) GenericEnvironment final
222227
/// signature of the context whose element type is being opened, but with
223228
/// the pack parameter bit erased from one or more generic parameters
224229
/// \param uuid The unique identifier for this opened element
230+
/// \param shapeClass The shape equivalence class for the originating packs.
225231
/// \param outerSubs The substitution map containing archetypes from the
226232
/// outer generic context.
227233
static GenericEnvironment *
228-
forOpenedElement(GenericSignature signature, UUID uuid,
234+
forOpenedElement(GenericSignature signature,
235+
UUID uuid, CanType shapeClass,
229236
SubstitutionMap outerSubs);
230237

231238
/// Make vanilla new/delete illegal.

include/swift/AST/MacroDefinition.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ class MacroDefinition {
112112
return data.builtin;
113113
}
114114

115-
explicit operator bool() const { return kind != Kind::Invalid; }
115+
operator Kind() const { return kind; }
116116
};
117117

118118
}

include/swift/Basic/FrozenMultiMap.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,26 @@ class FrozenMultiMap {
259259
return !pair.second.hasValue();
260260
});
261261
}
262+
263+
typename VectorStorage::iterator vector_begin() {
264+
assert(isFrozen() && "Can only call this in map mode");
265+
return storage.begin();
266+
}
267+
268+
typename VectorStorage::iterator vector_end() {
269+
assert(isFrozen() && "Can only call this in map mode");
270+
return storage.end();
271+
}
272+
273+
typename VectorStorage::const_iterator vector_begin() const {
274+
assert(isFrozen() && "Can only call this in map mode");
275+
return storage.begin();
276+
}
277+
278+
typename VectorStorage::const_iterator vector_end() const {
279+
assert(isFrozen() && "Can only call this in map mode");
280+
return storage.end();
281+
}
262282
};
263283

264284
template <typename Key, typename Value, typename Storage>

include/swift/RemoteInspection/TypeLowering.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -239,6 +239,17 @@ class EnumTypeInfo : public TypeInfo {
239239
return std::count_if(Cases.begin(), Cases.end(),
240240
[](const FieldInfo &Case){return Case.TR != 0;});
241241
}
242+
unsigned getNumNonEmptyPayloadCases() const {
243+
auto Cases = getCases();
244+
return std::count_if(Cases.begin(), Cases.end(),
245+
[](const FieldInfo &Case){
246+
// For our purposes here, assume any case
247+
// with invalid (missing) typeinfo is non-empty
248+
return Case.TR != 0
249+
&& (Case.TI.getKind() == TypeInfoKind::Invalid
250+
|| Case.TI.getSize() > 0);
251+
});
252+
}
242253
// Size of the payload area.
243254
unsigned getPayloadSize() const {
244255
return EnumTypeInfo::getPayloadSizeForCases(Cases);

0 commit comments

Comments
 (0)