Skip to content

Commit 2131cec

Browse files
authored
---
yaml --- r: 340859 b: refs/heads/rxwei-patch-1 c: 1a67b55 h: refs/heads/master i: 340857: b2f5e84 340855: 3d2f6ea
1 parent 956a1dc commit 2131cec

Some content is hidden

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

43 files changed

+775
-334
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1015,7 +1015,7 @@ refs/tags/swift-DEVELOPMENT-SNAPSHOT-2018-08-18-a: b10b1fce14385faa6d44f6b933e95
10151015
refs/heads/rdar-43033749-fix-batch-mode-no-diags-swift-5.0-branch: a14e64eaad30de89f0f5f0b2a782eed7ecdcb255
10161016
refs/heads/revert-19006-error-bridging-integer-type: 8a9065a3696535305ea53fe9b71f91cbe6702019
10171017
refs/heads/revert-19050-revert-19006-error-bridging-integer-type: ecf752d54b05dd0a20f510f0bfa54a3fec3bcaca
1018-
refs/heads/rxwei-patch-1: d0f668146328a85d3f86f230c1f09dbc42310f39
1018+
refs/heads/rxwei-patch-1: 1a67b55ad35459ebe5a52845e7033e2a8e9fc81c
10191019
refs/heads/shahmishal-patch-1: e58ec0f7488258d42bef51bc3e6d7b3dc74d7b2a
10201020
refs/heads/typelist-existential: 4046359efd541fb5c72d69a92eefc0a784df8f5e
10211021
refs/tags/swift-4.2-DEVELOPMENT-SNAPSHOT-2018-08-20-a: 4319ba09e4fb8650ee86061075c74a016b6baab9

branches/rxwei-patch-1/CMakeLists.txt

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -621,9 +621,9 @@ endif()
621621
if(SWIFT_HOST_VARIANT_ARCH)
622622
set(SWIFT_HOST_VARIANT_ARCH_default "${SWIFT_HOST_VARIANT_ARCH}")
623623
else()
624-
if("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
624+
if(CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64|AMD64")
625625
set(SWIFT_HOST_VARIANT_ARCH_default "x86_64")
626-
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "aarch64")
626+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "aarch64|ARM64")
627627
set(SWIFT_HOST_VARIANT_ARCH_default "aarch64")
628628
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "ppc64")
629629
set(SWIFT_HOST_VARIANT_ARCH_default "powerpc64")
@@ -636,8 +636,6 @@ else()
636636
set(SWIFT_HOST_VARIANT_ARCH_default "armv6")
637637
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "armv7l|armv7-a")
638638
set(SWIFT_HOST_VARIANT_ARCH_default "armv7")
639-
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "AMD64")
640-
set(SWIFT_HOST_VARIANT_ARCH_default "x86_64")
641639
elseif("${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "IA64")
642640
set(SWIFT_HOST_VARIANT_ARCH_default "itanium")
643641
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86|i686)")

branches/rxwei-patch-1/include/swift/AST/Decl.h

Lines changed: 47 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -344,13 +344,7 @@ class alignas(1 << DeclAlignInBits) Decl {
344344
IsUserAccessible : 1
345345
);
346346

