Changeset acd80b4


Ignore:
Timestamp:
May 16, 2019, 4:56:56 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, 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

Location:
src/AST
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Expr.cpp

    r41b24c8 racd80b4  
    256256: Expr( loc, new BasicType{ BasicType::LongUnsignedInt } ), expr( nullptr ), type( t ) {}
    257257
    258 // --- UntypedOffsetofExpr
    259 
    260 UntypedOffsetofExpr::UntypedOffsetofExpr(
    261         const CodeLocation & loc, const Type * ty, const std::string & mem )
    262 : Expr( loc, new BasicType{ BasicType::LongUnsignedInt } ), type( ty ), member( mem ) {
    263         assert( type );
    264 }
    265 
    266258// --- OffsetofExpr
    267259
  • src/AST/Expr.hpp

    r41b24c8 racd80b4  
    2828
    2929// Must be included in *all* AST classes; should be #undef'd at the end of the file
    30 #define MUTATE_FRIEND template<typename node_t> friend auto mutate(const node_t * node);
     30#define MUTATE_FRIEND template<typename node_t> friend node_t * mutate(const node_t * node);
    3131
    3232namespace ast {
  • src/AST/Pass.impl.hpp

    r41b24c8 racd80b4  
    782782
    783783        VISIT(
    784                 maybe_accept( node, &TryStmt::block        );
    785                 maybe_accept( node, &TryStmt::handlers     );
    786                 maybe_accept( node, &TryStmt::finallyBlock );
     784                maybe_accept( node, &TryStmt::body     );
     785                maybe_accept( node, &TryStmt::handlers );
     786                maybe_accept( node, &TryStmt::finally  );
    787787        )
    788788
  • src/AST/Stmt.hpp

    r41b24c8 racd80b4  
    2727
    2828// Must be included in *all* AST classes; should be #undef'd at the end of the file
    29 #define MUTATE_FRIEND template<typename node_t> friend auto mutate(const node_t * node);
     29#define MUTATE_FRIEND template<typename node_t> friend node_t * mutate(const node_t * node);
    3030
    3131namespace ast {
  • 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        }
  • src/AST/Type.hpp

    r41b24c8 racd80b4  
    3030
    3131// Must be included in *all* AST classes; should be #undef'd at the end of the file
    32 #define MUTATE_FRIEND template<typename node_t> friend auto mutate(const node_t * node);
     32#define MUTATE_FRIEND template<typename node_t> friend node_t * mutate(const node_t * node);
    3333
    3434namespace ast {
  • src/AST/TypeSubstitution.hpp

    r41b24c8 racd80b4  
    189189}
    190190
    191 //=================================================================================================
    192 /// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency
    193 /// remove only if there is a better solution
    194 /// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with
    195 /// forward declarations
    196 inline void increment( const class TypeSubstitution * node, Node::ref_type ref ) { node->increment(ref); }
    197 inline void decrement( const class TypeSubstitution * node, Node::ref_type ref ) { node->decrement(ref); }
    198 
    199191} // namespace ast
    200192
Note: See TracChangeset for help on using the changeset viewer.