Changeset 4c925cd for src/SymTab
- Timestamp:
- Aug 14, 2020, 11:40:04 AM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
- Children:
- 5715d43, fa5e0112
- Parents:
- 309d814 (diff), badd22f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- src/SymTab
- Files:
-
- 3 edited
-
Autogen.h (modified) (5 diffs)
-
FixFunction.cc (modified) (4 diffs)
-
Mangler.cc (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Autogen.h
r309d814 r4c925cd 21 21 22 22 #include "AST/Decl.hpp" 23 #include "AST/Eval.hpp" 23 24 #include "AST/Expr.hpp" 24 25 #include "AST/Init.hpp" … … 265 266 } 266 267 267 ast::ptr< ast::Expr > begin, end, cmp, update; 268 ast::ptr< ast::Expr > begin, end; 269 std::string cmp, update; 268 270 269 271 if ( forward ) { … … 271 273 begin = ast::ConstantExpr::from_int( loc, 0 ); 272 274 end = array->dimension; 273 cmp = new ast::NameExpr{ loc, "?<?" };274 update = new ast::NameExpr{ loc, "++?" };275 cmp = "?<?"; 276 update = "++?"; 275 277 } else { 276 278 // generate: for ( int i = N-1; i >= 0; --i ) 277 begin = new ast::UntypedExpr{ 278 loc, new ast::NameExpr{ loc, "?-?" }, 279 { array->dimension, ast::ConstantExpr::from_int( loc, 1 ) } }; 279 begin = ast::call( 280 loc, "?-?", array->dimension, ast::ConstantExpr::from_int( loc, 1 ) ); 280 281 end = ast::ConstantExpr::from_int( loc, 0 ); 281 cmp = new ast::NameExpr{ loc, "?>=?" };282 update = new ast::NameExpr{ loc, "--?" };282 cmp = "?>=?"; 283 update = "--?"; 283 284 } 284 285 … … 286 287 loc, indexName.newName(), new ast::BasicType{ ast::BasicType::SignedInt }, 287 288 new ast::SingleInit{ loc, begin } }; 288 289 ast::ptr< ast::Expr > cond = new ast::UntypedExpr{ 290 loc, cmp, { new ast::VariableExpr{ loc, index }, end } }; 291 292 ast::ptr< ast::Expr > inc = new ast::UntypedExpr{ 293 loc, update, { new ast::VariableExpr{ loc, index } } }; 294 295 ast::ptr< ast::Expr > dstIndex = new ast::UntypedExpr{ 296 loc, new ast::NameExpr{ loc, "?[?]" }, 297 { dstParam, new ast::VariableExpr{ loc, index } } }; 289 ast::ptr< ast::Expr > indexVar = new ast::VariableExpr{ loc, index }; 290 291 ast::ptr< ast::Expr > cond = ast::call( loc, cmp, indexVar, end ); 292 293 ast::ptr< ast::Expr > inc = ast::call( loc, update, indexVar ); 294 295 ast::ptr< ast::Expr > dstIndex = ast::call( loc, "?[?]", dstParam, indexVar ); 298 296 299 297 // srcParam must keep track of the array indices to build the source parameter and/or 300 298 // array list initializer 301 srcParam.addArrayIndex( new ast::VariableExpr{ loc, index }, array->dimension );299 srcParam.addArrayIndex( indexVar, array->dimension ); 302 300 303 301 // for stmt's body, eventually containing call … … 385 383 if ( isUnnamedBitfield( obj ) ) return {}; 386 384 387 ast::ptr< ast::Type > addCast = nullptr;385 ast::ptr< ast::Type > addCast; 388 386 if ( (fname == "?{}" || fname == "^?{}") && ( ! obj || ( obj && ! obj->bitfieldWidth ) ) ) { 389 387 assert( dstParam->result ); -
src/SymTab/FixFunction.cc
r309d814 r4c925cd 106 106 bool isVoid = false; 107 107 108 void pre mutate( const ast::FunctionDecl * ) { visit_children = false; }108 void previsit( const ast::FunctionDecl * ) { visit_children = false; } 109 109 110 const ast::DeclWithType * post mutate( const ast::FunctionDecl * func ) {110 const ast::DeclWithType * postvisit( const ast::FunctionDecl * func ) { 111 111 return new ast::ObjectDecl{ 112 112 func->location, func->name, new ast::PointerType{ func->type }, nullptr, … … 114 114 } 115 115 116 void pre mutate( const ast::ArrayType * ) { visit_children = false; }116 void previsit( const ast::ArrayType * ) { visit_children = false; } 117 117 118 const ast::Type * post mutate( const ast::ArrayType * array ) {118 const ast::Type * postvisit( const ast::ArrayType * array ) { 119 119 return new ast::PointerType{ 120 120 array->base, array->dimension, array->isVarLen, array->isStatic, … … 122 122 } 123 123 124 void pre mutate( const ast::VoidType * ) { isVoid = true; }124 void previsit( const ast::VoidType * ) { isVoid = true; } 125 125 126 void pre mutate( const ast::BasicType * ) { visit_children = false; }127 void pre mutate( const ast::PointerType * ) { visit_children = false; }128 void pre mutate( const ast::StructInstType * ) { visit_children = false; }129 void pre mutate( const ast::UnionInstType * ) { visit_children = false; }130 void pre mutate( const ast::EnumInstType * ) { visit_children = false; }131 void pre mutate( const ast::TraitInstType * ) { visit_children = false; }132 void pre mutate( const ast::TypeInstType * ) { visit_children = false; }133 void pre mutate( const ast::TupleType * ) { visit_children = false; }134 void pre mutate( const ast::VarArgsType * ) { visit_children = false; }135 void pre mutate( const ast::ZeroType * ) { visit_children = false; }136 void pre mutate( const ast::OneType * ) { visit_children = false; }126 void previsit( const ast::BasicType * ) { visit_children = false; } 127 void previsit( const ast::PointerType * ) { visit_children = false; } 128 void previsit( const ast::StructInstType * ) { visit_children = false; } 129 void previsit( const ast::UnionInstType * ) { visit_children = false; } 130 void previsit( const ast::EnumInstType * ) { visit_children = false; } 131 void previsit( const ast::TraitInstType * ) { visit_children = false; } 132 void previsit( const ast::TypeInstType * ) { visit_children = false; } 133 void previsit( const ast::TupleType * ) { visit_children = false; } 134 void previsit( const ast::VarArgsType * ) { visit_children = false; } 135 void previsit( const ast::ZeroType * ) { visit_children = false; } 136 void previsit( const ast::OneType * ) { visit_children = false; } 137 137 }; 138 138 } // anonymous namespace … … 141 141 ast::Pass< FixFunction_new > fixer; 142 142 dwt = dwt->accept( fixer ); 143 isVoid |= fixer. pass.isVoid;143 isVoid |= fixer.core.isVoid; 144 144 return dwt; 145 145 } -
src/SymTab/Mangler.cc
r309d814 r4c925cd 447 447 ast::Pass<Mangler_new> mangler( mode ); 448 448 maybeAccept( decl, mangler ); 449 return mangler. pass.get_mangleName();449 return mangler.core.get_mangleName(); 450 450 } 451 451 … … 691 691 mangleOverridable, typeMode, mangleGenericParams, nextVarNum, varNums ); 692 692 assert->accept( sub_mangler ); 693 assertionNames.push_back( sub_mangler. pass.get_mangleName() );693 assertionNames.push_back( sub_mangler.core.get_mangleName() ); 694 694 acount++; 695 695 } // for
Note:
See TracChangeset
for help on using the changeset viewer.