Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
db63a92
Merge pull request #58619 from Jager-yoo/revise-result-doc
swift-ci May 11, 2022
7cc66ed
Merge pull request #58930 from Jager-yoo/revise-concurrency-doc
amartini51 May 23, 2022
698b806
[SE-0361] Enable bound generic extensions.
hborla Jul 1, 2022
cf34920
[SE-0361] Remove the feature flag for bound generic extensions.
hborla Jul 1, 2022
e6394cc
[SE-0361] Update tests for bound generic extensions.
hborla Jul 1, 2022
1d157c1
[CursorInfo] References should not include shadowed declarations
bnbarham Jul 1, 2022
0023e44
Don't consider marker protocols when mangling associated type refs.
DougGregor Jul 3, 2022
25911e9
Calling `@_unsafeInheritExecutor` functions doesn't exit the current …
DougGregor Jul 4, 2022
9140bf3
[Distributed] Implement witnesses for sync or non-throw dist reqs
ktoso Jun 29, 2022
8cb769a
Merge pull request #59848 from bnbarham/cursor-shadows-cherry
bnbarham Jul 5, 2022
d981fee
Merge pull request #59873 from DougGregor/unsafe-inherit-executor-sta…
DougGregor Jul 5, 2022
5ff6c0a
Merge pull request #59870 from DougGregor/marker-protocol-assoc-type-…
DougGregor Jul 5, 2022
13b3ac9
Merge pull request #59111 from amartini51/cherrypick_result_docs
amartini51 Jul 5, 2022
61cf0af
Don't emit `@preconcurrency import` remarks when we're skipping funct…
DougGregor Jul 5, 2022
e41ed0f
Implement typeref to demangle tree conversion for nested bound generics
augusto2112 Jul 5, 2022
a511f43
Implement heuristic to prioritize in field descriptor search
augusto2112 Jun 30, 2022
1261f27
Revert "[TypeChecker] Adjust Double<->CGFloat conversion to always pr…
xedin Jul 5, 2022
310e0f4
Fix extended existential symbolic demangling on arm64e.
rjmccall Jul 5, 2022
add2681
Merge pull request #59874 from ktoso/pick-pick-fix-witnesses-distribu…
ktoso Jul 5, 2022
4a74c1a
[Metadata Reader] Do not assume OpaqueType context descriptor's paren…
artemcm Jun 21, 2022
b680591
Factor out gathering of context names into a separate reader type ins…
artemcm Jun 24, 2022
beb8ca9
Gather opaque type conformance requirements when scanning associated …
artemcm Jun 29, 2022
1b0d347
Common-out protocol name and type name reading code into the 'Qualifi…
artemcm Jun 27, 2022
ddd0521
[SwiftStaticMirror] Create API to query an opaque associated type's p…
artemcm Jun 29, 2022
3668e00
Merge pull request #59894 from DougGregor/spurious-preconcurrency-rem…
DougGregor Jul 6, 2022
5f2582b
[ASTPrinter] Don't print 'any' in Swift interfaces.
hborla Jul 6, 2022
42e93d8
[stdlib] Switch to using unchecked buffer subscript in low-level Unic…
lorentey Jul 6, 2022
d0961a4
Merge pull request #59830 from hborla/5.7-enable-bound-generic-extens…
hborla Jul 6, 2022
f1c35d5
Merge pull request #59896 from xedin/rdar-96469597-5.7
xedin Jul 6, 2022
d44e6a3
[test] Update Regex type for flattened captures
hamishknight Jul 6, 2022
1674f86
Merge pull request #59891 from rjmccall/ext-exi-pac-fix-5.7
rjmccall Jul 6, 2022
52499bb
Merge pull request #59897 from artemcm/57_ssm_opaque_requirements
nkcsgexi Jul 6, 2022
b8a6648
Merge pull request #59898 from hborla/5.7-revert-any-in-swiftinterface
hborla Jul 6, 2022
83d77f7
Merge pull request #59901 from lorentey/unchecked-buffer-access-insid…
lorentey Jul 6, 2022
4eae653
Merge pull request #59912 from hamishknight/fix-type-5.7
hamishknight Jul 6, 2022
3ae1fb4
[Test] Disabled fail-with-bad-deps-fine.swift.
nate-chandler Jul 6, 2022
394a7f7
Merge pull request #59925 from nate-chandler/wrangle/20220706/2
shahmishal Jul 6, 2022
4af5105
Emit actor hop as part of call to the getter.
DougGregor Jul 6, 2022
f5eff1a
Merge pull request #59895 from augusto2112/cherry-pick-fd-heuristic
augusto2112 Jul 6, 2022
a14f05e
Merge pull request #59927 from DougGregor/sink-actor-hop-for-get-acce…
DougGregor Jul 7, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion include/swift-c/StaticMirror/BinaryScan.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
/// SWIFTSTATICMIRROR_VERSION_MINOR should increase when there are API additions.
/// SWIFTSTATICMIRROR_VERSION_MAJOR is intended for "major" source/ABI breaking changes.
#define SWIFTSTATICMIRROR_VERSION_MAJOR 0
#define SWIFTSTATICMIRROR_VERSION_MINOR 3 // Added filed type info gather
#define SWIFTSTATICMIRROR_VERSION_MINOR 4 // Added opaque associated type's protocol requirements

