Changeset 17fa94f for src/AST/Expr.cpp


Ignore:
Timestamp:
Feb 11, 2025, 11:24:07 AM (12 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
691bf0a
Parents:
3e5e32cf
Message:

Reworked some nodes so they can be typed or untyped. This allowed me to remove TranslationDeps as the type information is only needed in the candidate finder, which can easily insert it.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Expr.cpp

    r3e5e32cf r17fa94f  
    281281// --- SizeofExpr
    282282
    283 SizeofExpr::SizeofExpr( const CodeLocation & loc, const Type * t )
    284 : Expr( loc, ast::TranslationDeps::getSizeType() ), type( t ) {}
     283SizeofExpr::SizeofExpr( const CodeLocation & loc, const Type * type )
     284: SizeofExpr( loc, type, nullptr ) {}
     285
     286SizeofExpr::SizeofExpr( const CodeLocation & loc, const Type * type, const Type * result )
     287: Expr( loc, result ), type( type ) {}
    285288
    286289// --- AlignofExpr
    287290
    288 AlignofExpr::AlignofExpr( const CodeLocation & loc, const Type * t )
    289 : Expr( loc, ast::TranslationDeps::getSizeType() ), type( t ) {}
     291AlignofExpr::AlignofExpr( const CodeLocation & loc, const Type * type )
     292: AlignofExpr( loc, type, nullptr ) {}
     293
     294AlignofExpr::AlignofExpr( const CodeLocation & loc, const Type * type, const Type * result )
     295: Expr( loc, result ), type( type ) {}
    290296
    291297// --- CountofExpr
    292298
    293299CountofExpr::CountofExpr( const CodeLocation & loc, const Type * t )
    294 : Expr( loc, ast::TranslationDeps::getSizeType() ), type( t ) {}
     300: Expr( loc ), type( t ) {}
    295301
    296302// --- OffsetofExpr
    297303
    298304OffsetofExpr::OffsetofExpr( const CodeLocation & loc, const Type * ty, const DeclWithType * mem )
    299 : Expr( loc, ast::TranslationDeps::getSizeType() ), type( ty ), member( mem ) {
     305: OffsetofExpr( loc, ty, mem, nullptr ) {}
     306
     307OffsetofExpr::OffsetofExpr( const CodeLocation & loc, const Type * ty, const DeclWithType * mem, const Type * res )
     308: Expr( loc, res ), type( ty ), member( mem ) {
    300309        assert( type );
    301310        assert( member );
     
    305314
    306315OffsetPackExpr::OffsetPackExpr( const CodeLocation & loc, const StructInstType * ty )
    307 : Expr( loc, new ArrayType{
    308         ast::TranslationDeps::getSizeType(), nullptr, FixedLen, DynamicDim }
    309 ), type( ty ) {
     316: Expr( loc ), type( ty ) {
    310317        assert( type );
    311318}
Note: See TracChangeset for help on using the changeset viewer.