Skip to content

Commit 306c74f

Browse files
authored
Merge pull request #1220 from swiftwasm/master
[pull] swiftwasm from master
2 parents 4bb1458 + be8ca6d commit 306c74f

File tree

104 files changed

+1578
-1091
lines changed

Some content is hidden

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

104 files changed

+1578
-1091
lines changed

docs/WindowsBuild.md

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,9 @@ subst S: <path to sources>
6464

6565
```cmd
6666
S:
67-
git clone https://github.com/apple/llvm-project --branch swift/master toolchain
68-
git clone -c core.autocrlf=input -c core.symlinks=true https://github.com/apple/swift toolchain/swift
69-
git clone https://github.com/apple/swift-cmark toolchain/cmark
67+
git clone https://github.com/apple/llvm-project --branch swift/master llvm-project
68+
git clone -c core.autocrlf=input -c core.symlinks=true https://github.com/apple/swift swift
69+
git clone https://github.com/apple/swift-cmark cmark
7070
git clone https://github.com/apple/swift-corelibs-libdispatch swift-corelibs-libdispatch
7171
git clone https://github.com/apple/swift-corelibs-foundation swift-corelibs-foundation
7272
git clone https://github.com/apple/swift-corelibs-xctest swift-corelibs-xctest
@@ -78,15 +78,16 @@ git clone https://github.com/compnerd/swift-build swift-build
7878

7979
## Acquire ICU, SQLite3, curl, libxml2 and zlib
8080

81-
Go to [compnerd's swift-build azure page](https://dev.azure.com/compnerd/swift-build/_build) and open [Pipelines](https://dev.azure.com/compnerd/swift-build/_build) where you'll see bots (hopefully green) for:
82-
83-
- [ICU](https://dev.azure.com/compnerd/swift-build/_build?definitionId=9)
84-
- [SQLite](https://dev.azure.com/compnerd/swift-build/_build?definitionId=12&_a=summary)
85-
- [curl](https://dev.azure.com/compnerd/swift-build/_build?definitionId=11&_a=summary)
86-
- [libxml2](https://dev.azure.com/compnerd/swift-build/_build?definitionId=10&_a=summary)
87-
- [zlib](https://dev.azure.com/compnerd/swift-build/_build?definitionId=16&_a=summary)
81+
```
82+
python -m pip install --user msrest azure-devops tabulate
83+
python swift-build\utilities\swift-build.py --build-id ICU --latest-artifacts --filter windows-x64 --download
84+
python swift-build\utilities\swift-build.py --build-id XML2 --latest-artifacts --filter windows-x64 --download
85+
python swift-build\utilities\swift-build.py --build-id CURL --latest-artifacts --filter windows-x64 --download
86+
python swift-build\utilities\swift-build.py --build-id zlib --latest-artifacts --filter windows-x64 --download
87+
python swift-build\utilities\swift-build.py --build-id SQLite --latest-artifacts --filter windows-x64 --download
88+
```
8889

89-
Download each of the zip files and copy their contents into S:/Library. The directory structure should resemble:
90+
Extract the zip files, ignoring the top level directory, into `S:/Library`. The directory structure should resemble:
9091

9192
```
9293
/Library
@@ -113,29 +114,30 @@ Set up the `ucrt`, `visualc`, and `WinSDK` modules by:
113114
- and setup the `visualc.apinotes` located at `swift/stdlib/public/Platform/visualc.apinotes` into `${VCToolsInstallDir}/include` as `visualc.apinotes`
114115

115116
```cmd
116-
mklink "%UniversalCRTSdkDir%\Include\%UCRTVersion%\ucrt\module.modulemap" S:\toolchain\swift\stdlib\public\Platform\ucrt.modulemap
117-
mklink "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap" S:\toolchain\swift\stdlib\public\Platform\winsdk.modulemap
118-
mklink "%VCToolsInstallDir%\include\module.modulemap" S:\toolchain\swift\stdlib\public\Platform\visualc.modulemap
119-
mklink "%VCToolsInstallDir%\include\visualc.apinotes" S:\toolchain\swift\stdlib\public\Platform\visualc.apinotes
117+
mklink "%UniversalCRTSdkDir%\Include\%UCRTVersion%\ucrt\module.modulemap" S:\swift\stdlib\public\Platform\ucrt.modulemap
118+
mklink "%UniversalCRTSdkDir%\Include\%UCRTVersion%\um\module.modulemap" S:\swift\stdlib\public\Platform\winsdk.modulemap
119+
mklink "%VCToolsInstallDir%\include\module.modulemap" S:\swift\stdlib\public\Platform\visualc.modulemap
120+
mklink "%VCToolsInstallDir%\include\visualc.apinotes" S:\swift\stdlib\public\Platform\visualc.apinotes
120121
```
121122

