@@ -1193,7 +1193,7 @@ class ExtensionDecl final : public GenericContext, public Decl,
11931193 // / extended nominal.
11941194 llvm::PointerIntPair<NominalTypeDecl *, 1 , bool > ExtendedNominal;
11951195
1196- MutableArrayRef <TypeLoc> Inherited;
1196+ ArrayRef <TypeLoc> Inherited;
11971197
11981198 // / The next extension in the linked list of extensions.
11991199 // /
@@ -1212,7 +1212,7 @@ class ExtensionDecl final : public GenericContext, public Decl,
12121212 friend class IterableDeclContext ;
12131213
12141214 ExtensionDecl (SourceLoc extensionLoc, TypeRepr *extendedType,
1215- MutableArrayRef <TypeLoc> inherited,
1215+ ArrayRef <TypeLoc> inherited,
12161216 DeclContext *parent,
12171217 TrailingWhereClause *trailingWhereClause);
12181218
@@ -1237,7 +1237,7 @@ class ExtensionDecl final : public GenericContext, public Decl,
12371237 // / Create a new extension declaration.
12381238 static ExtensionDecl *create (ASTContext &ctx, SourceLoc extensionLoc,
12391239 TypeRepr *extendedType,
1240- MutableArrayRef <TypeLoc> inherited,
1240+ ArrayRef <TypeLoc> inherited,
12411241 DeclContext *parent,
12421242 TrailingWhereClause *trailingWhereClause,
12431243 ClangNode clangNode = ClangNode());
@@ -1289,10 +1289,9 @@ class ExtensionDecl final : public GenericContext, public Decl,
12891289
12901290 // / Retrieve the set of protocols that this type inherits (i.e,
12911291 // / explicitly conforms to).
1292- MutableArrayRef<TypeLoc> getInherited () { return Inherited; }
12931292 ArrayRef<TypeLoc> getInherited () const { return Inherited; }
12941293
1295- void setInherited (MutableArrayRef <TypeLoc> i) { Inherited = i; }
1294+ void setInherited (ArrayRef <TypeLoc> i) { Inherited = i; }
12961295
12971296 bool hasDefaultAccessLevel () const {
12981297 return Bits.ExtensionDecl .DefaultAndMaxAccessLevel != 0 ;
@@ -2405,12 +2404,12 @@ class ValueDecl : public Decl {
24052404
24062405// / This is a common base class for declarations which declare a type.
24072406class TypeDecl : public ValueDecl {
2408- MutableArrayRef <TypeLoc> Inherited;
2407+ ArrayRef <TypeLoc> Inherited;
24092408
24102409protected:
24112410 TypeDecl (DeclKind K, llvm::PointerUnion<DeclContext *, ASTContext *> context,
24122411 Identifier name, SourceLoc NameLoc,
2413- MutableArrayRef <TypeLoc> inherited) :
2412+ ArrayRef <TypeLoc> inherited) :
24142413 ValueDecl (K, context, name, NameLoc), Inherited(inherited) {}
24152414
24162415public:
@@ -2428,10 +2427,9 @@ class TypeDecl : public ValueDecl {
24282427
24292428 // / Retrieve the set of protocols that this type inherits (i.e,
24302429 // / explicitly conforms to).
2431- MutableArrayRef<TypeLoc> getInherited () { return Inherited; }
24322430 ArrayRef<TypeLoc> getInherited () const { return Inherited; }
24332431
2434- void setInherited (MutableArrayRef <TypeLoc> i) { Inherited = i; }
2432+ void setInherited (ArrayRef <TypeLoc> i) { Inherited = i; }
24352433
24362434 static bool classof (const Decl *D) {
24372435 return D->getKind () >= DeclKind::First_TypeDecl &&
@@ -2456,7 +2454,7 @@ class GenericTypeDecl : public GenericContext, public TypeDecl {
24562454public:
24572455 GenericTypeDecl (DeclKind K, DeclContext *DC,
24582456 Identifier name, SourceLoc nameLoc,
2459- MutableArrayRef <TypeLoc> inherited,
2457+ ArrayRef <TypeLoc> inherited,
24602458 GenericParamList *GenericParams);
24612459
24622460 // Resolve ambiguity due to multiple base classes.
@@ -2982,7 +2980,7 @@ class NominalTypeDecl : public GenericTypeDecl, public IterableDeclContext {
29822980
29832981 NominalTypeDecl (DeclKind K, DeclContext *DC, Identifier name,
29842982 SourceLoc NameLoc,
2985- MutableArrayRef <TypeLoc> inherited,
2983+ ArrayRef <TypeLoc> inherited,
29862984 GenericParamList *GenericParams) :
29872985 GenericTypeDecl (K, DC, name, NameLoc, inherited, GenericParams),
29882986 IterableDeclContext (IterableDeclContextKind::NominalTypeDecl)
@@ -3224,34 +3222,14 @@ class EnumDecl final : public NominalTypeDecl {
32243222 // Is the complete set of raw values type checked?
32253223 HasFixedRawValuesAndTypes = 1 << 2 ,
32263224 };
3227-
3228- struct {
3229- // / The raw type and a bit to indicate whether the
3230- // / raw was computed yet or not.
3231- llvm::PointerIntPair<Type, 3 , OptionSet<SemanticInfoFlags>> RawTypeAndFlags;
3232-
3233- bool hasRawType () const {
3234- return RawTypeAndFlags.getInt ().contains (HasComputedRawType);
3235- }
3236- void cacheRawType (Type ty) {
3237- auto flags = RawTypeAndFlags.getInt () | HasComputedRawType;
3238- RawTypeAndFlags.setPointerAndInt (ty, flags);
3239- }
3240-
3241- bool hasFixedRawValues () const {
3242- return RawTypeAndFlags.getInt ().contains (HasFixedRawValues);
3243- }
3244- bool hasCheckedRawValues () const {
3245- return RawTypeAndFlags.getInt ().contains (HasFixedRawValuesAndTypes);
3246- }
3247- } LazySemanticInfo;
3225+ OptionSet<SemanticInfoFlags> SemanticFlags;
32483226
32493227 friend class EnumRawValuesRequest ;
32503228 friend class EnumRawTypeRequest ;
32513229
32523230public:
32533231 EnumDecl (SourceLoc EnumLoc, Identifier Name, SourceLoc NameLoc,
3254- MutableArrayRef <TypeLoc> Inherited,
3232+ ArrayRef <TypeLoc> Inherited,
32553233 GenericParamList *GenericParams, DeclContext *DC);
32563234
32573235 SourceLoc getStartLoc () const { return EnumLoc; }
@@ -3326,11 +3304,7 @@ class EnumDecl final : public NominalTypeDecl {
33263304 Type getRawType () const ;
33273305
33283306 // / Set the raw type of the enum from its inheritance clause.
3329- void setRawType (Type rawType) {
3330- auto flags = LazySemanticInfo.RawTypeAndFlags .getInt ();
3331- LazySemanticInfo.RawTypeAndFlags .setPointerAndInt (
3332- rawType, flags | HasComputedRawType);
3333- }
3307+ void setRawType (Type rawType);
33343308
33353309 // / True if none of the enum cases have associated values.
33363310 // /
@@ -3387,7 +3361,7 @@ class StructDecl final : public NominalTypeDecl {
33873361
33883362public:
33893363 StructDecl (SourceLoc StructLoc, Identifier Name, SourceLoc NameLoc,
3390- MutableArrayRef <TypeLoc> Inherited,
3364+ ArrayRef <TypeLoc> Inherited,
33913365 GenericParamList *GenericParams, DeclContext *DC);
33923366
33933367 SourceLoc getStartLoc () const { return StructLoc; }
@@ -3526,7 +3500,7 @@ class ClassDecl final : public NominalTypeDecl {
35263500
35273501public:
35283502 ClassDecl (SourceLoc ClassLoc, Identifier Name, SourceLoc NameLoc,
3529- MutableArrayRef <TypeLoc> Inherited,
3503+ ArrayRef <TypeLoc> Inherited,
35303504 GenericParamList *GenericParams, DeclContext *DC);
35313505
35323506 SourceLoc getStartLoc () const { return ClassLoc; }
@@ -3907,7 +3881,7 @@ class ProtocolDecl final : public NominalTypeDecl {
39073881
39083882public:
39093883 ProtocolDecl (DeclContext *DC, SourceLoc ProtocolLoc, SourceLoc NameLoc,
3910- Identifier Name, MutableArrayRef <TypeLoc> Inherited,
3884+ Identifier Name, ArrayRef <TypeLoc> Inherited,
39113885 TrailingWhereClause *TrailingWhere);
39123886
39133887 using Decl::getASTContext;
0 commit comments