@@ -3366,6 +3366,22 @@ ResolveTypeEraserTypeRequest::evaluate(Evaluator &evaluator,
33663366 }
33673367}
33683368
3369+ Type
3370+ ResolveRawLayoutLikeTypeRequest::evaluate (Evaluator &evaluator,
3371+ StructDecl *sd,
3372+ RawLayoutAttr *attr) const {
3373+ assert (attr->LikeType );
3374+ // Resolve the like type in the struct's context.
3375+ return TypeResolution::resolveContextualType (
3376+ attr->LikeType , sd, llvm::None,
3377+ // Unbound generics and placeholders
3378+ // are not allowed within this
3379+ // attribute.
3380+ /* unboundTyOpener*/ nullptr ,
3381+ /* placeholderHandler*/ nullptr ,
3382+ /* packElementOpener*/ nullptr );
3383+ }
3384+
33693385bool
33703386TypeEraserHasViableInitRequest::evaluate (Evaluator &evaluator,
33713387 TypeEraserAttr *attr,
@@ -7195,30 +7211,10 @@ void AttributeChecker::visitRawLayoutAttr(RawLayoutAttr *attr) {
71957211 diagnoseAndRemoveAttr (attr, diag::alignment_not_power_of_two);
71967212 return ;
71977213 }
7198- } else if (auto likeType = attr->getScalarLikeType ()) {
7199- // Resolve the like type in the struct's context.
7200- auto resolvedType = TypeResolution::resolveContextualType (
7201- likeType, sd, llvm::None,
7202- // Unbound generics and placeholders
7203- // are not allowed within this
7204- // attribute.
7205- /* unboundTyOpener*/ nullptr ,
7206- /* placeholderHandler*/ nullptr ,
7207- /* packElementOpener*/ nullptr );
7208-
7209- attr->setResolvedLikeType (resolvedType);
7210- } else if (auto arrayType = attr->getArrayLikeTypeAndCount ()) {
7211- // Resolve the like type in the struct's context.
7212- auto resolvedType = TypeResolution::resolveContextualType (
7213- arrayType->first , sd, llvm::None,
7214- // Unbound generics and placeholders
7215- // are not allowed within this
7216- // attribute.
7217- /* unboundTyOpener*/ nullptr ,
7218- /* placeholderHandler*/ nullptr ,
7219- /* packElementOpener*/ nullptr );
7220-
7221- attr->setResolvedLikeType (resolvedType);
7214+ } else if (attr->getScalarLikeType ()) {
7215+ (void )attr->getResolvedLikeType (sd);
7216+ } else if (attr->getArrayLikeTypeAndCount ()) {
7217+ (void )attr->getResolvedLikeType (sd);
72227218 } else {
72237219 llvm_unreachable (" new unhandled rawLayout attribute form?" );
72247220 }
0 commit comments