Skip to content

Commit ddf0a69

Browse files
authored
Merge pull request #3459 from swiftwasm/maxd/main-merge
Resolve conflicts with upstream `main`
2 parents e85cf94 + 5c8bb0b commit ddf0a69

File tree

62 files changed

+1361
-527
lines changed

Some content is hidden

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

62 files changed

+1361
-527
lines changed

CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,10 @@ option(SWIFT_BUILD_PERF_TESTSUITE
127127

128128
option(SWIFT_INCLUDE_TESTS "Create targets for building/running tests." TRUE)
129129

130+
option(SWIFT_INCLUDE_TEST_BINARIES
131+
"Create targets for building/running test binaries even if SWIFT_INCLUDE_TESTS is disabled"
132+
TRUE)
133+
130134
option(SWIFT_INCLUDE_DOCS
131135
"Create targets for building docs."
132136
TRUE)

include/swift/AST/ASTPrinter.h

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,20 @@ enum class PrintStructureKind {
8686
TupleElement,
8787
NumberLiteral,
8888
StringLiteral,
89+
/// ' = defaultValue'.
90+
DefaultArgumentClause,
91+
/// '<T, U: Requirement>'.
92+
DeclGenericParameterClause,
93+
/// 'where T: Collection, T.Element: Equtable'.
94+
DeclGenericRequirementClause,
95+
/// ' async throws'.
96+
EffectsSpecifiers,
97+
/// ' -> ResultTy' or ': ResultTy'.
98+
DeclResultTypeClause,
99+
/// '(a: Int, b param: String)' in function declarations.
100+
FunctionParameterList,
101+
/// '@attribute ParamTy...' in parameter declarations.
102+
FunctionParameterType,
89103
};
90104

91105
/// An abstract class used to print an AST.

include/swift/AST/RawComment.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ struct SingleRawComment {
5555
return getKind() == CommentKind::OrdinaryLine ||
5656
getKind() == CommentKind::LineDoc;
5757
}
58+
59+
bool isGyb() const {
60+
return RawText.startswith("// ###");
61+
}
5862
};
5963

6064
struct RawComment {

include/swift/Basic/Platform.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,9 +55,10 @@ namespace swift {
5555
bool triplesAreValidForZippering(const llvm::Triple &target,
5656
const llvm::Triple &targetVariant);
5757

58-
/// Returns true if the given triple represents an OS that ships with
59-
/// ABI-stable swift libraries (eg. in /usr/lib/swift).
60-
bool tripleRequiresRPathForSwiftInOS(const llvm::Triple &triple);
58+
/// Returns true if the given triple represents an OS that has all the
59+
/// "built-in" ABI-stable libraries (stdlib and _Concurrency)
60+
/// (eg. in /usr/lib/swift).
61+
bool tripleRequiresRPathForSwiftLibrariesInOS(const llvm::Triple &triple);
6162

6263
/// Returns the platform name for a given target triple.
6364
///

include/swift/Frontend/ModuleInterfaceLoader.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,8 @@ class ExplicitSwiftModuleLoader: public SerializedModuleLoaderBase {
139139
std::unique_ptr<llvm::MemoryBuffer> *moduleBuffer,
140140
std::unique_ptr<llvm::MemoryBuffer> *moduleDocBuffer,
141141
std::unique_ptr<llvm::MemoryBuffer> *moduleSourceInfoBuffer,
142-
bool &isFramework, bool &isSystemModule) override;
142+
bool skipBuildingInterface, bool &isFramework,
143+
bool &isSystemModule) override;
143144

144145
std::error_code findModuleFilesInDirectory(
145146
ImportPath::Element ModuleID,
@@ -148,7 +149,7 @@ class ExplicitSwiftModuleLoader: public SerializedModuleLoaderBase {
148149
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
149150
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
150151
std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer,
151-
bool IsFramework) override;
152+
bool skipBuildingInterface, bool IsFramework) override;
152153

153154
bool canImportModule(ImportPath::Element mID, llvm::VersionTuple version,
154155
bool underlyingVersion) override;
@@ -400,7 +401,7 @@ class ModuleInterfaceLoader : public SerializedModuleLoaderBase {
400401
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
401402
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
402403
std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer,
403-
bool IsFramework) override;
404+
bool skipBuildingInterface, bool IsFramework) override;
404405

405406
bool isCached(StringRef DepPath) override;
406407
public:

include/swift/IDE/CodeCompletion.h