SWIFTSTATICMIRROR_BEGIN_DECLS

Expand Down Expand Up @@ -115,6 +115,9 @@ SWIFTSTATICMIRROR_PUBLIC swift_static_mirror_string_ref_t
SWIFTSTATICMIRROR_PUBLIC swift_static_mirror_string_ref_t
swift_static_mirror_type_alias_get_substituted_type_mangled_name(
swift_static_mirror_type_alias_t);
SWIFTSTATICMIRROR_PUBLIC swiftscan_string_set_t *
swift_static_mirror_type_alias_get_opaque_type_requirements(
swift_static_mirror_type_alias_t);

// swift_static_mirror_associated_type_info query methods
SWIFTSTATICMIRROR_PUBLIC swift_static_mirror_string_ref_t
Expand Down
15 changes: 14 additions & 1 deletion include/swift/ABI/GenericContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,18 @@ class TargetGenericRequirementDescriptor {
return Protocol;
}

/// Retreive the raw value of the Protocol requirement pointer.
int32_t getUnresolvedProtocolAddress() const {
assert(getKind() == GenericRequirementKind::Protocol);
return Protocol.getUnresolvedProtocolAddress();
}

/// Retreive the offset to the Protocol field
constexpr inline auto
getProtocolOffset() const -> typename Runtime::StoredSize {
return offsetof(typename std::remove_reference<decltype(*this)>::type, Protocol);
}

/// Retrieve the right-hand type for a SameType or BaseClass requirement.
llvm::StringRef getMangledTypeName() const {
assert(getKind() == GenericRequirementKind::SameType ||
Expand Down Expand Up @@ -301,7 +313,8 @@ class TargetGenericEnvironment
}
};

using GenericEnvironmentDescriptor = TargetGenericEnvironment<InProcess>;
using GenericEnvironmentDescriptor =
TargetGenericEnvironment<InProcess>;

/// CRTP class for a context descriptor that includes trailing generic
/// context description.
Expand Down
6 changes: 5 additions & 1 deletion include/swift/ABI/Metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -2996,7 +2996,11 @@ struct TargetOpaqueTypeDescriptor final
return cd->getKind() == ContextDescriptorKind::OpaqueType;
}
};


template <template <typename Runtime> class ObjCInteropKind,
unsigned PointerSize>
using ExternalOpaqueTypeDescriptor = TargetOpaqueTypeDescriptor<
External<ObjCInteropKind<RuntimeTarget<PointerSize>>>>;
using OpaqueTypeDescriptor = TargetOpaqueTypeDescriptor<InProcess>;

