Skip to content

Commit 969f1ad

Browse files
Merge pull request #4715 from swiftwasm/main
[pull] swiftwasm from main
2 parents e1c028b + e86827f commit 969f1ad

File tree

124 files changed

+1990
-362
lines changed

Some content is hidden

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

124 files changed

+1990
-362
lines changed

bindings/xml/comment-xml-schema.rng

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -959,6 +959,13 @@
959959
<param name="pattern">.*\S.*</param>
960960
</data>
961961
</element>
962+
<element name="InlineAttributes">
963+
<attribute name="attributes"/>
964+
<!-- Non-empty text content. -->
965+
<data type="string">
966+
<param name="pattern">.*\S.*</param>
967+
</data>
968+
</element>
962969
</choice>
963970
</define>
964971

include/swift/AST/Attr.def

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -735,6 +735,12 @@ CONTEXTUAL_SIMPLE_DECL_ATTR(_local, KnownToBeLocal,
735735
APIBreakingToAdd | APIBreakingToRemove,
736736
130)
737737

738+
SIMPLE_DECL_ATTR(_moveOnly, MoveOnly,
739+
OnNominalType |
740+
UserInaccessible |
741+
ABIBreakingToAdd | ABIBreakingToRemove | APIBreakingToAdd | APIBreakingToRemove,
742+
131)
743+
738744
// If you're adding a new underscored attribute here, please document it in
739745
// docs/ReferenceGuides/UnderscoredAttributes.md.
740746

include/swift/AST/Decl.h

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2262,12 +2262,19 @@ class ValueDecl : public Decl {
22622262
/// Whether this declaration produces an implicitly unwrapped
22632263
/// optional result.
22642264
unsigned isIUO : 1;
2265+
2266+
/// Whether the "isMoveOnly" bit has been computed yet.
2267+
unsigned isMoveOnlyComputed : 1;
2268+
2269+
/// Whether this declaration can not be copied and thus is move only.
2270+
unsigned isMoveOnly : 1;
22652271
} LazySemanticInfo = { };
22662272

22672273
friend class DynamicallyReplacedDeclRequest;
22682274
friend class OverriddenDeclsRequest;
22692275
friend class IsObjCRequest;
22702276
friend class IsFinalRequest;
2277+
friend class IsMoveOnlyRequest;
22712278
friend class IsDynamicRequest;
22722279
friend class IsImplicitlyUnwrappedOptionalRequest;
22732280
friend class InterfaceTypeRequest;
@@ -2542,6 +2549,9 @@ class ValueDecl : public Decl {
25422549
/// Is this declaration 'final'?
25432550
bool isFinal() const;
25442551

2552+
/// Is this declaration 'moveOnly'?
2553+
bool isMoveOnly() const;
2554+
25452555
/// Is this declaration marked with 'dynamic'?
25462556
bool isDynamic() const;
25472557

@@ -2952,9 +2962,12 @@ class OpaqueTypeDecl final :
29522962
return false;
29532963
}
29542964