Lines changed: 49 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,14 @@ class CodeCompletionStringChunk {
132132
Equal,
133133
Whitespace,
134134

135+
/// The first chunk of a whole generic parameter clause.
136+
/// E.g '<T, C: Collection>'
137+
GenericParameterClauseBegin,
138+
139+
/// The first chunk of a generic quirement clause.
140+
/// E.g. 'where T: Collection, T.Element == Int'
141+
GenericRequirementClauseBegin,
142+
135143
/// The first chunk of a substring that describes the parameter for a
136144
/// generic type.
137145
GenericParameterBegin,
@@ -194,6 +202,30 @@ class CodeCompletionStringChunk {
194202
/// desired.
195203
OptionalMethodCallTail,
196204

205+
/// The first chunk of a substring that describes the single parameter
206+
/// declaration for a parameter clause.
207+
ParameterDeclBegin,
208+
209+
ParameterDeclExternalName,
210+
211+
ParameterDeclLocalName,
212+
213+
ParameterDeclColon,
214+
215+
ParameterDeclTypeBegin,
216+
217+
/// Default argument clause for parameter declarations.
218+
DefaultArgumentClauseBegin,
219+
220+
/// First chunk for effect specifiers. i.e. 'async' and 'throws'.
221+
EffectsSpecifierClauseBegin,
222+
223+
/// First chunk for result type clause i.e. ' -> ResultTy' or ': ResultTy'.
224+
DeclResultTypeClauseBegin,
225+
226+
/// First chunk for attribute and modifier list i.e. 'override public'
227+
AttributeAndModifierListBegin,
228+
197229
/// Specifies the type of the whole entity that is returned in this code
198230
/// completion result. For example, for variable references it is the
199231
/// variable type, for function calls it is the return type.
@@ -219,7 +251,15 @@ class CodeCompletionStringChunk {
219251
Kind == ChunkKind::GenericParameterBegin ||
220252
Kind == ChunkKind::OptionalBegin ||
221253
Kind == ChunkKind::CallArgumentTypeBegin ||
222-
Kind == ChunkKind::TypeAnnotationBegin;
254+
Kind == ChunkKind::TypeAnnotationBegin ||
255+
Kind == ChunkKind::ParameterDeclBegin ||
256+
Kind == ChunkKind::ParameterDeclTypeBegin ||
257+
Kind == ChunkKind::DefaultArgumentClauseBegin ||
258+
Kind == ChunkKind::GenericParameterClauseBegin ||
259+
Kind == ChunkKind::EffectsSpecifierClauseBegin ||
260+
Kind == ChunkKind::DeclResultTypeClauseBegin ||
261+
Kind == ChunkKind::GenericRequirementClauseBegin ||
262+
Kind == ChunkKind::AttributeAndModifierListBegin;
223263
}
224264

225265
static bool chunkHasText(ChunkKind Kind) {
@@ -249,11 +289,14 @@ class CodeCompletionStringChunk {
249289
Kind == ChunkKind::CallArgumentName ||
250290
Kind == ChunkKind::CallArgumentInternalName ||
251291
Kind == ChunkKind::CallArgumentColon ||
252-
Kind == ChunkKind::DeclAttrParamColon ||
253-
Kind == ChunkKind::DeclAttrParamKeyword ||
254292
Kind == ChunkKind::CallArgumentType ||
255293
Kind == ChunkKind::CallArgumentClosureType ||
256294
Kind == ChunkKind::CallArgumentClosureExpr ||
295+
Kind == ChunkKind::ParameterDeclExternalName ||
296+
Kind == ChunkKind::ParameterDeclLocalName ||
297+
Kind == ChunkKind::ParameterDeclColon ||
298+
Kind == ChunkKind::DeclAttrParamColon ||
299+
Kind == ChunkKind::DeclAttrParamKeyword ||
257300
Kind == ChunkKind::GenericParameterName ||
258301
Kind == ChunkKind::DynamicLookupMethodCallTail ||
259302
Kind == ChunkKind::OptionalMethodCallTail ||
@@ -1053,17 +1096,20 @@ class PrintingCodeCompletionConsumer
10531096
llvm::raw_ostream &OS;
10541097
bool IncludeKeywords;
10551098
bool IncludeComments;
1099+
bool IncludeSourceText;
10561100
bool PrintAnnotatedDescription;
10571101
bool RequiresSourceFileInfo = false;
10581102

10591103
public:
10601104
PrintingCodeCompletionConsumer(llvm::raw_ostream &OS,
10611105
bool IncludeKeywords = true,
10621106
bool IncludeComments = true,
1107+
bool IncludeSourceText = false,
10631108
bool PrintAnnotatedDescription = false)
10641109
: OS(OS),
10651110
IncludeKeywords(IncludeKeywords),
10661111
IncludeComments(IncludeComments),
1112+
IncludeSourceText(IncludeSourceText),
10671113
PrintAnnotatedDescription(PrintAnnotatedDescription) {}
10681114

10691115
void handleResults(CodeCompletionContext &context) override;

include/swift/Parse/Parser.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -963,6 +963,8 @@ class Parser {
963963
/// \returns \c true if there was a parsing error.
964964
bool parseTopLevelSIL();
965965

966+
bool isStartOfGetSetAccessor();
967+
966968
/// Flags that control the parsing of declarations.
967969
enum ParseDeclFlags {
968970
PD_Default = 0,

include/swift/Runtime/Atomic.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,9 @@
2020
#include "swift/Runtime/Config.h"
2121
#include <assert.h>
2222
#include <atomic>
23+
#if defined(_WIN64)
24+
#include <intrin.h>
25+
#endif
2326

2427
// FIXME: Workaround for rdar://problem/18889711. 'Consume' does not require
2528
// a barrier on ARM64, but LLVM doesn't know that. Although 'relaxed'
@@ -72,7 +75,6 @@ class alignas(Size) atomic_impl {
7275
};
7376

7477
#if defined(_WIN64)
75-
#include <intrin.h>
7678

7779
/// MSVC's std::atomic uses an inline spin lock for 16-byte atomics,
7880
/// which is not only unnecessarily inefficient but also doubles the size

include/swift/Sema/ConstraintSystem.h

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1735,9 +1735,9 @@ class SolutionApplicationTarget {
17351735
}
17361736

17371737
static SolutionApplicationTarget
1738-
forUninitializedVar(PatternBindingDecl *binding, unsigned index, Pattern *var,
1738+
forUninitializedVar(PatternBindingDecl *binding, unsigned index,
17391739
Type patternTy) {
1740-
return {binding, index, var, patternTy};
1740+
return {binding, index, binding->getPattern(index), patternTy};
17411741
}
17421742

17431743
/// Form a target for a synthesized property wrapper initializer.
@@ -4329,6 +4329,19 @@ class ConstraintSystem {
43294329
llvm::function_ref<ConstraintFix *(unsigned, const OverloadChoice &)>
43304330
getFix = [](unsigned, const OverloadChoice &) { return nullptr; });
43314331

4332+
/// Generate constraints for the given property that has an
4333+
/// attached property wrapper.
4334+
///
4335+
/// \param wrappedVar The property that has a property wrapper.
4336+
/// \param initializerType The type of the initializer for the
4337+
/// backing storage variable.
4338+
/// \param propertyType The type of the wrapped property.
4339+
///
4340+
/// \returns true if there is an error.
4341+
bool generateWrappedPropertyTypeConstraints(VarDecl *wrappedVar,
4342+
Type initializerType,
4343+
Type propertyType);
4344+
43324345
/// Propagate constraints in an effort to enforce local
43334346
/// consistency to reduce the time to solve the system.
43344347
///

include/swift/Serialization/ModuleDependencyScanner.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ namespace swift {
5555
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
5656
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
5757
std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer,
58-
bool IsFramework) override;
58+
bool skipBuildingInterface, bool IsFramework) override;
5959

6060
virtual void collectVisibleTopLevelModuleNames(
6161
SmallVectorImpl<Identifier> &names) const override {
@@ -117,7 +117,7 @@ namespace swift {
117117
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
118118
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
119119
std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer,
120-
bool IsFramework) override;
120+
bool skipBuildingInterface, bool IsFramework) override;
121121

122122
static bool classof(const ModuleDependencyScanner *MDS) {
123123
return MDS->getKind() == MDS_placeholder;

include/swift/Serialization/SerializedModuleLoader.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ class SerializedModuleLoaderBase : public ModuleLoader {
7777
std::unique_ptr<llvm::MemoryBuffer> *moduleBuffer,
7878
std::unique_ptr<llvm::MemoryBuffer> *moduleDocBuffer,
7979
std::unique_ptr<llvm::MemoryBuffer> *moduleSourceInfoBuffer,
80-
bool &isFramework, bool &isSystemModule);
80+
bool skipBuildingInterface, bool &isFramework, bool &isSystemModule);
8181

8282
/// Attempts to search the provided directory for a loadable serialized
8383
/// .swiftmodule with the provided `ModuleFilename`. Subclasses must
@@ -98,7 +98,7 @@ class SerializedModuleLoaderBase : public ModuleLoader {
9898
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
9999
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
100100
std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer,
101-
bool IsFramework) = 0;
101+
bool skipBuildingInterface, bool IsFramework) = 0;
102102

103103
std::error_code
104104
openModuleFile(
@@ -220,7 +220,7 @@ class ImplicitSerializedModuleLoader : public SerializedModuleLoaderBase {
220220
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
221221
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
222222
std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer,
223-
bool IsFramework) override;
223+
bool skipBuildingInterface, bool IsFramework) override;
224224

225225
bool maybeDiagnoseTargetMismatch(
226226
SourceLoc sourceLocation,
@@ -272,7 +272,7 @@ class MemoryBufferSerializedModuleLoader : public SerializedModuleLoaderBase {
272272
std::unique_ptr<llvm::MemoryBuffer> *ModuleBuffer,
273273
std::unique_ptr<llvm::MemoryBuffer> *ModuleDocBuffer,
274274
std::unique_ptr<llvm::MemoryBuffer> *ModuleSourceInfoBuffer,
275-
bool IsFramework) override;
275+
bool skipBuildingInterface, bool IsFramework) override;
276276

277277
bool maybeDiagnoseTargetMismatch(
278278
SourceLoc sourceLocation,

0 commit comments

Comments
 (0)