Changeset b6f2e7ab for src/CodeGen


Ignore:
Timestamp:
Sep 9, 2024, 5:15:32 PM (8 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
  • TabularUnified src/CodeGen/CodeGenerator.cpp

    r5c6d439 rb6f2e7ab  
    744744        extension( expr );
    745745        output << "sizeof(";
    746         if ( expr->type ) {
     746        if ( auto type = expr->type.as<ast::TypeofType>() ) {
     747                type->expr->accept( *visitor );
     748        } else {
    747749                output << genType( expr->type, "", options );
    748         } else {
    749                 expr->expr->accept( *visitor );
    750750        }
    751751        output << ")";
     
    756756        extension( expr );
    757757        output << "__alignof__(";
    758         if ( expr->type ) {
     758        if ( auto type = expr->type.as<ast::TypeofType>() ) {
     759                type->expr->accept( *visitor );
     760        } else {
    759761                output << genType( expr->type, "", options );
    760         } else {
    761                 expr->expr->accept( *visitor );
    762762        }
    763763        output << ")";
Note: See TracChangeset for help on using the changeset viewer.