Changeset acd80b4 for src/AST/Type.cpp
- Timestamp:
- May 16, 2019, 4:56:56 PM (4 years ago)
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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 }
Note: See TracChangeset
for help on using the changeset viewer.