Changeset 97f8f0f for src/GenPoly


Ignore:
Timestamp:
Aug 12, 2024, 6:47:39 PM (44 hours ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
dee680c
Parents:
8492b85
Message:

Implemented special case of sizeof/alignof, where reference types are ignored for these operations.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Lvalue.cpp

    r8492b85 r97f8f0f  
    1010// Created On       : Thu Sep 15 14:08:00 2022
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Wed Oct  6  9:59:00 2022
    13 // Update Count     : 0
     12// Last Modified On : Mon Aug 12 18:07:00 2024
     13// Update Count     : 1
    1414//
    1515
     
    119119/// Replace all reference types with pointer types.
    120120struct ReferenceTypeElimination final {
     121        ast::SizeofExpr const * previsit( ast::SizeofExpr const * expr );
     122        ast::AlignofExpr const * previsit( ast::AlignofExpr const * expr );
    121123        ast::Type const * postvisit( ast::ReferenceType const * type );
    122124};
     
    603605}
    604606
     607ast::SizeofExpr const * ReferenceTypeElimination::previsit(
     608                ast::SizeofExpr const * expr ) {
     609        if ( expr->expr ) return expr;
     610        return ast::mutate_field( expr, &ast::SizeofExpr::type,
     611                expr->type->stripReferences() );
     612}
     613
     614ast::AlignofExpr const * ReferenceTypeElimination::previsit(
     615                ast::AlignofExpr const * expr ) {
     616        if ( expr->expr ) return expr;
     617        return ast::mutate_field( expr, &ast::AlignofExpr::type,
     618                expr->type->stripReferences() );
     619}
     620
    605621ast::Type const * ReferenceTypeElimination::postvisit(
    606622                ast::ReferenceType const * type ) {
Note: See TracChangeset for help on using the changeset viewer.