2965+
using AvailabilityCondition = std::pair<VersionRange, bool>;
2966+
29552967
class ConditionallyAvailableSubstitutions final
2956-
: private llvm::TrailingObjects<ConditionallyAvailableSubstitutions,
2957-
VersionRange> {
2968+
: private llvm::TrailingObjects<
2969+
ConditionallyAvailableSubstitutions,
2970+
AvailabilityCondition> {
29582971
friend TrailingObjects;
29592972

29602973
unsigned NumAvailabilityConditions;
@@ -2964,25 +2977,25 @@ class OpaqueTypeDecl final :
29642977
/// A type with limited availability described by the provided set
29652978
/// of availability conditions (with `and` relationship).
29662979
ConditionallyAvailableSubstitutions(
2967-
ArrayRef<VersionRange> availabilityContext,
2980+
ArrayRef<AvailabilityCondition> availabilityContext,
29682981
SubstitutionMap substitutions)
29692982
: NumAvailabilityConditions(availabilityContext.size()),
29702983
Substitutions(substitutions) {
29712984
assert(!availabilityContext.empty());
29722985
std::uninitialized_copy(availabilityContext.begin(),
29732986
availabilityContext.end(),
2974-
getTrailingObjects<VersionRange>());
2987+
getTrailingObjects<AvailabilityCondition>());
29752988
}
29762989

29772990
public:
2978-
ArrayRef<VersionRange> getAvailability() const {
2979-
return {getTrailingObjects<VersionRange>(), NumAvailabilityConditions};
2991+
ArrayRef<AvailabilityCondition> getAvailability() const {
2992+
return {getTrailingObjects<AvailabilityCondition>(), NumAvailabilityConditions};
29802993
}
29812994

29822995
SubstitutionMap getSubstitutions() const { return Substitutions; }
29832996

29842997
static ConditionallyAvailableSubstitutions *
2985-
get(ASTContext &ctx, ArrayRef<VersionRange> availabilityContext,
2998+
get(ASTContext &ctx, ArrayRef<AvailabilityCondition> availabilityContext,
29862999
SubstitutionMap substitutions);
29873000
};
29883001
};

include/swift/AST/DiagnosticsFrontend.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,8 @@ ERROR(error_mode_cannot_emit_symbol_graph,none,
143143
"this mode does not support emitting symbol graph files", ())
144144
ERROR(error_mode_cannot_emit_abi_descriptor,none,
145145
"this mode does not support emitting ABI descriptor", ())
146+
ERROR(error_mode_cannot_emit_const_values,none,
147+
"this mode does not support emitting extracted const values", ())
146148
ERROR(error_mode_cannot_emit_module_semantic_info,none,
147149
"this mode does not support emitting module semantic info", ())
148150
ERROR(cannot_emit_ir_skipping_function_bodies,none,

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6396,5 +6396,8 @@ ERROR(concurrency_task_to_thread_model_global_actor_annotation,none,
63966396
"annotating a type with a global actor %0 is not permitted within %1",
63976397
(TypeRepr*, StringRef))
63986398

6399+
ERROR(moveOnly_not_allowed_here,none,
6400+
"'moveOnly' may only be applied to classes, structs, and enums", ())
6401+
63996402
#define UNDEFINE_DIAGNOSTIC_MACROS
64006403
#include "DefineDiagnosticMacros.h"

include/swift/AST/SearchPathOptions.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -339,6 +339,9 @@ class SearchPathOptions {
339339
/// A file containing modules we should perform batch scanning.
340340
std::string BatchScanInputFilePath;
341341

342+
/// A file containing a list of protocols whose conformances require const value extraction.
343+
std::string ConstGatherProtocolListFilePath;
344+
342345
/// Debug path mappings to apply to serialized search paths. These are
343346
/// specified in LLDB from the target.source-map entries.
344347
PathRemapper SearchPathRemapper;

include/swift/AST/TypeCheckRequests.h

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,26 @@ class IsFinalRequest :
395395
void cacheResult(bool value) const;
396396
};
397397

398+
/// Determine whether the given declaration is 'moveOnly'.
399+
class IsMoveOnlyRequest
400+
: public SimpleRequest<IsMoveOnlyRequest, bool(ValueDecl *),
401+
RequestFlags::SeparatelyCached> {
402+
public:
403+
using SimpleRequest::SimpleRequest;
404+
405+
private:
406+
friend SimpleRequest;
407+
408+
// Evaluation.
409+
bool evaluate(Evaluator &evaluator, ValueDecl *decl) const;
410+
411+
public:
412+
// Separate caching.
413+
bool isCached() const { return true; }
414+
Optional<bool> getCachedResult() const;
415+
void cacheResult(bool value) const;
416+
};
417+
398418
/// Determine whether the given declaration is 'dynamic''.
399419
class IsDynamicRequest :
400420
public SimpleRequest<IsDynamicRequest,

include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,8 @@ SWIFT_REQUEST(TypeChecker, IsDynamicRequest, bool(ValueDecl *),
207207
SeparatelyCached, NoLocationInfo)
208208
SWIFT_REQUEST(TypeChecker, IsFinalRequest, bool(ValueDecl *), SeparatelyCached,
209209
NoLocationInfo)
210+
SWIFT_REQUEST(TypeChecker, IsMoveOnlyRequest, bool(ValueDecl *), SeparatelyCached,
211+
NoLocationInfo)
210212
SWIFT_REQUEST(TypeChecker, IsGetterMutatingRequest, bool(AbstractStorageDecl *),
211213
SeparatelyCached, NoLocationInfo)
212214
SWIFT_REQUEST(TypeChecker, IsImplicitlyUnwrappedOptionalRequest,

include/swift/Basic/FileTypes.def

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,8 @@ TYPE("json-dependencies", JSONDependencies, "dependencies.json",
7777
// Complete feature information for the given Swift compiler.
7878
TYPE("json-features", JSONFeatures, "features.json", "")
7979

80+
// Gathered compile-time-known value information for the given Swift input file as JSON.
81+
TYPE("const-values", ConstValues, "swiftconstvalues", "")
8082

8183
TYPE("index-data", IndexData, "", "")
8284
TYPE("index-unit-output-path", IndexUnitOutputPath, "", "")

include/swift/Basic/SupplementaryOutputPaths.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ struct SupplementaryOutputPaths {
147147
/// The output path to generate ABI baseline.
148148
std::string ABIDescriptorOutputPath;
149149

150+
/// The output path for extracted compile-time-known value information
151+
std::string ConstValuesOutputPath;
152+
150153
/// The output path of Swift semantic info for this module.
151154
std::string ModuleSemanticInfoOutputPath;
152155

@@ -188,6 +191,8 @@ struct SupplementaryOutputPaths {
188191
fn(ModuleSummaryOutputPath);
189192
if (!ABIDescriptorOutputPath.empty())
190193
fn(ABIDescriptorOutputPath);
194+
if (!ConstValuesOutputPath.empty())
195+
fn(ConstValuesOutputPath);
191196
if (!YAMLOptRecordPath.empty())
192197
fn(YAMLOptRecordPath);
193198
if (!BitstreamOptRecordPath.empty())
@@ -204,6 +209,7 @@ struct SupplementaryOutputPaths {
204209
TBDPath.empty() && ModuleInterfaceOutputPath.empty() &&
205210
ModuleSourceInfoOutputPath.empty() &&
206211
ABIDescriptorOutputPath.empty() &&
212+
ConstValuesOutputPath.empty() &&
207213
ModuleSemanticInfoOutputPath.empty() && YAMLOptRecordPath.empty() &&
208214
BitstreamOptRecordPath.empty();
209215
}

0 commit comments

Comments
 (0)