@@ -74,6 +74,30 @@ void UnderlyingTypeDeclsReferencedRequest::noteCycleStep(
7474// ----------------------------------------------------------------------------//
7575// Superclass declaration computation.
7676// ----------------------------------------------------------------------------//
77+ Optional<ClassDecl *> SuperclassDeclRequest::getCachedResult () const {
78+ auto nominalDecl = std::get<0 >(getStorage ());
79+
80+ if (auto *classDecl = dyn_cast<ClassDecl>(nominalDecl))
81+ if (classDecl->LazySemanticInfo .SuperclassDecl .getInt ())
82+ return classDecl->LazySemanticInfo .SuperclassDecl .getPointer ();
83+
84+ if (auto *protocolDecl = dyn_cast<ProtocolDecl>(nominalDecl))
85+ if (protocolDecl->LazySemanticInfo .SuperclassDecl .getInt ())
86+ return protocolDecl->LazySemanticInfo .SuperclassDecl .getPointer ();
87+
88+ return None;
89+ }
90+
91+ void SuperclassDeclRequest::cacheResult (ClassDecl *value) const {
92+ auto nominalDecl = std::get<0 >(getStorage ());
93+
94+ if (auto *classDecl = dyn_cast<ClassDecl>(nominalDecl))
95+ classDecl->LazySemanticInfo .SuperclassDecl .setPointerAndInt (value, true );
96+
97+ if (auto *protocolDecl = dyn_cast<ProtocolDecl>(nominalDecl))
98+ protocolDecl->LazySemanticInfo .SuperclassDecl .setPointerAndInt (value, true );
99+ }
100+
77101void SuperclassDeclRequest::diagnoseCycle (DiagnosticEngine &diags) const {
78102 // FIXME: Improve this diagnostic.
79103 auto subjectDecl = std::get<0 >(getStorage ());
@@ -87,7 +111,7 @@ void SuperclassDeclRequest::noteCycleStep(DiagnosticEngine &diags) const {
87111}
88112
89113// ----------------------------------------------------------------------------//
90- // Superclass declaration computation.
114+ // Extended nominal computation.
91115// ----------------------------------------------------------------------------//
92116Optional<NominalTypeDecl *> ExtendedNominalRequest::getCachedResult () const {
93117 // Note: if we fail to compute any nominal declaration, it's considered
0 commit comments