122123
Warning: Creating the above links usually requires administrator privileges. The quick and easy way to do this is to open a second developer prompt by right clicking whatever shortcut you used to open the first one, choosing Run As Administrator, and pasting the above commands into the resulting window. You can then close the privileged prompt; this is the only step which requires elevation.
123124

124125
## Build the toolchain
125126

126127
```cmd
127-
md "S:\b\toolchain"
128128
cmake -B "S:\b\toolchain" ^
129129
-C S:\swift-build\cmake\caches\windows-x86_64.cmake ^
130130
-C S:\swift-build\cmake\caches\org.compnerd.dt.cmake ^
131131
-D CMAKE_BUILD_TYPE=Release ^
132132
-D LLVM_ENABLE_ASSERTIONS=YES ^
133-
-D LLVM_ENABLE_PROJECTS="clang;clang-tools-extra;cmark;swift;lldb;lld" ^
133+
-D LLVM_ENABLE_PROJECTS="clang;clang-tools-extra;lldb;lld" ^
134134
-D LLVM_EXTERNAL_PROJECTS="cmark;swift" ^
135135
-D SWIFT_PATH_TO_LIBDISPATCH_SOURCE=S:\swift-corelibs-libdispatch ^
136136
-D LLVM_ENABLE_PDB=YES ^
137137
-D LLVM_ENABLE_LIBEDIT=NO ^
138138
-D LLDB_ENABLE_PYTHON=YES ^
139+
-D LLVM_EXTERNAL_SWIFT_SOURCE_DIR="S:/swift" ^
140+
-D LLVM_EXTERNAL_CMARK_SOURCE_DIR="S:/cmark" ^
139141
-D SWIFT_WINDOWS_x86_64_ICU_UC_INCLUDE="S:/Library/icu-64/usr/include" ^
140142
-D SWIFT_WINDOWS_x86_64_ICU_UC="S:/Library/icu-64/usr/lib/icuuc64.lib" ^
141143
-D SWIFT_WINDOWS_x86_64_ICU_I18N_INCLUDE="S:/Library/icu-64/usr/include" ^
@@ -145,7 +147,7 @@ cmake -B "S:\b\toolchain" ^
145147
-D SWIFT_BUILD_DYNAMIC_STDLIB=YES ^
146148
-D SWIFT_BUILD_DYNAMIC_SDK_OVERLAY=YES ^
147149
-G Ninja ^
148-
-S S:\toolchain\llvm
150+
-S S:\llvm-project\llvm
149151
150152
ninja -C S:\b\toolchain
151153
```

include/swift/AST/Decl.h

Lines changed: 13 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,12 +1030,12 @@ class RequirementRepr {
10301030
SourceLoc SeparatorLoc;
10311031
RequirementReprKind Kind : 2;
10321032
bool Invalid : 1;
1033-
TypeLoc FirstType;
1033+
TypeRepr *FirstType;
10341034

10351035
/// The second element represents the right-hand side of the constraint.
10361036
/// It can be e.g. a type or a layout constraint.
10371037
union {
1038-
TypeLoc SecondType;
1038+
TypeRepr *SecondType;
10391039
LayoutConstraintLoc SecondLayout;
10401040
};
10411041

@@ -1044,16 +1044,16 @@ class RequirementRepr {
10441044
StringRef AsWrittenString;
10451045

10461046
RequirementRepr(SourceLoc SeparatorLoc, RequirementReprKind Kind,
1047-
TypeLoc FirstType, TypeLoc SecondType)
1047+
TypeRepr *FirstType, TypeRepr *SecondType)
10481048
: SeparatorLoc(SeparatorLoc), Kind(Kind), Invalid(false),
10491049
FirstType(FirstType), SecondType(SecondType) { }
10501050

10511051
RequirementRepr(SourceLoc SeparatorLoc, RequirementReprKind Kind,
1052-
TypeLoc FirstType, LayoutConstraintLoc SecondLayout)
1052+
TypeRepr *FirstType, LayoutConstraintLoc SecondLayout)
10531053
: SeparatorLoc(SeparatorLoc), Kind(Kind), Invalid(false),
10541054
FirstType(FirstType), SecondLayout(SecondLayout) { }
10551055

