Changeset b6f2e7ab for src/AST/Util.cpp


Ignore:
Timestamp:
Sep 9, 2024, 5:15:32 PM (2 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
f5dbc8d
Parents:
5c6d439
Message:

Removed SizeofExpr::expr and AlignofExpr::expr, expressions that would be stored there are wrapped in TypeofType? and stored in the type field. Some special cases to hide the typeof in code generation were added. In addition, initializer length is calculated in more cases so that the full type of more arrays is known sooner. Other than that, most of the code changes were just stripping out the conditional code and checks no longer needed. Some tests had to be updated, because the typeof is not hidden in dumps and the resolver replaces known typeof expressions with the type. The extension case caused some concern but it appears that just hides warnings in the expression which no longer exists.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Util.cpp

    r5c6d439 rb6f2e7ab  
    104104        }
    105105        assertf( false, "Member not found." );
    106 }
    107 
    108 template<typename node_t>
    109 void oneOfExprOrType( const node_t * node ) {
    110         if ( node->expr ) {
    111                 assertf( node->expr && !node->type, "Exactly one of expr or type should be set." );
    112         } else {
    113                 assertf( !node->expr && node->type, "Exactly one of expr or type should be set." );
    114         }
    115106}
    116107
     
    163154        void previsit( const SizeofExpr * node ) {
    164155                previsit( (const ParseNode *)node );
    165                 oneOfExprOrType( node );
    166156        }
    167157
    168158        void previsit( const AlignofExpr * node ) {
    169159                previsit( (const ParseNode *)node );
    170                 oneOfExprOrType( node );
    171160        }
    172161
Note: See TracChangeset for help on using the changeset viewer.