Changes in / [94b1f718:21a44ca]
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r94b1f718 r21a44ca 10 10 // Created On : Thu May 09 15::37::05 2019 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : T ue May 21 15:30:00 201913 // Update Count : 512 // Last Modified On : Thu May 23 16:59:00 2019 13 // Update Count : 6 14 14 // 15 15 … … 121 121 const ast::DeclWithType * declWithTypePostamble ( 122 122 DeclarationWithType * decl, const ast::DeclWithType * node ) { 123 declPostamble( decl, node);123 cache.emplace( node, decl ); 124 124 decl->mangleName = node->mangleName; 125 125 decl->scopeLevel = node->scopeLevel; … … 128 128 decl->isDeleted = node->isDeleted; 129 129 // fs comes from constructor 130 cache.emplace( node, decl);130 declPostamble( decl, node ); 131 131 return nullptr; 132 132 } … … 162 162 } 163 163 164 // NamedTypeDecl165 164 const ast::Decl * namedTypePostamble( NamedTypeDecl * decl, const ast::NamedTypeDecl * node ) { 166 declPostamble( decl, node );167 165 // base comes from constructor 168 166 decl->parameters = get<TypeDecl>().acceptL( node->params ); 169 167 decl->assertions = get<DeclarationWithType>().acceptL( node->assertions ); 168 declPostamble( decl, node ); 170 169 return nullptr; 171 170 } … … 197 196 198 197 const ast::Decl * aggregatePostamble( AggregateDecl * decl, const ast::AggregateDecl * node ) { 198 cache.emplace( node, decl ); 199 199 decl->members = get<Declaration>().acceptL( node->members ); 200 200 decl->parameters = get<TypeDecl>().acceptL( node->params ); … … 202 202 // attributes come from constructor 203 203 decl->parent = get<AggregateDecl>().accept1( node->parent ); 204 cache.emplace( node, decl);204 declPostamble( decl, node ); 205 205 return nullptr; 206 206 } … … 263 263 264 264 const ast::Stmt * stmtPostamble( Statement * stmt, const ast::Stmt * node ) { 265 cache.emplace( node, stmt ); 265 266 stmt->location = node->location; 266 267 stmt->labels = makeLabelL( stmt, node->labels ); 267 cache.emplace( node, stmt );268 268 this->node = stmt; 269 269 return nullptr; … … 279 279 const ast::Stmt * visit( const ast::ExprStmt * node ) override final { 280 280 if ( inCache( node ) ) return nullptr; 281 auto stmt = new ExprStmt( get<Expression>().accept1( node->expr ) ); 281 auto stmt = new ExprStmt( nullptr ); 282 cache.emplace( node, stmt ); 283 stmt->expr = get<Expression>().accept1( node->expr ); 282 284 return stmtPostamble( stmt, node ); 283 285 } … … 508 510 TypeSubstitution * convertTypeSubstitution(const ast::TypeSubstitution * src) { 509 511 512 if (!src) return nullptr; 513 510 514 TypeSubstitution *rslt = new TypeSubstitution(); 511 515 … … 1868 1872 virtual void visit( ImplicitCtorDtorStmt * old ) override final { 1869 1873 if ( inCache( old ) ) return; 1870 this->node= new ast::ImplicitCtorDtorStmt(1871 old->location, 1872 GET_ACCEPT_1(callStmt, Stmt),1874 auto stmt = new ast::ImplicitCtorDtorStmt( 1875 old->location, 1876 nullptr, 1873 1877 GET_LABELS_V(old->labels) 1874 1878 ); 1879 this->node = stmt; 1875 1880 cache.emplace( old, this->node ); 1881 stmt->callStmt = GET_ACCEPT_1(callStmt, Stmt); 1876 1882 } 1877 1883 -
src/AST/Node.hpp
r94b1f718 r21a44ca 10 10 // Created On : Wed May 8 10:27:04 2019 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed May 15 16:02:00 201913 // Update Count : 312 // Last Modified On : Thu May 23 16:00:00 2019 13 // Update Count : 4 14 14 // 15 15 … … 109 109 ~ptr_base() { if( node ) _dec(node); } 110 110 111 ptr_base( const ptr_base & o ) : node(o.node) { 112 if( node ) _inc(node); 113 } 114 115 ptr_base( ptr_base && o ) : node(o.node) { 116 if( node ) _inc(node); 117 } 118 111 119 template< enum Node::ref_type o_ref_t > 112 120 ptr_base( const ptr_base<node_t, o_ref_t> & o ) : node(o.node) { … … 122 130 ptr_base & operator=( const o_node_t * node ) { 123 131 assign( node ? strict_dynamic_cast<const node_t *>(node) : nullptr ); 132 return *this; 133 } 134 135 ptr_base & operator=( const ptr_base & o ) { 136 assign(o.node); 137 return *this; 138 } 139 140 ptr_base & operator=( ptr_base && o ) { 141 assign(o.node); 124 142 return *this; 125 143 } -
src/include/cassert
r94b1f718 r21a44ca 9 9 // Author : Peter A. Buhr 10 10 // Created On : Thu Aug 18 13:19:26 2016 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : T ue Aug 1 11:56:01201713 // Update Count : 1 611 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu May 23 15:30:00 2017 13 // Update Count : 17 14 14 // 15 15 … … 43 43 #endif 44 44 45 template<typename T, typename U> 46 static inline __attribute__((nonnull)) T strict_dynamic_cast( const U & src ) { 45 enum StrictAllowNull {NonNull, AllowNull}; 46 47 template<typename T, StrictAllowNull nullable = NonNull, typename U> 48 static inline T strict_dynamic_cast( const U & src ) { 49 if (nullable == AllowNull && src == nullptr) { 50 return nullptr; 51 } 47 52 assert(src); 48 53 T ret = dynamic_cast<T>(src);
Note: See TracChangeset
for help on using the changeset viewer.