347-
SWIFT_INLINE_BITFIELD(AbstractStorageDecl, ValueDecl, 1+1+1+1+2+1+1+1,
348-
/// Whether the getter is mutating.
349-
IsGetterMutating : 1,
350-
351-
/// Whether the setter is mutating.
352-
IsSetterMutating : 1,
353-
347+
SWIFT_INLINE_BITFIELD(AbstractStorageDecl, ValueDecl, 1+1+2+1+1+1,
354348
/// Whether this represents physical storage.
355349
HasStorage : 1,
356350

@@ -439,7 +433,7 @@ class alignas(1 << DeclAlignInBits) Decl {
439433
HasSingleExpressionBody : 1
440434
);
441435

442-
SWIFT_INLINE_BITFIELD(FuncDecl, AbstractFunctionDecl, 1+2+1+1+2,
436+
SWIFT_INLINE_BITFIELD(FuncDecl, AbstractFunctionDecl, 1+2+1+1+1+2,
443437
/// Whether this function is a 'static' method.
444438
IsStatic : 1,
445439

@@ -452,6 +446,9 @@ class alignas(1 << DeclAlignInBits) Decl {
452446
/// Whether this function has a dynamic Self return type.
453447
HasDynamicSelf : 1,
454448

449+
/// Whether we've computed the 'self' access kind yet.
450+
SelfAccessComputed : 1,
451+
455452
/// Backing bits for 'self' access kind.
456453
SelfAccess : 2
457454
);
@@ -2853,6 +2850,11 @@ class OpaqueTypeDecl : public GenericTypeDecl {
28532850

28542851
ValueDecl *getNamingDecl() const { return NamingDecl; }
28552852

2853+
void setNamingDecl(ValueDecl *D) {
2854+
assert(!NamingDecl && "already have naming decl");
2855+
NamingDecl = D;
2856+
}
2857+
28562858
GenericSignature *getOpaqueInterfaceGenericSignature() const {
28572859
return OpaqueInterfaceGenericSignature;
28582860
}
@@ -4385,6 +4387,10 @@ class ProtocolDecl final : public NominalTypeDecl {
43854387
/// SubscriptDecl, representing potentially settable memory locations.
43864388
class AbstractStorageDecl : public ValueDecl {
43874389
friend class SetterAccessLevelRequest;
4390+
friend class IsGetterMutatingRequest;
4391+
friend class IsSetterMutatingRequest;
4392+
friend class OpaqueReadOwnershipRequest;
4393+
43884394
public:
43894395
static const size_t MaxNumAccessors = 255;
43904396
private:
@@ -4452,17 +4458,22 @@ class AbstractStorageDecl : public ValueDecl {
44524458
Bits.AbstractStorageDecl.SupportsMutation = implInfo.supportsMutation();
44534459
}
44544460

4461+
struct {
4462+
unsigned IsGetterMutatingComputed : 1;
4463+
unsigned IsGetterMutating : 1;
4464+
unsigned IsSetterMutatingComputed : 1;
4465+
unsigned IsSetterMutating : 1;
4466+
unsigned OpaqueReadOwnershipComputed : 1;
4467+
unsigned OpaqueReadOwnership : 2;
4468+
} LazySemanticInfo = { };
4469+
44554470
protected:
44564471
AbstractStorageDecl(DeclKind Kind, bool IsStatic, DeclContext *DC,
44574472
DeclName Name, SourceLoc NameLoc,
44584473
StorageIsMutable_t supportsMutation)
44594474
: ValueDecl(Kind, DC, Name, NameLoc) {
44604475
Bits.AbstractStorageDecl.HasStorage = true;
44614476
Bits.AbstractStorageDecl.SupportsMutation = supportsMutation;
4462-
Bits.AbstractStorageDecl.IsGetterMutating = false;
4463-
Bits.AbstractStorageDecl.IsSetterMutating = true;
4464-
Bits.AbstractStorageDecl.OpaqueReadOwnership =
4465-
unsigned(OpaqueReadOwnership::Owned);
44664477
Bits.AbstractStorageDecl.IsStatic = IsStatic;
44674478
}
44684479

@@ -4546,29 +4557,26 @@ class AbstractStorageDecl : public ValueDecl {
45464557
}
45474558

45484559
/// Return the ownership of values opaquely read from this storage.
4549-
OpaqueReadOwnership getOpaqueReadOwnership() const {
4550-
return OpaqueReadOwnership(Bits.AbstractStorageDecl.OpaqueReadOwnership);
4551-
}
4560+
OpaqueReadOwnership getOpaqueReadOwnership() const;
45524561
void setOpaqueReadOwnership(OpaqueReadOwnership ownership) {
4553-
Bits.AbstractStorageDecl.OpaqueReadOwnership = unsigned(ownership);
4562+
LazySemanticInfo.OpaqueReadOwnership = unsigned(ownership);
4563+
LazySemanticInfo.OpaqueReadOwnershipComputed = true;
45544564
}
45554565

45564566
/// Return true if reading this storage requires the ability to
45574567
/// modify the base value.
4558-
bool isGetterMutating() const {
4559-
return Bits.AbstractStorageDecl.IsGetterMutating;
4560-
}
4568+
bool isGetterMutating() const;
45614569
void setIsGetterMutating(bool isMutating) {
4562-
Bits.AbstractStorageDecl.IsGetterMutating = isMutating;
4570+
LazySemanticInfo.IsGetterMutating = isMutating;
4571+
LazySemanticInfo.IsGetterMutatingComputed = true;
45634572
}
45644573

45654574
/// Return true if modifying this storage requires the ability to
45664575
/// modify the base value.
4567-
bool isSetterMutating() const {
4568-
return Bits.AbstractStorageDecl.IsSetterMutating;
4569-
}
4576+
bool isSetterMutating() const;
45704577
void setIsSetterMutating(bool isMutating) {
4571-
Bits.AbstractStorageDecl.IsSetterMutating = isMutating;
4578+
LazySemanticInfo.IsSetterMutating = isMutating;
4579+
LazySemanticInfo.IsSetterMutatingComputed = true;
45724580
}
45734581

45744582
AccessorDecl *getAccessor(AccessorKind kind) const {
@@ -5933,6 +5941,7 @@ llvm::raw_ostream &operator<<(llvm::raw_ostream &OS, SelfAccessKind SAK);
59335941
/// FuncDecl - 'func' declaration.
59345942
class FuncDecl : public AbstractFunctionDecl {
59355943
friend class AbstractFunctionDecl;
5944+
friend class SelfAccessKindRequest;
59365945

59375946
SourceLoc StaticLoc; // Location of the 'static' token or invalid.
59385947
SourceLoc FuncLoc; // Location of the 'func' token.
@@ -5963,7 +5972,9 @@ class FuncDecl : public AbstractFunctionDecl {
59635972

59645973
Bits.FuncDecl.HasDynamicSelf = false;
59655974
Bits.FuncDecl.ForcedStaticDispatch = false;
5966-
Bits.FuncDecl.SelfAccess = static_cast<unsigned>(SelfAccessKind::NonMutating);
5975+
Bits.FuncDecl.SelfAccess =
5976+
static_cast<unsigned>(SelfAccessKind::NonMutating);
5977+
Bits.FuncDecl.SelfAccessComputed = false;
59675978
}
59685979

59695980
private:
@@ -5976,6 +5987,13 @@ class FuncDecl : public AbstractFunctionDecl {
59765987
DeclContext *Parent,
59775988
ClangNode ClangN);
59785989

5990+
Optional<SelfAccessKind> getCachedSelfAccessKind() const {
5991+
if (Bits.FuncDecl.SelfAccessComputed)
5992+
return static_cast<SelfAccessKind>(Bits.FuncDecl.SelfAccess);
5993+
5994+
return None;
5995+
}
5996+
59795997
public:
59805998
/// Factory function only for use by deserialization.
59815999
static FuncDecl *createDeserialized(ASTContext &Context, SourceLoc StaticLoc,
@@ -6010,7 +6028,7 @@ class FuncDecl : public AbstractFunctionDecl {
60106028
void setStatic(bool IsStatic = true) {
60116029
Bits.FuncDecl.IsStatic = IsStatic;
60126030
}
6013-
6031+
60146032
bool isMutating() const {
60156033
return getSelfAccessKind() == SelfAccessKind::Mutating;
60166034
}
@@ -6021,11 +6039,11 @@ class FuncDecl : public AbstractFunctionDecl {
60216039
return getSelfAccessKind() == SelfAccessKind::__Consuming;
60226040
}
60236041

6024-
SelfAccessKind getSelfAccessKind() const {
6025-
return static_cast<SelfAccessKind>(Bits.FuncDecl.SelfAccess);
6026-
}
6042+
SelfAccessKind getSelfAccessKind() const;
6043+
60276044
void setSelfAccessKind(SelfAccessKind mod) {
60286045
Bits.FuncDecl.SelfAccess = static_cast<unsigned>(mod);
6046+
Bits.FuncDecl.SelfAccessComputed = true;
60296047
}
60306048

60316049
SourceLoc getStaticLoc() const { return StaticLoc; }

branches/rxwei-patch-1/include/swift/AST/DiagnosticsClangImporter.def

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,4 +102,5 @@ WARNING(clang_vfs_overlay_is_ignored,none,
102102
# undef NOTE
103103
# undef WARNING
104104
# undef ERROR
105+
# undef REMARK
105106
#endif

branches/rxwei-patch-1/include/swift/AST/TypeCheckRequests.h

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ class SpecializeAttr;
3636
class TypeAliasDecl;
3737
struct TypeLoc;
3838
class ValueDecl;
39+
class AbstractStorageDecl;
40+
enum class OpaqueReadOwnership: uint8_t;
3941

4042
/// Display a nominal type or extension thereof.
4143
void simple_display(
@@ -674,6 +676,112 @@ class FunctionBuilderTypeRequest :
674676
void noteCycleStep(DiagnosticEngine &diags) const;
675677
};
676678

679+
/// Request a function's self access kind.
680+
class SelfAccessKindRequest :
681+
public SimpleRequest<SelfAccessKindRequest,
682+
CacheKind::SeparatelyCached,
683+
SelfAccessKind,
684+
FuncDecl *> {
685+
public:
686+
using SimpleRequest::SimpleRequest;
687+
688+
private:
689+
friend SimpleRequest;
690+
691+
// Evaluation.
692+
llvm::Expected<SelfAccessKind>
693+
evaluate(Evaluator &evaluator, FuncDecl *func) const;
694+
695+
public:
696+
// Cycle handling
697+
void diagnoseCycle(DiagnosticEngine &diags) const;
698+
void noteCycleStep(DiagnosticEngine &diags) const;
699+
700+
// Separate caching.
701+
bool isCached() const { return true; }
702+
Optional<SelfAccessKind> getCachedResult() const;
703+
void cacheResult(SelfAccessKind value) const;
704+
};
705+
706+
/// Request whether the storage has a mutating getter.
707+
class IsGetterMutatingRequest :
708+
public SimpleRequest<IsGetterMutatingRequest,
709+
CacheKind::SeparatelyCached,
710+
bool, AbstractStorageDecl *> {
711+
public:
712+
using SimpleRequest::SimpleRequest;
713+
714+
private:
715+
friend SimpleRequest;
716+
717+
// Evaluation.
718+
llvm::Expected<bool>
719+
evaluate(Evaluator &evaluator, AbstractStorageDecl *func) const;
720+
721+
public:
722+
// Cycle handling
723+
void diagnoseCycle(DiagnosticEngine &diags) const;
724+
void noteCycleStep(DiagnosticEngine &diags) const;
725+
726+
// Separate caching.
727+
bool isCached() const { return true; }
728+
Optional<bool> getCachedResult() const;
729+
void cacheResult(bool value) const;
730+
};
731+
732+
/// Request whether the storage has a mutating getter.
733+
class IsSetterMutatingRequest :
734+
public SimpleRequest<IsSetterMutatingRequest,
735+
CacheKind::SeparatelyCached,
736+
bool, AbstractStorageDecl *> {
737+
public:
738+
using SimpleRequest::SimpleRequest;
739+
740+
private:
741+
friend SimpleRequest;
742+
743+
// Evaluation.
744+
llvm::Expected<bool>
745+
evaluate(Evaluator &evaluator, AbstractStorageDecl *func) const;
746+
747+
public:
748+
// Cycle handling
749+
void diagnoseCycle(DiagnosticEngine &diags) const;
750+
void noteCycleStep(DiagnosticEngine &diags) const;
751+
752+
// Separate caching.
753+
bool isCached() const { return true; }
754+
Optional<bool> getCachedResult() const;
755+
void cacheResult(bool value) const;
756+
};
757+
758+
/// Request whether reading the storage yields a borrowed value.
759+
class OpaqueReadOwnershipRequest :
760+
public SimpleRequest<OpaqueReadOwnershipRequest,
761+
CacheKind::SeparatelyCached,
762+
OpaqueReadOwnership,
763+
AbstractStorageDecl *> {
764+
public:
765+
using SimpleRequest::SimpleRequest;
766+
767+
private:
768+
friend SimpleRequest;
769+
770+
// Evaluation.
771+
llvm::Expected<OpaqueReadOwnership>
772+
evaluate(Evaluator &evaluator, AbstractStorageDecl *storage) const;
773+
774+
public:
775+
// Cycle handling
776+
void diagnoseCycle(DiagnosticEngine &diags) const;
777+
void noteCycleStep(DiagnosticEngine &diags) const;
778+
779+
// Separate caching.
780+
bool isCached() const { return true; }
781+
Optional<OpaqueReadOwnership> getCachedResult() const;
782+
void cacheResult(OpaqueReadOwnership value) const;
783+
};
784+
677785
// Allow AnyValue to compare two Type values, even though Type doesn't
678786
// support ==.
679787
template<>

branches/rxwei-patch-1/include/swift/AST/TypeCheckerTypeIDZone.def

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,3 +35,7 @@ SWIFT_TYPEID(PropertyWrapperBackingPropertyTypeRequest)
3535
SWIFT_TYPEID(PropertyWrapperBackingPropertyInfoRequest)
3636
SWIFT_TYPEID(AttachedFunctionBuilderRequest)
3737
SWIFT_TYPEID(FunctionBuilderTypeRequest)
38+
SWIFT_TYPEID(SelfAccessKindRequest)
39+
SWIFT_TYPEID(IsGetterMutatingRequest)
40+
SWIFT_TYPEID(IsSetterMutatingRequest)
41+
SWIFT_TYPEID(OpaqueReadOwnershipRequest)

branches/rxwei-patch-1/include/swift/Parse/Parser.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1012,6 +1012,7 @@ class Parser {
10121012
ParserResult<VarDecl> parseDeclVarGetSet(Pattern *pattern,
10131013
ParseDeclOptions Flags,
10141014
SourceLoc StaticLoc,
1015+
StaticSpellingKind StaticSpelling,
10151016
SourceLoc VarLoc,
10161017
bool hasInitializer,
10171018
const DeclAttributes &Attributes,

branches/rxwei-patch-1/include/swift/Serialization/ModuleFormat.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ const uint16_t SWIFTMODULE_VERSION_MAJOR = 0;
5252
/// describe what change you made. The content of this comment isn't important;
5353
/// it just ensures a conflict if two people change the module format.
5454
/// Don't worry about adhering to the 80-column limit for this line.
55-
const uint16_t SWIFTMODULE_VERSION_MINOR = 494; // remove linkage from SILVTable
55+
const uint16_t SWIFTMODULE_VERSION_MINOR = 495; // remove superclass from ProtocolLayout
5656

5757
using DeclIDField = BCFixed<31>;
5858

@@ -997,7 +997,6 @@ namespace decls_block {
997997
BCFixed<1>, // objc?
998998
BCFixed<1>, // existential-type-supported?
999999
GenericEnvironmentIDField, // generic environment
1000-
TypeIDField, // superclass
10011000
AccessLevelField, // access level
10021001
BCArray<DeclIDField> // inherited types
10031002
// Trailed by the generic parameters (if any), the members record, and

0 commit comments

Comments
 (0)