Changes in / [21a44ca:94b1f718]
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r21a44ca r94b1f718 10 10 // Created On : Thu May 09 15::37::05 2019 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : T hu May 23 16:59:00 201913 // Update Count : 612 // Last Modified On : Tue May 21 15:30:00 2019 13 // Update Count : 5 14 14 // 15 15 … … 121 121 const ast::DeclWithType * declWithTypePostamble ( 122 122 DeclarationWithType * decl, const ast::DeclWithType * node ) { 123 cache.emplace( node, decl);123 declPostamble( decl, node ); 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 declPostamble( decl, node);130 cache.emplace( node, decl ); 131 131 return nullptr; 132 132 } … … 162 162 } 163 163 164 // NamedTypeDecl 164 165 const ast::Decl * namedTypePostamble( NamedTypeDecl * decl, const ast::NamedTypeDecl * node ) { 166 declPostamble( decl, node ); 165 167 // base comes from constructor 166 168 decl->parameters = get<TypeDecl>().acceptL( node->params ); 167 169 decl->assertions = get<DeclarationWithType>().acceptL( node->assertions ); 168 declPostamble( decl, node );169 170 return nullptr; 170 171 } … … 196 197 197 198 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 declPostamble( decl, node);204 cache.emplace( node, decl ); 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 );266 265 stmt->location = node->location; 267 266 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( nullptr ); 282 cache.emplace( node, stmt ); 283 stmt->expr = get<Expression>().accept1( node->expr ); 281 auto stmt = new ExprStmt( get<Expression>().accept1( node->expr ) ); 284 282 return stmtPostamble( stmt, node ); 285 283 } … … 510 508 TypeSubstitution * convertTypeSubstitution(const ast::TypeSubstitution * src) { 511 509 512 if (!src) return nullptr;513 514 510 TypeSubstitution *rslt = new TypeSubstitution(); 515 511 … … 1872 1868 virtual void visit( ImplicitCtorDtorStmt * old ) override final { 1873 1869 if ( inCache( old ) ) return; 1874 auto stmt= new ast::ImplicitCtorDtorStmt(1875 old->location, 1876 nullptr,1870 this->node = new ast::ImplicitCtorDtorStmt( 1871 old->location, 1872 GET_ACCEPT_1(callStmt, Stmt), 1877 1873 GET_LABELS_V(old->labels) 1878 1874 ); 1879 this->node = stmt;1880 1875 cache.emplace( old, this->node ); 1881 stmt->callStmt = GET_ACCEPT_1(callStmt, Stmt);1882 1876 } 1883 1877 -
src/AST/Node.hpp
r21a44ca r94b1f718 10 10 // Created On : Wed May 8 10:27:04 2019 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu May 23 16:00:00 201913 // Update Count : 412 // Last Modified On : Wed May 15 16:02:00 2019 13 // Update Count : 3 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 119 111 template< enum Node::ref_type o_ref_t > 120 112 ptr_base( const ptr_base<node_t, o_ref_t> & o ) : node(o.node) { … … 130 122 ptr_base & operator=( const o_node_t * node ) { 131 123 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);142 124 return *this; 143 125 } -
src/include/cassert
r21a44ca r94b1f718 9 9 // Author : Peter A. Buhr 10 10 // Created On : Thu Aug 18 13:19:26 2016 11 // Last Modified By : Andrew Beach12 // Last Modified On : T hu May 23 15:30:00201713 // Update Count : 1 711 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Aug 1 11:56:01 2017 13 // Update Count : 16 14 14 // 15 15 … … 43 43 #endif 44 44 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 } 45 template<typename T, typename U> 46 static inline __attribute__((nonnull)) T strict_dynamic_cast( const U & src ) { 52 47 assert(src); 53 48 T ret = dynamic_cast<T>(src);
Note: See TracChangeset
for help on using the changeset viewer.