1056-
void printImpl(ASTPrinter &OS, bool AsWritten) const;
1056+
void printImpl(ASTPrinter &OS) const;
10571057

10581058
public:
10591059
/// Construct a new type-constraint requirement.
@@ -1064,9 +1064,9 @@ class RequirementRepr {
10641064
/// this requirement was implied.
10651065
/// \param Constraint The protocol or protocol composition to which the
10661066
/// subject must conform, or superclass from which the subject must inherit.
1067-
static RequirementRepr getTypeConstraint(TypeLoc Subject,
1067+
static RequirementRepr getTypeConstraint(TypeRepr *Subject,
10681068
SourceLoc ColonLoc,
1069-
TypeLoc Constraint) {
1069+
TypeRepr *Constraint) {
10701070
return { ColonLoc, RequirementReprKind::TypeConstraint, Subject, Constraint };
10711071
}
10721072

@@ -1076,9 +1076,9 @@ class RequirementRepr {
10761076
/// \param EqualLoc The location of the '==' in the same-type constraint, or
10771077
/// an invalid location if this requirement was implied.
10781078
/// \param SecondType The second type.
1079-
static RequirementRepr getSameType(TypeLoc FirstType,
1079+
static RequirementRepr getSameType(TypeRepr *FirstType,
10801080
SourceLoc EqualLoc,
1081-
TypeLoc SecondType) {
1081+
TypeRepr *SecondType) {
10821082
return { EqualLoc, RequirementReprKind::SameType, FirstType, SecondType };
10831083
}
10841084

@@ -1090,7 +1090,7 @@ class RequirementRepr {
10901090
/// this requirement was implied.
10911091
/// \param Layout The layout requirement to which the
10921092
/// subject must conform.
1093-
static RequirementRepr getLayoutConstraint(TypeLoc Subject,
1093+
static RequirementRepr getLayoutConstraint(TypeRepr *Subject,
10941094
SourceLoc ColonLoc,
10951095
LayoutConstraintLoc Layout) {
10961096
return {ColonLoc, RequirementReprKind::LayoutConstraint, Subject,
@@ -1108,48 +1108,15 @@ class RequirementRepr {
11081108

11091109
/// For a type-bound requirement, return the subject of the
11101110
/// conformance relationship.
1111-
Type getSubject() const {
1112-
assert(getKind() == RequirementReprKind::TypeConstraint ||
1113-
getKind() == RequirementReprKind::LayoutConstraint);
1114-
return FirstType.getType();
1115-
}
1116-
11171111
TypeRepr *getSubjectRepr() const {
1118-
assert(getKind() == RequirementReprKind::TypeConstraint ||
1119-
getKind() == RequirementReprKind::LayoutConstraint);
1120-
return FirstType.getTypeRepr();
1121-
}
1122-
1123-
TypeLoc &getSubjectLoc() {
1124-
assert(getKind() == RequirementReprKind::TypeConstraint ||
1125-
getKind() == RequirementReprKind::LayoutConstraint);
1126-
return FirstType;
1127-
}
1128-
1129-
const TypeLoc &getSubjectLoc() const {
11301112
assert(getKind() == RequirementReprKind::TypeConstraint ||
11311113
getKind() == RequirementReprKind::LayoutConstraint);
11321114
return FirstType;
11331115
}
11341116

11351117
/// For a type-bound requirement, return the protocol or to which
11361118
/// the subject conforms or superclass it inherits.
1137-
Type getConstraint() const {
1138-
assert(getKind() == RequirementReprKind::TypeConstraint);
1139-
return SecondType.getType();
1140-
}
1141-
11421119
TypeRepr *getConstraintRepr() const {
1143-
assert(getKind() == RequirementReprKind::TypeConstraint);
1144-
return SecondType.getTypeRepr();
1145-
}
1146-
1147-
TypeLoc &getConstraintLoc() {
1148-
assert(getKind() == RequirementReprKind::TypeConstraint);
1149-
return SecondType;
1150-
}
1151-
1152-
const TypeLoc &getConstraintLoc() const {
11531120
assert(getKind() == RequirementReprKind::TypeConstraint);
11541121
return SecondType;
11551122
}
@@ -1170,43 +1137,13 @@ class RequirementRepr {
11701137
}
11711138

11721139
/// Retrieve the first type of a same-type requirement.
1173-
Type getFirstType() const {
1174-
assert(getKind() == RequirementReprKind::SameType);
1175-
return FirstType.getType();
1176-
}
1177-
11781140
TypeRepr *getFirstTypeRepr() const {
1179-
assert(getKind() == RequirementReprKind::SameType);
1180-
return FirstType.getTypeRepr();
1181-
}
1182-
1183-
TypeLoc &getFirstTypeLoc() {
1184-
assert(getKind() == RequirementReprKind::SameType);
1185-
return FirstType;
1186-
}
1187-
1188-
const TypeLoc &getFirstTypeLoc() const {
11891141
assert(getKind() == RequirementReprKind::SameType);
11901142
return FirstType;
11911143
}
11921144

11931145
/// Retrieve the second type of a same-type requirement.
1194-
Type getSecondType() const {
1195-
assert(getKind() == RequirementReprKind::SameType);
1196-
return SecondType.getType();
1197-
}
1198-
11991146
TypeRepr *getSecondTypeRepr() const {
1200-
assert(getKind() == RequirementReprKind::SameType);
1201-
return SecondType.getTypeRepr();
1202-
}
1203-
1204-
TypeLoc &getSecondTypeLoc() {
1205-
assert(getKind() == RequirementReprKind::SameType);
1206-
return SecondType;
1207-
}
1208-
1209-
const TypeLoc &getSecondTypeLoc() const {
12101147
assert(getKind() == RequirementReprKind::SameType);
12111148
return SecondType;
12121149
}
@@ -1217,19 +1154,13 @@ class RequirementRepr {
12171154
return SeparatorLoc;
12181155
}
12191156

1220-
SourceRange getSourceRange() const {
1221-
if (getKind() == RequirementReprKind::LayoutConstraint)
1222-
return SourceRange(FirstType.getSourceRange().Start,
1223-
SecondLayout.getSourceRange().End);
1224-
return SourceRange(FirstType.getSourceRange().Start,
1225-
SecondType.getSourceRange().End);
1226-
}
1157+
SourceRange getSourceRange() const;
12271158

12281159
/// Retrieve the first or subject type representation from the \c repr,
12291160
/// or \c nullptr if \c repr is null.
12301161
static TypeRepr *getFirstTypeRepr(const RequirementRepr *repr) {
12311162
if (!repr) return nullptr;
1232-
return repr->FirstType.getTypeRepr();
1163+
return repr->FirstType;
12331164
}
12341165

12351166
/// Retrieve the second or constraint type representation from the \c repr,
@@ -1238,7 +1169,7 @@ class RequirementRepr {
12381169
if (!repr) return nullptr;
12391170
assert(repr->getKind() == RequirementReprKind::TypeConstraint ||
12401171
repr->getKind() == RequirementReprKind::SameType);
1241-
return repr->SecondType.getTypeRepr();
1172+
return repr->SecondType;
12421173
}
12431174

12441175
SWIFT_DEBUG_DUMP;

include/swift/AST/FineGrainedDependencies.h

Lines changed: 0 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -804,15 +804,6 @@ class SourceFileDepGraph {
804804
forEachNode([&](SourceFileDepGraphNode *n) { delete n; });
805805
}
806806

807-
/// Goes at the start of an emitted YAML file to help tools recognize it.
808-
/// May vary in the future according to version, etc.
809-
std::string yamlProlog(const bool hadCompilationError) const {
810-
return std::string("# Fine-grained v0\n") +
811-
(!hadCompilationError ? ""
812-
: "# Dependencies are unknown because a "
813-
"compilation error occurred.\n");
814-
}
815-
816807
SourceFileDepGraphNode *getNode(size_t sequenceNumber) const;
817808

818809
InterfaceAndImplementationPair<SourceFileDepGraphNode>
@@ -1016,50 +1007,4 @@ template <typename GraphT> class DotFileEmitter {
10161007
} // end namespace fine_grained_dependencies
10171008
} // end namespace swift
10181009

1019-
//==============================================================================
1020-
// MARK: Declarations for YAMLTraits for reading/writing of SourceFileDepGraph
1021-
//==============================================================================
1022-
1023-
// This introduces a redefinition where ever std::is_same_t<size_t, uint64_t>
1024-
// holds
1025-
#if !(defined(__linux__) || defined(_WIN64))
1026-
LLVM_YAML_DECLARE_SCALAR_TRAITS(size_t, QuotingType::None)
1027-
#endif
1028-
LLVM_YAML_DECLARE_ENUM_TRAITS(swift::fine_grained_dependencies::NodeKind)
1029-
LLVM_YAML_DECLARE_ENUM_TRAITS(swift::fine_grained_dependencies::DeclAspect)
1030-
LLVM_YAML_DECLARE_MAPPING_TRAITS(
1031-
swift::fine_grained_dependencies::DependencyKey)
1032-
LLVM_YAML_DECLARE_MAPPING_TRAITS(swift::fine_grained_dependencies::DepGraphNode)
1033-
1034-
namespace llvm {
1035-
namespace yaml {
1036-
template <>
1037-
struct MappingContextTraits<
1038-
swift::fine_grained_dependencies::SourceFileDepGraphNode,
1039-
swift::fine_grained_dependencies::SourceFileDepGraph> {
1040-
using SourceFileDepGraphNode =
1041-
swift::fine_grained_dependencies::SourceFileDepGraphNode;
1042-
using SourceFileDepGraph =
1043-
swift::fine_grained_dependencies::SourceFileDepGraph;
1044-
1045-
static void mapping(IO &io, SourceFileDepGraphNode &node,
1046-
SourceFileDepGraph &g);
1047-
};
1048-
1049-
template <>
1050-
struct SequenceTraits<
1051-
std::vector<swift::fine_grained_dependencies::SourceFileDepGraphNode *>> {
1052-
using SourceFileDepGraphNode =
1053-
swift::fine_grained_dependencies::SourceFileDepGraphNode;
1054-
using NodeVec = std::vector<SourceFileDepGraphNode *>;
1055-
static size_t size(IO &, NodeVec &vec);
1056-
static SourceFileDepGraphNode &element(IO &, NodeVec &vec, size_t index);
1057-
};
1058-
1059-
} // namespace yaml
1060-
} // namespace llvm
1061-
1062-
LLVM_YAML_DECLARE_MAPPING_TRAITS(
1063-
swift::fine_grained_dependencies::SourceFileDepGraph)
1064-
10651010
#endif // SWIFT_AST_FINE_GRAINED_DEPENDENCIES_H

include/swift/AST/TypeCheckRequests.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -441,7 +441,7 @@ class RequirementRequest :
441441
public SimpleRequest<RequirementRequest,
442442
Requirement(WhereClauseOwner, unsigned,
443443
TypeResolutionStage),
444-
RequestFlags::SeparatelyCached> {
444+
RequestFlags::Cached> {
445445
public:
446446
using SimpleRequest::SimpleRequest;
447447

@@ -464,10 +464,8 @@ class RequirementRequest :
464464
// Cycle handling.
465465
void noteCycleStep(DiagnosticEngine &diags) const;
466466

467-
// Separate caching.
467+
// Caching.
468468
bool isCached() const;
469-
Optional<Requirement> getCachedResult() const;
470-
void cacheResult(Requirement value) const;
471469
};
472470

473471
/// Generate the USR for the given declaration.

include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ SWIFT_REQUEST(TypeChecker, ProtocolRequiresClassRequest, bool(ProtocolDecl *),
176176
SeparatelyCached, NoLocationInfo)
177177
SWIFT_REQUEST(TypeChecker, RequirementRequest,
178178
Requirement(WhereClauseOwner, unsigned, TypeResolutionStage),
179-
SeparatelyCached, HasNearestLocation)
179+
Cached, HasNearestLocation)
180180
SWIFT_REQUEST(TypeChecker, RequirementSignatureRequest,
181181
ArrayRef<Requirement>(ProtocolDecl *), SeparatelyCached,
182182
NoLocationInfo)

include/swift/Demangling/Demangle.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ struct DemangleOptions {
5050
bool DisplayProtocolConformances = true;
5151
bool DisplayWhereClauses = true;
5252
bool DisplayEntityTypes = true;
53+
bool DisplayLocalNameContexts = true;
5354
bool ShortenPartialApply = false;
5455
bool ShortenThunk = false;
5556
bool ShortenValueWitness = false;

0 commit comments

Comments
 (0)