Changeset acd80b4 for src/AST/Type.cpp


Ignore:
Timestamp:
May 16, 2019, 4:56:56 PM (4 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
6f8e87d
Parents:
41b24c8
Message:

Fixed several compilation errors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Type.cpp

    r41b24c8 racd80b4  
    4242        const Type * t;
    4343        const ReferenceType * r;
    44         for ( t = this; (r = dynamic_cast<const ReferenceType *>() ); t = r->base );
     44        for ( t = this; (r = dynamic_cast<const ReferenceType *>(t) ); t = r->base );
    4545        return t;
    4646}
     
    103103
    104104bool FunctionType::isTtype() const {
    105         return containsTtype( returnVals ) || containsTtype( parameters );
     105        return containsTtype( returns ) || containsTtype( params );
    106106}
    107107
     
    109109std::vector<readonly<Decl>> ReferenceToType::lookup( const std::string& name ) const {
    110110        assertf( aggr(), "Must have aggregate to perform lookup" );
    111        
     111
    112112        std::vector<readonly<Decl>> found;
    113113        for ( const Decl * decl : aggr()->members ) {
     
    119119// --- StructInstType
    120120
    121 StructInstType::StructInstType( const StructDecl * b, CV::Qualifiers q = {},
    122         std::vector<ptr<Attribute>>&& as = {} )
     121StructInstType::StructInstType( const StructDecl * b, CV::Qualifiers q,
     122        std::vector<ptr<Attribute>>&& as )
    123123: ReferenceToType( b->name, q, std::move(as) ), base( b ) {}
    124124
     
    127127// --- UnionInstType
    128128
    129 UnionInstType::UnionInstType( const UnionDecl * b, CV::Qualifiers q = {},
    130         std::vector<ptr<Attribute>>&& as = {} )
     129UnionInstType::UnionInstType( const UnionDecl * b, CV::Qualifiers q,
     130        std::vector<ptr<Attribute>>&& as )
    131131: ReferenceToType( b->name, q, std::move(as) ), base( b ) {}
    132132
     
    135135// --- EnumInstType
    136136
    137 EnumInstType::EnumInstType( const EnumDecl * b, CV::Qualifiers q = {},
    138         std::vector<ptr<Attribute>>&& as = {} )
     137EnumInstType::EnumInstType( const EnumDecl * b, CV::Qualifiers q,
     138        std::vector<ptr<Attribute>>&& as )
    139139: ReferenceToType( b->name, q, std::move(as) ), base( b ) {}
    140140
     
    152152// --- TupleType
    153153
    154 TupleType::TupleType( std::vector<ptr<Type>> && ts, CV::Qualifiers q = {} )
     154TupleType::TupleType( std::vector<ptr<Type>> && ts, CV::Qualifiers q )
    155155: Type( q ), types( std::move(ts) ), members() {
    156         // This constructor is awkward. `TupleType` needs to contain objects so that members can be 
    157         // named, but members without initializer nodes end up getting constructors, which breaks 
    158         // things. This happens because the object decls have to be visited so that their types are 
    159         // kept in sync with the types listed here. Ultimately, the types listed here should perhaps 
    160         // be eliminated and replaced with a list-view over members. The temporary solution is to 
    161         // make a `ListInit` with `maybeConstructed = false`, so when the object is visited it is not 
     156        // This constructor is awkward. `TupleType` needs to contain objects so that members can be
     157        // named, but members without initializer nodes end up getting constructors, which breaks
     158        // things. This happens because the object decls have to be visited so that their types are
     159        // kept in sync with the types listed here. Ultimately, the types listed here should perhaps
     160        // be eliminated and replaced with a list-view over members. The temporary solution is to
     161        // make a `ListInit` with `maybeConstructed = false`, so when the object is visited it is not
    162162        // constructed. Potential better solutions include:
    163         //   a) Separate `TupleType` from its declarations, into `TupleDecl` and `Tuple{Inst?}Type`, 
     163        //   a) Separate `TupleType` from its declarations, into `TupleDecl` and `Tuple{Inst?}Type`,
    164164        //      similar to the aggregate types.
    165         //   b) Separate initializer nodes better, e.g. add a `MaybeConstructed` node that is replaced 
     165        //   b) Separate initializer nodes better, e.g. add a `MaybeConstructed` node that is replaced
    166166        //      by `genInit`, rather than the current boolean flag.
    167167        members.reserve( types.size() );
    168168        for ( const Type * ty : types ) {
    169169                members.emplace_back( new ObjectDecl{
    170                         CodeLocation{}, "", ty, new ListInit( CodeLocation{}, {}, {}, MaybeConstruct ), 
     170                        CodeLocation{}, "", ty, new ListInit( CodeLocation{}, {}, {}, MaybeConstruct ),
    171171                        Storage::Classes{}, Linkage::Cforall } );
    172172        }
Note: See TracChangeset for help on using the changeset viewer.