Skip to content

Commit f15fd33

Browse files
committed
Merge remote-tracking branch 'origin/main' into rebranch
2 parents 4c16f7b + 0889db7 commit f15fd33

File tree

5 files changed

+26
-4
lines changed

5 files changed

+26
-4
lines changed

lib/SILGen/SILGenApply.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3622,8 +3622,8 @@ SILGenFunction::tryEmitAddressableParameterAsAddress(ArgumentSource &&arg,
36223622
auto vd = cast<VarDecl>(memberStorage);
36233623
// TODO: Is it possible and/or useful for class storage to be
36243624
// addressable?
3625-
if (!vd->getDeclContext()->getInnermostTypeContext()
3626-
->getDeclaredTypeInContext()->getStructOrBoundGenericStruct()) {
3625+
if (!vd->isInstanceMember()
3626+
|| !isa<StructDecl>(vd->getDeclContext())) {
36273627
return notAddressable();
36283628
}
36293629

lib/SILGen/SILGenDecl.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -684,7 +684,8 @@ static void deallocateAddressable(SILGenFunction &SGF,
684684
const SILGenFunction::VarLoc::AddressableBuffer::State &state) {
685685
SGF.B.createEndBorrow(l, state.storeBorrow);
686686
SGF.B.createDeallocStack(l, state.allocStack);
687-
if (state.reabstraction) {
687+
if (state.reabstraction
688+
&& !state.reabstraction->getType().isTrivial(SGF.F)) {
688689
SGF.B.createDestroyValue(l, state.reabstraction);
689690
}
690691
}

stdlib/public/RuntimeModule/Elf.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1475,6 +1475,11 @@ final class ElfImage<SomeElfTraits: ElfTraits>
14751475
let stringSect = ElfStringSection(source: stringSource)
14761476

14771477
for shdr in sectionHeaders {
1478+
// All other fields are undefined for SHT_NULL
1479+
if shdr.sh_type == .SHT_NULL {
1480+
continue
1481+
}
1482+
14781483
guard let name = stringSect.getStringAt(index: Int(shdr.sh_name)) else {
14791484
continue
14801485
}
@@ -1612,6 +1617,11 @@ final class ElfImage<SomeElfTraits: ElfTraits>
16121617
let stringSect = ElfStringSection(source: stringSource)
16131618

16141619
for shdr in sectionHeaders {
1620+
// All other fields are undefined for SHT_NULL
1621+
if shdr.sh_type == .SHT_NULL {
1622+
continue
1623+
}
1624+
16151625
guard let sname
16161626
= stringSect.getStringAt(index: Int(shdr.sh_name)) else {
16171627
continue

test/SILGen/82368.swift

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// RUN: %target-swift-emit-silgen -disable-availability-checking -verify %s
2+
3+
struct A {
4+
static let a: InlineArray = [1]
5+
6+
static func foo() {
7+
a.span.withUnsafeBufferPointer({ buffer in
8+
print("\(buffer.baseAddress!)")
9+
})
10+
}
11+
}

utils/swift_build_support/swift_build_support/products/llvm.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -141,7 +141,7 @@ def copy_embedded_compiler_rt_builtins_from_darwin_host_toolchain(
141141
'lib', 'darwin')
142142
print('copying compiler-rt embedded builtins from {}'
143143
' into the local clang build directory {}.'.format(
144-
host_cxx_builtins_dir, dest_builtins_dir))
144+
host_cxx_builtins_dir, dest_builtins_dir), flush=True)
145145

146146
for _os in ['ios', 'watchos', 'tvos', 'xros']:
147147
# Copy over the device .a when necessary

0 commit comments

Comments
 (0)