Skip to content

Commit ef481ee

Browse files
authored
Merge pull request #4228 from swiftwasm/main
[pull] swiftwasm from main
2 parents 4b073b9 + 4e75c99 commit ef481ee

File tree

10 files changed

+28
-3
lines changed

10 files changed

+28
-3
lines changed

include/swift/Reflection/ReflectionContext.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1157,15 +1157,15 @@ class ReflectionContext
11571157
reinterpret_cast<const ConcurrentHashMap<Runtime> *>(MapBytes.get());
11581158

11591159
auto Count = MapData->ElementCount;
1160-
auto Size = Count * sizeof(ConformanceCacheEntry<Runtime>);
1160+
auto Size = Count * sizeof(ConformanceCacheEntry<Runtime>) + sizeof(StoredPointer);
11611161

11621162
auto ElementsBytes =
11631163
getReader().readBytes(RemoteAddress(MapData->Elements), Size);
11641164
if (!ElementsBytes)
11651165
return;
11661166
auto ElementsData =
11671167
reinterpret_cast<const ConformanceCacheEntry<Runtime> *>(
1168-
ElementsBytes.get());
1168+
reinterpret_cast<const char *>(ElementsBytes.get()) + sizeof(StoredPointer));
11691169

11701170
for (StoredSize i = 0; i < Count; i++) {
11711171
auto &Element = ElementsData[i];

lib/Sema/TypeCheckStorage.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,16 +257,18 @@ PatternBindingEntryRequest::evaluate(Evaluator &eval,
257257
llvm::SmallVector<VarDecl *, 2> vars;
258258
binding->getPattern(entryNumber)->collectVariables(vars);
259259
bool isReq = false;
260+
bool shouldRequireStatic = false;
260261
if (auto *d = binding->getDeclContext()->getAsDecl()) {
261262
isReq = isa<ProtocolDecl>(d);
263+
shouldRequireStatic = isa<NominalTypeDecl>(d);
262264
}
263265
for (auto *sv: vars) {
264266
bool hasConst = sv->getAttrs().getAttribute<CompileTimeConstAttr>();
265267
if (!hasConst)
266268
continue;
267269
bool hasStatic = StaticSpelling != StaticSpellingKind::None;
268270
// only static _const let/var is supported
269-
if (!hasStatic) {
271+
if (shouldRequireStatic && !hasStatic) {
270272
binding->diagnose(diag::require_static_for_const);
271273
continue;
272274
}

stdlib/public/Platform/winsdk.modulemap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -411,6 +411,13 @@ module WinSDK [system] {
411411
link "sensorsapi.lib"
412412
}
413413

414+
module ToolHelp {
415+
header "TlHelp32.h"
416+
export *
417+
418+
link "kernel32.Lib"
419+
}
420+
414421
module UI {
415422
module XAML {
416423
module Hosting {

test/Sema/const_pass_as_arguments.swift

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,12 @@ class ConstFanClassWrong4: ConstFan {
7171
static func giveMeString() -> String { return "" }
7272
static _const let v: String = giveMeString() // expected-error {{_const let should be initialized with a compile-time literal}}
7373
}
74+
75+
_const let globalConst = 3
76+
77+
class ConstFanClassWrong5 {
78+
func foo() -> Int {
79+
_const let localConst = 3
80+
return globalConst + localConst
81+
}
82+
}

test/stdlib/SIMD.swift

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// RUN: %target-run-simple-swift
22
// REQUIRES: executable_test
33
// REQUIRES: objc_interop
4+
// UNSUPPORTED: freestanding
45

56
import Foundation
67
import StdlibUnittest

test/stdlib/SIMDConcreteFP.swift.gyb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
// RUN: %line-directive %t/SIMDConcreteFP.swift -- %target-run %t/a.out
1717
// REQUIRES: executable_test
1818
// REQUIRES: rdar76545659
19+
// UNSUPPORTED: freestanding
1920

2021
import StdlibUnittest
2122

test/stdlib/SIMDConcreteIntegers.swift.gyb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// RUN: %target-codesign %t/a.out
1616
// RUN: %line-directive %t/SIMDConcreteIntegers.swift -- %target-run %t/a.out
1717
// REQUIRES: executable_test
18+
// UNSUPPORTED: freestanding
1819

1920
import StdlibUnittest
2021

test/stdlib/SIMDConcreteMasks.swift.gyb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
// RUN: %target-codesign %t/a.out
1616
// RUN: %line-directive %t/SIMDConcreteMasks.swift -- %target-run %t/a.out
1717
// REQUIRES: executable_test
18+
// UNSUPPORTED: freestanding
1819

1920
import StdlibUnittest
2021

utils/build-presets.ini

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2532,6 +2532,7 @@ swift-stdlib-lto=full
25322532
swift-stdlib-enable-prespecialization=0
25332533
swift-stdlib-passthrough-metadata-allocator=1
25342534
swift-stdlib-short-mangling-lookups=0
2535+
swift-stdlib-enable-vector-types=0
25352536
swift-stdlib-experimental-hermetic-seal-at-link=1
25362537
swift-stdlib-disable-instantiation-caches=1
25372538
swift-stdlib-has-type-printing=0

utils/build-script-impl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,7 @@ KNOWN_SETTINGS=(
222222
swift-stdlib-enable-prespecialization "" "whether stdlib should be built with generic metadata prespecialization enabled, defaults to true on Darwin and Linux, false otherwise"
223223
swift-stdlib-passthrough-metadata-allocator "0" "whether stdlib should be built without a custom implementation of MetadataAllocator, relying on malloc+free instead"
224224
swift-stdlib-short-mangling-lookups "1" "whether to build stdlib with fast-path context descriptor lookups based on well-known short manglings"
225+
swift-stdlib-enable-vector-types "1" "whether to build stdlib with support for SIMD and vector types"
225226
swift-stdlib-experimental-hermetic-seal-at-link "0" "whether stdlib should be built with -experimental-hermetic-seal-at-link"
226227
swift-stdlib-disable-instantiation-caches "0" "whether to build stdlib with -disable-preallocated-instantiation-caches"
227228
swift-stdlib-has-type-printing "1" "whether stdlib should support printing user-friendly type name as strings at runtime"
@@ -2028,6 +2029,7 @@ for host in "${ALL_HOSTS[@]}"; do
20282029
-DSWIFT_STDLIB_ENABLE_LTO:STRING="${SWIFT_STDLIB_LTO}"
20292030
-DSWIFT_STDLIB_PASSTHROUGH_METADATA_ALLOCATOR:BOOL=$(true_false "${SWIFT_STDLIB_PASSTHROUGH_METADATA_ALLOCATOR}")
20302031
-DSWIFT_STDLIB_SHORT_MANGLING_LOOKUPS:BOOL=$(true_false "${SWIFT_STDLIB_SHORT_MANGLING_LOOKUPS}")
2032+
-DSWIFT_STDLIB_ENABLE_VECTOR_TYPES:BOOL=$(true_false "${SWIFT_STDLIB_ENABLE_VECTOR_TYPES}")
20312033
-DSWIFT_STDLIB_HAS_TYPE_PRINTING:BOOL=$(true_false "${SWIFT_STDLIB_HAS_TYPE_PRINTING}")
20322034
-DSWIFT_STDLIB_EXPERIMENTAL_HERMETIC_SEAL_AT_LINK:BOOL=$(true_false "${SWIFT_STDLIB_EXPERIMENTAL_HERMETIC_SEAL_AT_LINK}")
20332035
-DSWIFT_STDLIB_DISABLE_INSTANTIATION_CACHES:BOOL=$(true_false "${SWIFT_STDLIB_DISABLE_INSTANTIATION_CACHES}")

0 commit comments

Comments
 (0)