Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
66 commits
Select commit Hold shift + click to select a range
9315e92
Use Swift.def to define enums and switch cases for swift5 reflection …
rastogishubham Feb 11, 2022
8fc018c
Update the links for Package bot and drop Ubuntu 16.04
shahmishal Feb 15, 2022
67ba46e
Platform: add a new submodule to WinSDK
compnerd Feb 7, 2022
f440c2d
[NFC] 32-bit-safe ImportDiagnosticTarget
beccadax Feb 18, 2022
2128678
DiagnosticVerifier: Support line offsets in fix-it verification ranges
AnthonyLatsis Feb 17, 2022
5a90f5c
[irgen] Implement irgen::IRBuilder::SavedInsertionPointRAII.
gottesmm Feb 18, 2022
e1cef4f
Merge pull request #41419 from beccadax/not-enough-bits
beccadax Feb 18, 2022
9dba1c1
Temporary fix for OSSA RAUW utilities.
atrick Feb 18, 2022
a0fbce0
Merge pull request #41380 from apple/shahmishal-patch-3
shahmishal Feb 18, 2022
a3709b0
Merge pull request #41450 from atrick/rauw-fix-rebase
nate-chandler Feb 18, 2022
96d90d0
[Gardening] Removed extraneous import.
nate-chandler Feb 11, 2022
b3b8fa5
Merge pull request #41421 from compnerd/pepperidge-farm-remembers
compnerd Feb 18, 2022
970489b
[cxx-interop] [nfc] Don't emit a cast if the cast is a no-op.
zoecarver Feb 17, 2022
47064a0
[cxx-interop] Fix calling methods with dependent types.
zoecarver Feb 17, 2022
d3950e5
[nfc] Disable some method tests on Windows.
zoecarver Feb 18, 2022
83be9ba
Merge pull request #41371 from rastogishubham/objectfile-rewrite
rastogishubham Feb 18, 2022
547b2ef
IRGen: tweak spacing in comment (NFC)
compnerd Feb 12, 2022
33ee4d6
[CodeCompletion] 'ContextFreeCodeCompletionResult' factory method
rintaro Feb 16, 2022
ffea048
[SSADestroyHoisting] Removed incorrect mutation.
nate-chandler Feb 16, 2022
d227cef
[MemAccessUtils] Visit access as unique storage uses.
nate-chandler Feb 16, 2022
bd8626c
[SSADestroyHoisting] Hoist everything inner first.
nate-chandler Feb 17, 2022
092b6f2
[SSADestroyHoisting] Expand store [assign]s first.
nate-chandler Feb 17, 2022
304d2bb
[SSADestroyHoisting] Modifying ignores deinit barriers.
nate-chandler Feb 17, 2022
4ad25e9
[SSADestroyHoisting] Extracted classifying insts.
nate-chandler Feb 17, 2022
767e509
[SSADestroyHoisting] Fold into access scopes.
nate-chandler Feb 17, 2022
271bfdc
[SSADestroyHoisting] Note barrier access scopes.
nate-chandler Feb 17, 2022
ed1b3f2
[SILOpt] Put DestroyHoisting behind flag.
nate-chandler Feb 17, 2022
385f38b
Merge pull request #41442 from zoecarver/remove-noop-casts
zoecarver Feb 18, 2022
4a67288
Merge pull request #41440 from zoecarver/members-with-dependent-types
zoecarver Feb 18, 2022
1e1b342
Experimental support for implicitly opening existential arguments.
DougGregor Feb 18, 2022
4ec6dc1
Erase opaque types involving opened existential types to their upper …
DougGregor Feb 3, 2022
fa6c3c1
Opaque types are only invariant when they involve same-type constraints.
DougGregor Feb 4, 2022
6c03882
Fix test availability for opaque result types
DougGregor Feb 4, 2022
51abd3d
Prevent opening existentials when the corresponding parameter is variant
DougGregor Feb 7, 2022
1273fa4
Support opening of arguments of existential metatype type.
DougGregor Feb 7, 2022
deab0b9
Don't open existential arguments to `type(of:)`.
DougGregor Feb 8, 2022
33be0be
Ensure that we only open existential arguments to functions/subscripts.
DougGregor Feb 8, 2022
9a7b9c6
Don't open existentials when calling C++ function templates
DougGregor Feb 8, 2022
196a4d2
SwiftOnoneSupport creates different specializations with opened exist…
DougGregor Feb 10, 2022
52dba17
Opened existential types aren't always `ExistentialType`.
DougGregor Feb 10, 2022
76d1ba7
Only open existentials for generic arguments on the called declaration
DougGregor Feb 10, 2022
17ce779
Cannot open existentials passed to variadic parameters.
DougGregor Feb 10, 2022
e30c8a5
Allow opening existentials for inout parameters.
DougGregor Feb 10, 2022
e1f68b2
Allow existential opening for parameters of optional type.
DougGregor Feb 11, 2022
0215216
Add "disable" counterpart to `-enable-experimental-opened-existential…
DougGregor Feb 18, 2022
4141e20
Revert "Allow existential opening for parameters of optional type."
DougGregor Feb 18, 2022
b296d41
Merge pull request #41429 from AnthonyLatsis/fixit-line-offsets
AnthonyLatsis Feb 18, 2022
5ab84ae
[CodeCompletion] Precompute and cache "filter name"
rintaro Feb 16, 2022
7ef93b2
[Basic] Move copyCString to Basic/StringExtras.
rintaro Feb 16, 2022
3c33deb
[CodeCompletion] Make all result's string fields null terminated
rintaro Feb 17, 2022
4b44ac5
Merge pull request #41455 from compnerd/spacing
compnerd Feb 18, 2022
be1ebe0
[SSADestroyHoisting] Recombine store [init]s.
nate-chandler Feb 18, 2022
b0c2dbe
Merge pull request #41447 from gottesmm/pr-0a43136a0997cf857b363ce49c…
gottesmm Feb 18, 2022
c05abfe
[CS] Add a fallback for overload locators that failed to simplify
bnbarham Feb 18, 2022
c2b6828
[nfc] XFAIL dependent-types.swift on i386 while I fix the issue.
zoecarver Feb 18, 2022
1fada7b
Merge pull request #41463 from zoecarver/xfail-dep-type-test-on-i386-…
mikeash Feb 18, 2022
b0a60fa
[runtime][NFC] Unify reportOnCrash implementations into a single func…
lorentey Feb 18, 2022
f73e20b
[cxx-interop] Fix crash when inout parameter is used in some "templat…
zoecarver Feb 18, 2022
fee21bc
Merge pull request #41464 from lorentey/nfc-error-reporting-cleanup
lorentey Feb 19, 2022
ef72c5b
accept serialized modules with superflous global-actor annotations
kavon Feb 18, 2022
e3af684
Merge pull request #41183 from DougGregor/implicitly-open-existentials
DougGregor Feb 19, 2022
035fa37
Merge pull request #41438 from nate-chandler/lexical_lifetimes/lexica…
nate-chandler Feb 19, 2022
3fe6782
Merge pull request #41400 from rintaro/completion-fitername-precompute
rintaro Feb 19, 2022
01b539e
Merge pull request #41461 from bnbarham/overload-anchor-fallback
bnbarham Feb 19, 2022
1811438
Merge pull request #41457 from kavon/downgrade-deux
swift-ci Feb 19, 2022
5974cd0
Merge pull request #41466 from zoecarver/support-basic-inout-case
zoecarver Feb 19, 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
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
| | **Architecture** | **main** | **Package** |
|---|:---:|:---:|:---:|
| **macOS** | x86_64 |[![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-macos/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-macos)|[![Build Status](https://ci.swift.org/job/oss-swift-package-macos/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-macos)|
| **Ubuntu 16.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-16_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-16_04)|
| **Ubuntu 18.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-incremental-RA-linux-ubuntu-18_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-linux-ubuntu-18_04)|
| **Ubuntu 18.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-package-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubuntu-18_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-ubuntu-18_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubuntu-18_04)|
| **Ubuntu 20.04** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04)|[![Build Status](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-ubuntu-20_04)|
| **CentOS 8** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-package-centos-8/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-centos-8)|[![Build Status](https://ci.swift.org/job/oss-swift-package-centos-8/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-centos-8)|
| **CentOS 7** | x86_64 | [![Build Status](https://ci.swift.org/job/oss-swift-package-centos-7/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-centos-7)|[![Build Status](https://ci.swift.org/job/oss-swift-package-centos-7/lastCompletedBuild/badge/icon)](https://ci.swift.org/job/oss-swift-package-centos-7)|
Expand Down
81 changes: 18 additions & 63 deletions include/swift/ABI/ObjectFile.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,9 @@ namespace swift {

/// Represents the nine reflection sections used by Swift
enum ReflectionSectionKind : uint8_t {
fieldmd,
assocty,
builtin,
capture,
typeref,
reflstr,
conform,
protocs,
acfuncs,
#define HANDLE_SWIFT_SECTION(KIND, MACHO, ELF, COFF) KIND,
#include "llvm/BinaryFormat/Swift.def"
#undef HANDLE_SWIFT_SECTION
};

/// Abstract base class responsible for providing the correct reflection section
Expand All @@ -43,24 +37,11 @@ class SwiftObjectFileFormatMachO : public SwiftObjectFileFormat {
public:
llvm::StringRef getSectionName(ReflectionSectionKind section) override {
switch (section) {
case fieldmd:
return "__swift5_fieldmd";
case assocty:
return "__swift5_assocty";
case builtin:
return "__swift5_builtin";
case capture:
return "__swift5_capture";
case typeref:
return "__swift5_typeref";
case reflstr:
return "__swift5_reflstr";
case conform:
return "__swift5_proto";
case protocs:
return "__swift5_protos";
case acfuncs:
return "__swift5_acfuncs";
#define HANDLE_SWIFT_SECTION(KIND, MACHO, ELF, COFF) \
case KIND: \
return MACHO;
#include "llvm/BinaryFormat/Swift.def"
#undef HANDLE_SWIFT_SECTION
}
llvm_unreachable("Section type not found.");
}
Expand All @@ -78,24 +59,11 @@ class SwiftObjectFileFormatELF : public SwiftObjectFileFormat {
public:
llvm::StringRef getSectionName(ReflectionSectionKind section) override {
switch (section) {
case fieldmd:
return "swift5_fieldmd";
case assocty:
return "swift5_assocty";
case builtin:
return "swift5_builtin";
case capture:
return "swift5_capture";
case typeref:
return "swift5_typeref";
case reflstr:
return "swift5_reflstr";
case conform:
return "swift5_protocol_conformances";
case protocs:
return "swift5_protocols";
case acfuncs:
return "swift5_accessible_functions";
#define HANDLE_SWIFT_SECTION(KIND, MACHO, ELF, COFF) \
case KIND: \
return ELF;
#include "llvm/BinaryFormat/Swift.def"
#undef HANDLE_SWIFT_SECTION
}
llvm_unreachable("Section type not found.");
}
Expand All @@ -110,24 +78,11 @@ class SwiftObjectFileFormatCOFF : public SwiftObjectFileFormat {
public:
llvm::StringRef getSectionName(ReflectionSectionKind section) override {
switch (section) {
case fieldmd:
return ".sw5flmd";
case assocty:
return ".sw5asty";
case builtin:
return ".sw5bltn";
case capture:
return ".sw5cptr";
case typeref:
return ".sw5tyrf";
case reflstr:
return ".sw5rfst";
case conform:
return ".sw5prtc$B";
case protocs:
return ".sw5prt$B";
case acfuncs:
return ".sw5acfn$B";
#define HANDLE_SWIFT_SECTION(KIND, MACHO, ELF, COFF) \
case KIND: \
return COFF;
#include "llvm/BinaryFormat/Swift.def"
#undef HANDLE_SWIFT_SECTION
}
llvm_unreachable("Section not found.");
}
Expand Down
30 changes: 19 additions & 11 deletions include/swift/AST/Decl.h
Original file line number Diff line number Diff line change
Expand Up @@ -2159,9 +2159,9 @@ class PoundDiagnosticDecl : public Decl {
class OpaqueTypeDecl;

/// Describes the least favorable positions at which a requirement refers
/// to 'Self' in terms of variance, for use in the is-inheritable and
/// is-available-existential checks.
class SelfReferenceInfo final {
/// to a given generic parameter in terms of variance, for use in the
/// is-inheritable and is-available-existential checks.
class GenericParameterReferenceInfo final {
using OptionalTypePosition = OptionalEnum<decltype(TypePosition::Covariant)>;

public:
Expand All @@ -2171,27 +2171,27 @@ class SelfReferenceInfo final {
OptionalTypePosition assocTypeRef;

/// A reference to 'Self'.
static SelfReferenceInfo forSelfRef(TypePosition position) {
return SelfReferenceInfo(false, position, llvm::None);
static GenericParameterReferenceInfo forSelfRef(TypePosition position) {
return GenericParameterReferenceInfo(false, position, llvm::None);
}

/// A reference to 'Self' through an associated type.
static SelfReferenceInfo forAssocTypeRef(TypePosition position) {
return SelfReferenceInfo(false, llvm::None, position);
static GenericParameterReferenceInfo forAssocTypeRef(TypePosition position) {
return GenericParameterReferenceInfo(false, llvm::None, position);
}

SelfReferenceInfo &operator|=(const SelfReferenceInfo &other);
GenericParameterReferenceInfo &operator|=(const GenericParameterReferenceInfo &other);

explicit operator bool() const {
return hasCovariantSelfResult || selfRef || assocTypeRef;
}

SelfReferenceInfo()
GenericParameterReferenceInfo()
: hasCovariantSelfResult(false), selfRef(llvm::None),
assocTypeRef(llvm::None) {}

private:
SelfReferenceInfo(bool hasCovariantSelfResult, OptionalTypePosition selfRef,
GenericParameterReferenceInfo(bool hasCovariantSelfResult, OptionalTypePosition selfRef,
OptionalTypePosition assocTypeRef)
: hasCovariantSelfResult(hasCovariantSelfResult), selfRef(selfRef),
assocTypeRef(assocTypeRef) {}
Expand Down Expand Up @@ -2682,7 +2682,7 @@ class ValueDecl : public Decl {
/// is considered covariant only when it appears as the immediate type of a
/// property, or the uncurried result type of a method/subscript, e.g.
/// '() -> () -> Self'.
SelfReferenceInfo findExistentialSelfReferences(
GenericParameterReferenceInfo findExistentialSelfReferences(
Type baseTy, bool treatNonResultCovariantSelfAsInvariant) const;
};

Expand Down Expand Up @@ -7800,6 +7800,14 @@ class MissingMemberDecl : public Decl {
}
};

/// Find references to the given generic paramaeter in the generic signature
/// and the type of the given value.
GenericParameterReferenceInfo findGenericParameterReferences(
const ValueDecl *value,
CanGenericSignature sig, GenericTypeParamType *genericParam,
bool treatNonResultCovarianceAsInvariant,
Optional<unsigned> skipParamIndex);

inline bool AbstractStorageDecl::isSettable(const DeclContext *UseDC,
const DeclRefExpr *base) const {
if (auto vd = dyn_cast<VarDecl>(this))
Expand Down
4 changes: 2 additions & 2 deletions include/swift/AST/DiagnosticsSema.def
Original file line number Diff line number Diff line change
Expand Up @@ -4794,8 +4794,8 @@ ERROR(global_actor_on_actor_class,none,
ERROR(global_actor_on_local_variable,none,
"local variable %0 cannot have a global actor", (DeclName))
ERROR(global_actor_on_storage_of_value_type,none,
"stored property %0 within %1 cannot have a global actor",
(DeclName, DescriptiveDeclKind))
"stored property %0 within struct cannot have a global actor",
(DeclName))
ERROR(global_actor_non_unsafe_init,none,
"global actor attribute %0 argument can only be '(unsafe)'", (Type))
ERROR(global_actor_non_final_class,none,
Expand Down
4 changes: 4 additions & 0 deletions include/swift/Basic/LangOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,10 @@ namespace swift {
/// `func f() -> <T> T`.
bool EnableExperimentalNamedOpaqueTypes = false;

/// Enable support for implicitly opening existential argument types
/// in calls to generic functions.
bool EnableOpenedExistentialTypes = false;

/// Enable support for protocol types parameterized by primary
/// associated type.
bool EnableParameterizedProtocolTypes = false;
Expand Down
52 changes: 51 additions & 1 deletion include/swift/Basic/StringExtras.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ namespace swift {
/// Determine the part of speech for the given word.
PartOfSpeech getPartOfSpeech(StringRef word);

/// Copy \p string to \p Allocator and return it as a null terminated C
/// string.
const char *copyCString(StringRef string, llvm::BumpPtrAllocator &Allocator);

/// Scratch space used for returning a set of StringRefs.
class StringScratchSpace {
llvm::BumpPtrAllocator Allocator;

public:
StringRef copyString(StringRef string);
StringRef copyString(StringRef string) { return string.copy(Allocator); }

llvm::BumpPtrAllocator &getAllocator() { return Allocator; }
};
Expand Down Expand Up @@ -465,6 +469,52 @@ bool omitNeedlessWords(StringRef &baseName,
/// If the name has a completion-handler suffix, strip off that suffix.
Optional<StringRef> stripWithCompletionHandlerSuffix(StringRef name);

/// Represents a string that can be efficiently retrieved either as a StringRef
/// or as a null-terminated C string.
class NullTerminatedStringRef {
StringRef Ref;

public:
/// Create a \c NullTerminatedStringRef from a null-terminated C string with
/// size \p Size (excluding the null character).
NullTerminatedStringRef(const char *Data, size_t Size) : Ref(Data, Size) {
assert(Data != nullptr && Data[Size] == '\0' &&
"Data should be null-terminated");
}

/// Create an empty null-terminated string. \c data() is not a \c nullptr.
constexpr NullTerminatedStringRef() : Ref("") {}

/// Create an null terminated string with a C string.
constexpr NullTerminatedStringRef(const char *Data) : Ref(Data) {}

/// Create a null-terminated string, copying \p Str into \p A .
template <typename Allocator>
NullTerminatedStringRef(StringRef Str, Allocator &A) : Ref("") {
if (Str.empty())
return;

size_t size = Str.size();
char *memory = A.template Allocate<char>(size + 1);
memcpy(memory, Str.data(), size);
memory[size] = '\0';
Ref = {memory, size};
}

/// Returns the string as a `StringRef`. The `StringRef` does not include the
/// null character.
operator StringRef() const { return Ref; }

/// Returns the string as a null-terminated C string.
const char *data() const { return Ref.data(); }

/// The size of the string, excluding the null character.
size_t size() const { return Ref.size(); }

bool empty() const { return Ref.empty(); }
int compare(NullTerminatedStringRef RHS) const { return Ref.compare(RHS); }
};

} // end namespace swift

#endif // SWIFT_BASIC_STRINGEXTRAS_H
7 changes: 5 additions & 2 deletions include/swift/ClangImporter/ClangImporter.h
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,12 @@ class DWARFImporterDelegate {
virtual void anchor();
};

// ⚠️ DANGER ⚠️
// Putting more than four types in this `PointerUnion` will break the build for
// 32-bit hosts. If we need five or more types in the future, we'll need to
// design a proper larger-than-word-sized type.
typedef llvm::PointerUnion<const clang::Decl *, const clang::MacroInfo *,
const clang::ModuleMacro *, const clang::Type *,
const clang::Token *>
const clang::Type *, const clang::Token *>
ImportDiagnosticTarget;

/// Class that imports Clang modules into Swift, mapping directly
Expand Down
Loading