/// The instantiation cache for generic metadata. This must be guaranteed
Expand Down
10 changes: 10 additions & 0 deletions include/swift/ABI/MetadataRef.h
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,16 @@ class RelativeTargetProtocolDescriptorPointer {
swiftPointer.getPointer()));
}

/// Retrieve a reference to the protocol.
int32_t getUnresolvedProtocolAddress() const {
#if SWIFT_OBJC_INTEROP
if (isObjC()) {
return objcPointer.getUnresolvedOffset();
}
#endif
return swiftPointer.getUnresolvedOffset();
}

operator TargetProtocolDescriptorRef<Runtime>() const {
return getProtocol();
}
Expand Down
3 changes: 3 additions & 0 deletions include/swift/AST/ActorIsolation.h
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,9 @@ ActorIsolation getActorIsolation(ValueDecl *value);
/// Determine how the given declaration context is isolated.
ActorIsolation getActorIsolationOfContext(DeclContext *dc);

/// Check if both the value, and context are isolated to the same actor.
bool isSameActorIsolated(ValueDecl *value, DeclContext *dc);

/// Determines whether this function's body uses flow-sensitive isolation.
bool usesFlowSensitiveIsolation(AbstractFunctionDecl const *fn);

Expand Down
3 changes: 0 additions & 3 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -4820,9 +4820,6 @@ ERROR(distributed_actor_func_static,none,
ERROR(distributed_actor_func_not_in_distributed_actor,none,
"'distributed' method can only be declared within 'distributed actor'",
())
ERROR(distributed_method_requirement_must_be_async_throws,none, // FIXME(distributed): this is an implementation limitation we should lift
"'distributed' protocol requirement %0 must currently be declared explicitly 'async throws'",
(DeclName))
ERROR(distributed_actor_user_defined_special_property,none,
"property %0 cannot be defined explicitly, as it conflicts with "
"distributed actor synthesized stored property",
Expand Down
8 changes: 5 additions & 3 deletions include/swift/AST/DistributedDecl.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
//
//===----------------------------------------------------------------------===//

#ifndef SWIFT_DECL_TYPECHECKDISTRIBUTED_H
#define SWIFT_DECL_TYPECHECKDISTRIBUTED_H
#ifndef SWIFT_DECL_DISTRIBUTEDDECL_H
#define SWIFT_DECL_DISTRIBUTEDDECL_H

#include "swift/AST/ConcreteDeclRef.h"
#include "swift/AST/DiagnosticEngine.h"
Expand Down Expand Up @@ -132,4 +132,6 @@ extractDistributedSerializationRequirements(

}

#endif /* SWIFT_DECL_TYPECHECKDISTRIBUTED_H */
// ==== ------------------------------------------------------------------------

#endif /* SWIFT_DECL_DISTRIBUTEDDECL_H */
7 changes: 0 additions & 7 deletions include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -482,13 +482,6 @@ namespace swift {
// FrontendOptions.
bool AllowModuleWithCompilerErrors = false;

/// Enable extensions of (sugared) bound generic types
///
/// \code
/// extension [Int] { /**/ }
/// \endcode
bool EnableExperimentalBoundGenericExtensions = false;

/// A helper enum to represent whether or not we customized the default
/// ASTVerifier behavior via a frontend flag. By default, we do not
/// customize.
Expand Down
17 changes: 10 additions & 7 deletions include/swift/Basic/RelativePointer.h
Original file line number Diff line number Diff line change
Expand Up @@ -347,11 +347,7 @@ class RelativeIndirectablePointerIntPair {

public:
const ValueTy *getPointer() const & {
static_assert(alignof(ValueTy) >= 2 && alignof(Offset) >= 2,
"alignment of value and offset must be at least 2 to "
"make room for indirectable flag");

Offset offset = (RelativeOffsetPlusIndirectAndInt & ~getIntMask());
Offset offset = getUnresolvedOffset();

// Check for null.
if (Nullable && offset == 0)
Expand All @@ -370,10 +366,17 @@ class RelativeIndirectablePointerIntPair {
}
}

Offset getUnresolvedOffset() const & {
static_assert(alignof(ValueTy) >= 2 && alignof(Offset) >= 2,
"alignment of value and offset must be at least 2 to "
"make room for indirectable flag");
Offset offset = (RelativeOffsetPlusIndirectAndInt & ~getIntMask());
return offset;
}

/// A zero relative offset encodes a null reference.
bool isNull() const & {
Offset offset = (RelativeOffsetPlusIndirectAndInt & ~getIntMask());
return offset == 0;
return getUnresolvedOffset() == 0;
}

IntTy getInt() const & {
Expand Down
4 changes: 0 additions & 4 deletions include/swift/Option/FrontendOptions.td
Original file line number Diff line number Diff line change
Expand Up @@ -313,10 +313,6 @@ def enable_resilience : Flag<["-"], "enable-resilience">,
def enable_experimental_async_top_level :
Flag<["-"], "enable-experimental-async-top-level">,
HelpText<"Enable experimental concurrency in top-level code">;

def enable_experimental_bound_generic_extensions :
Flag<["-"], "enable-experimental-bound-generic-extensions">,
HelpText<"Enable experimental support for extensions of bound generic types">;
}

// HIDDEN FLAGS
Expand Down
118 changes: 69 additions & 49 deletions include/swift/Reflection/ReflectionContext.h
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,10 @@ class ReflectionContext
return sizeof(StoredPointer) * 2;
}

template <typename T> bool readMachOSections(RemoteAddress ImageStart) {
template <typename T>
bool readMachOSections(
RemoteAddress ImageStart,
llvm::SmallVector<llvm::StringRef, 1> PotentialModuleNames = {}) {
auto Buf =
this->getReader().readBytes(ImageStart, sizeof(typename T::Header));
if (!Buf)
Expand Down Expand Up @@ -337,15 +340,15 @@ class ReflectionContext
MPEnumMdSec.first == nullptr)
return false;

ReflectionInfo info = {
{FieldMdSec.first, FieldMdSec.second},
{AssocTySec.first, AssocTySec.second},
{BuiltinTySec.first, BuiltinTySec.second},
{CaptureSec.first, CaptureSec.second},
{TypeRefMdSec.first, TypeRefMdSec.second},
{ReflStrMdSec.first, ReflStrMdSec.second},
{ConformMdSec.first, ConformMdSec.second},
{MPEnumMdSec.first, MPEnumMdSec.second}};
ReflectionInfo info = {{FieldMdSec.first, FieldMdSec.second},
{AssocTySec.first, AssocTySec.second},
{BuiltinTySec.first, BuiltinTySec.second},
{CaptureSec.first, CaptureSec.second},
{TypeRefMdSec.first, TypeRefMdSec.second},
{ReflStrMdSec.first, ReflStrMdSec.second},
{ConformMdSec.first, ConformMdSec.second},
{MPEnumMdSec.first, MPEnumMdSec.second},
PotentialModuleNames};

this->addReflectionInfo(info);

Expand Down Expand Up @@ -374,7 +377,9 @@ class ReflectionContext
return true;
}

bool readPECOFFSections(RemoteAddress ImageStart) {
bool readPECOFFSections(
RemoteAddress ImageStart,
llvm::SmallVector<llvm::StringRef, 1> PotentialModuleNames = {}) {
auto DOSHdrBuf = this->getReader().readBytes(
ImageStart, sizeof(llvm::object::dos_header));
if (!DOSHdrBuf)
Expand Down Expand Up @@ -463,20 +468,21 @@ class ReflectionContext
MPEnumMdSec.first == nullptr)
return false;

ReflectionInfo Info = {
{FieldMdSec.first, FieldMdSec.second},
{AssocTySec.first, AssocTySec.second},
{BuiltinTySec.first, BuiltinTySec.second},
{CaptureSec.first, CaptureSec.second},
{TypeRefMdSec.first, TypeRefMdSec.second},
{ReflStrMdSec.first, ReflStrMdSec.second},
{ConformMdSec.first, ConformMdSec.second},
{MPEnumMdSec.first, MPEnumMdSec.second}};
ReflectionInfo Info = {{FieldMdSec.first, FieldMdSec.second},
{AssocTySec.first, AssocTySec.second},
{BuiltinTySec.first, BuiltinTySec.second},
{CaptureSec.first, CaptureSec.second},
{TypeRefMdSec.first, TypeRefMdSec.second},
{ReflStrMdSec.first, ReflStrMdSec.second},
{ConformMdSec.first, ConformMdSec.second},
{MPEnumMdSec.first, MPEnumMdSec.second},
PotentialModuleNames};
this->addReflectionInfo(Info);
return true;
}

bool readPECOFF(RemoteAddress ImageStart) {
bool readPECOFF(RemoteAddress ImageStart,
llvm::SmallVector<llvm::StringRef, 1> PotentialModuleNames = {}) {
auto Buf = this->getReader().readBytes(ImageStart,
sizeof(llvm::object::dos_header));
if (!Buf)
Expand All @@ -495,12 +501,14 @@ class ReflectionContext
if (memcmp(Buf.get(), llvm::COFF::PEMagic, sizeof(llvm::COFF::PEMagic)))
return false;

return readPECOFFSections(ImageStart);
return readPECOFFSections(ImageStart, PotentialModuleNames);
}

template <typename T>
bool readELFSections(RemoteAddress ImageStart,
llvm::Optional<llvm::sys::MemoryBlock> FileBuffer) {
bool readELFSections(
RemoteAddress ImageStart,
llvm::Optional<llvm::sys::MemoryBlock> FileBuffer,
llvm::SmallVector<llvm::StringRef, 1> PotentialModuleNames = {}) {
// When reading from the FileBuffer we can simply return a pointer to
// the underlying data.
// When reading from the process, we need to keep the memory around
Expand Down Expand Up @@ -655,15 +663,15 @@ class ReflectionContext
MPEnumMdSec.first == nullptr)
return false;

ReflectionInfo info = {
{FieldMdSec.first, FieldMdSec.second},
{AssocTySec.first, AssocTySec.second},
{BuiltinTySec.first, BuiltinTySec.second},
{CaptureSec.first, CaptureSec.second},
{TypeRefMdSec.first, TypeRefMdSec.second},
{ReflStrMdSec.first, ReflStrMdSec.second},
{ConformMdSec.first, ConformMdSec.second},
{MPEnumMdSec.first, MPEnumMdSec.second}};
ReflectionInfo info = {{FieldMdSec.first, FieldMdSec.second},
{AssocTySec.first, AssocTySec.second},
{BuiltinTySec.first, BuiltinTySec.second},
{CaptureSec.first, CaptureSec.second},
{TypeRefMdSec.first, TypeRefMdSec.second},
{ReflStrMdSec.first, ReflStrMdSec.second},
{ConformMdSec.first, ConformMdSec.second},
{MPEnumMdSec.first, MPEnumMdSec.second},
PotentialModuleNames};

this->addReflectionInfo(info);
return true;
Expand All @@ -687,7 +695,10 @@ class ReflectionContext
/// \return
/// /b True if the metadata information was parsed successfully,
/// /b false otherwise.
bool readELF(RemoteAddress ImageStart, llvm::Optional<llvm::sys::MemoryBlock> FileBuffer) {
bool
readELF(RemoteAddress ImageStart,
llvm::Optional<llvm::sys::MemoryBlock> FileBuffer,
llvm::SmallVector<llvm::StringRef, 1> PotentialModuleNames = {}) {
auto Buf =
this->getReader().readBytes(ImageStart, sizeof(llvm::ELF::Elf64_Ehdr));
if (!Buf)
Expand All @@ -703,16 +714,18 @@ class ReflectionContext
unsigned char FileClass = Hdr->getFileClass();
if (FileClass == llvm::ELF::ELFCLASS64) {
return readELFSections<ELFTraits<llvm::ELF::ELFCLASS64>>(
ImageStart, FileBuffer);
ImageStart, FileBuffer, PotentialModuleNames);
} else if (FileClass == llvm::ELF::ELFCLASS32) {
return readELFSections<ELFTraits<llvm::ELF::ELFCLASS32>>(
ImageStart, FileBuffer);
ImageStart, FileBuffer, PotentialModuleNames);
} else {
return false;
}
}

bool addImage(RemoteAddress ImageStart) {
bool
addImage(RemoteAddress ImageStart,
llvm::SmallVector<llvm::StringRef, 1> PotentialModuleNames = {}) {
// Read the first few bytes to look for a magic header.
auto Magic = this->getReader().readBytes(ImageStart, sizeof(uint32_t));
if (!Magic)
Expand All @@ -723,18 +736,18 @@ class ReflectionContext

// 32- and 64-bit Mach-O.
if (MagicWord == llvm::MachO::MH_MAGIC) {
return readMachOSections<MachOTraits<4>>(ImageStart);
return readMachOSections<MachOTraits<4>>(ImageStart, PotentialModuleNames);
}

if (MagicWord == llvm::MachO::MH_MAGIC_64) {
return readMachOSections<MachOTraits<8>>(ImageStart);
return readMachOSections<MachOTraits<8>>(ImageStart, PotentialModuleNames);
}

// PE. (This just checks for the DOS header; `readPECOFF` will further
// validate the existence of the PE header.)
auto MagicBytes = (const char*)Magic.get();
if (MagicBytes[0] == 'M' && MagicBytes[1] == 'Z') {
return readPECOFF(ImageStart);
return readPECOFF(ImageStart, PotentialModuleNames);
}


Expand All @@ -743,7 +756,8 @@ class ReflectionContext
&& MagicBytes[1] == llvm::ELF::ElfMagic[1]
&& MagicBytes[2] == llvm::ELF::ElfMagic[2]
&& MagicBytes[3] == llvm::ELF::ElfMagic[3]) {
return readELF(ImageStart, llvm::Optional<llvm::sys::MemoryBlock>());
return readELF(ImageStart, llvm::Optional<llvm::sys::MemoryBlock>(),
PotentialModuleNames);
}

// We don't recognize the format.
Expand All @@ -758,9 +772,11 @@ class ReflectionContext
/// \return
/// \b True if any of the reflection sections were registered,
/// \b false otherwise.
bool addImage(llvm::function_ref<
std::pair<RemoteRef<void>, uint64_t>(ReflectionSectionKind)>
FindSection) {
bool
addImage(llvm::function_ref<
std::pair<RemoteRef<void>, uint64_t>(ReflectionSectionKind)>
FindSection,
llvm::SmallVector<llvm::StringRef, 1> PotentialModuleNames = {}) {
auto Sections = {
ReflectionSectionKind::fieldmd, ReflectionSectionKind::assocty,
ReflectionSectionKind::builtin, ReflectionSectionKind::capture,
Expand All @@ -784,11 +800,15 @@ class ReflectionContext
if (llvm::all_of(Pairs, [](const auto &Pair) { return !Pair.first; }))
return false;

ReflectionInfo Info = {
{Pairs[0].first, Pairs[0].second}, {Pairs[1].first, Pairs[1].second},
{Pairs[2].first, Pairs[2].second}, {Pairs[3].first, Pairs[3].second},
{Pairs[4].first, Pairs[4].second}, {Pairs[5].first, Pairs[5].second},
{Pairs[6].first, Pairs[6].second}, {Pairs[7].first, Pairs[7].second}};
ReflectionInfo Info = {{Pairs[0].first, Pairs[0].second},
{Pairs[1].first, Pairs[1].second},
{Pairs[2].first, Pairs[2].second},
{Pairs[3].first, Pairs[3].second},
{Pairs[4].first, Pairs[4].second},
{Pairs[5].first, Pairs[5].second},
{Pairs[6].first, Pairs[6].second},
{Pairs[7].first, Pairs[7].second},
PotentialModuleNames};
this->addReflectionInfo(Info);
return true;
}
Expand Down
Loading