Skip to content

Commit c1a2161

Browse files
committed
AST: Remove unnecessary field from ValueDecl
Now that getType() is gone, the pointer part of TypeAndAccess wasn't used. Stick InterfaceTy there, saving a word of storage.
1 parent 705da29 commit c1a2161

File tree

2 files changed

+5
-8
lines changed

2 files changed

+5
-8
lines changed

include/swift/AST/Decl.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1943,9 +1943,6 @@ class ValueDecl : public Decl {
19431943
ValueDeclBits.CheckedRedeclaration = false;
19441944
}
19451945

1946-
/// The interface type, mutable because some subclasses compute this lazily.
1947-
mutable Type InterfaceTy;
1948-
19491946
public:
19501947
/// \brief Return true if this is a definition of a decl, not a forward
19511948
/// declaration (e.g. of a function) that is implemented outside of the

lib/AST/Decl.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1645,12 +1645,12 @@ ValueDecl::getSatisfiedProtocolRequirements(bool Sorted) const {
16451645
}
16461646

16471647
bool ValueDecl::hasInterfaceType() const {
1648-
return !!InterfaceTy;
1648+
return !TypeAndAccess.getPointer().isNull();
16491649
}
16501650

16511651
Type ValueDecl::getInterfaceType() const {
1652-
assert(InterfaceTy && "No interface type was set");
1653-
return InterfaceTy;
1652+
assert(hasInterfaceType() && "No interface type was set");
1653+
return TypeAndAccess.getPointer();
16541654
}
16551655

16561656
void ValueDecl::setInterfaceType(Type type) {
@@ -1668,8 +1668,8 @@ void ValueDecl::setInterfaceType(Type type) {
16681668
assert(!type->hasTypeVariable() &&
16691669
"Archetype in interface type");
16701670
}
1671-
1672-
InterfaceTy = type;
1671+
1672+
TypeAndAccess.setPointer(type);
16731673
}
16741674

16751675
Optional<ObjCSelector> ValueDecl::getObjCRuntimeName() const {

0 commit comments

Comments
 (0)