Changeset acd80b4
- Timestamp:
- May 16, 2019, 4:56:56 PM (6 years ago)
- 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
- Location:
- src/AST
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/AST/Expr.cpp ¶
r41b24c8 racd80b4 256 256 : Expr( loc, new BasicType{ BasicType::LongUnsignedInt } ), expr( nullptr ), type( t ) {} 257 257 258 // --- UntypedOffsetofExpr259 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 266 258 // --- OffsetofExpr 267 259 -
TabularUnified src/AST/Expr.hpp ¶
r41b24c8 racd80b4 28 28 29 29 // 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 automutate(const node_t * node);30 #define MUTATE_FRIEND template<typename node_t> friend node_t * mutate(const node_t * node); 31 31 32 32 namespace ast { -
TabularUnified src/AST/Pass.impl.hpp ¶
r41b24c8 racd80b4 782 782 783 783 VISIT( 784 maybe_accept( node, &TryStmt::b lock);785 maybe_accept( node, &TryStmt::handlers 786 maybe_accept( node, &TryStmt::finally Block);784 maybe_accept( node, &TryStmt::body ); 785 maybe_accept( node, &TryStmt::handlers ); 786 maybe_accept( node, &TryStmt::finally ); 787 787 ) 788 788 -
TabularUnified src/AST/Stmt.hpp ¶
r41b24c8 racd80b4 27 27 28 28 // 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 automutate(const node_t * node);29 #define MUTATE_FRIEND template<typename node_t> friend node_t * mutate(const node_t * node); 30 30 31 31 namespace ast { -
TabularUnified src/AST/Type.cpp ¶
r41b24c8 racd80b4 42 42 const Type * t; 43 43 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 ); 45 45 return t; 46 46 } … … 103 103 104 104 bool FunctionType::isTtype() const { 105 return containsTtype( return Vals ) || containsTtype( parameters );105 return containsTtype( returns ) || containsTtype( params ); 106 106 } 107 107 … … 109 109 std::vector<readonly<Decl>> ReferenceToType::lookup( const std::string& name ) const { 110 110 assertf( aggr(), "Must have aggregate to perform lookup" ); 111 111 112 112 std::vector<readonly<Decl>> found; 113 113 for ( const Decl * decl : aggr()->members ) { … … 119 119 // --- StructInstType 120 120 121 StructInstType::StructInstType( const StructDecl * b, CV::Qualifiers q = {},122 std::vector<ptr<Attribute>>&& as = {})121 StructInstType::StructInstType( const StructDecl * b, CV::Qualifiers q, 122 std::vector<ptr<Attribute>>&& as ) 123 123 : ReferenceToType( b->name, q, std::move(as) ), base( b ) {} 124 124 … … 127 127 // --- UnionInstType 128 128 129 UnionInstType::UnionInstType( const UnionDecl * b, CV::Qualifiers q = {},130 std::vector<ptr<Attribute>>&& as = {})129 UnionInstType::UnionInstType( const UnionDecl * b, CV::Qualifiers q, 130 std::vector<ptr<Attribute>>&& as ) 131 131 : ReferenceToType( b->name, q, std::move(as) ), base( b ) {} 132 132 … … 135 135 // --- EnumInstType 136 136 137 EnumInstType::EnumInstType( const EnumDecl * b, CV::Qualifiers q = {},138 std::vector<ptr<Attribute>>&& as = {})137 EnumInstType::EnumInstType( const EnumDecl * b, CV::Qualifiers q, 138 std::vector<ptr<Attribute>>&& as ) 139 139 : ReferenceToType( b->name, q, std::move(as) ), base( b ) {} 140 140 … … 152 152 // --- TupleType 153 153 154 TupleType::TupleType( std::vector<ptr<Type>> && ts, CV::Qualifiers q = {})154 TupleType::TupleType( std::vector<ptr<Type>> && ts, CV::Qualifiers q ) 155 155 : 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 162 162 // 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`, 164 164 // 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 166 166 // by `genInit`, rather than the current boolean flag. 167 167 members.reserve( types.size() ); 168 168 for ( const Type * ty : types ) { 169 169 members.emplace_back( new ObjectDecl{ 170 CodeLocation{}, "", ty, new ListInit( CodeLocation{}, {}, {}, MaybeConstruct ), 170 CodeLocation{}, "", ty, new ListInit( CodeLocation{}, {}, {}, MaybeConstruct ), 171 171 Storage::Classes{}, Linkage::Cforall } ); 172 172 } -
TabularUnified src/AST/Type.hpp ¶
r41b24c8 racd80b4 30 30 31 31 // 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 automutate(const node_t * node);32 #define MUTATE_FRIEND template<typename node_t> friend node_t * mutate(const node_t * node); 33 33 34 34 namespace ast { -
TabularUnified src/AST/TypeSubstitution.hpp ¶
r41b24c8 racd80b4 189 189 } 190 190 191 //=================================================================================================192 /// This disgusting and giant piece of boiler-plate is here to solve a cyclic dependency193 /// remove only if there is a better solution194 /// The problem is that ast::ptr< ... > uses increment/decrement which won't work well with195 /// forward declarations196 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 199 191 } // namespace ast 200 192
Note: See TracChangeset
for help on using the changeset viewer.