Changes in src/SymTab/Autogen.h [417117e:b4f8808]
- File:
-
- 1 edited
-
src/SymTab/Autogen.h (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Autogen.h
r417117e rb4f8808 21 21 22 22 #include "AST/Decl.hpp" 23 #include "AST/Eval.hpp"24 23 #include "AST/Expr.hpp" 25 24 #include "AST/Init.hpp" … … 98 97 // type->get_qualifiers() = Type::Qualifiers(); 99 98 Type * castType = addCast->clone(); 100 castType->get_qualifiers() -= Type::Qualifiers( Type:: Lvalue | Type::Const | Type::Volatile | Type::Restrict | Type::Atomic );99 castType->get_qualifiers() -= Type::Qualifiers( Type::Const | Type::Volatile | Type::Restrict | Type::Atomic ); 101 100 // castType->set_lvalue( true ); // xxx - might not need this 102 101 dstParam = new CastExpr( dstParam, new ReferenceType( Type::Qualifiers(), castType ) ); … … 265 264 } 266 265 267 ast::ptr< ast::Expr > begin, end; 268 std::string cmp, update; 266 ast::ptr< ast::Expr > begin, end, cmp, update; 269 267 270 268 if ( forward ) { … … 272 270 begin = ast::ConstantExpr::from_int( loc, 0 ); 273 271 end = array->dimension; 274 cmp = "?<?";275 update = "++?";272 cmp = new ast::NameExpr{ loc, "?<?" }; 273 update = new ast::NameExpr{ loc, "++?" }; 276 274 } else { 277 275 // generate: for ( int i = N-1; i >= 0; --i ) 278 begin = ast::call( 279 loc, "?-?", array->dimension, ast::ConstantExpr::from_int( loc, 1 ) ); 276 begin = new ast::UntypedExpr{ 277 loc, new ast::NameExpr{ loc, "?-?" }, 278 { array->dimension, ast::ConstantExpr::from_int( loc, 1 ) } }; 280 279 end = ast::ConstantExpr::from_int( loc, 0 ); 281 cmp = "?>=?";282 update = "--?";280 cmp = new ast::NameExpr{ loc, "?>=?" }; 281 update = new ast::NameExpr{ loc, "--?" }; 283 282 } 284 283 … … 286 285 loc, indexName.newName(), new ast::BasicType{ ast::BasicType::SignedInt }, 287 286 new ast::SingleInit{ loc, begin } }; 288 ast::ptr< ast::Expr > indexVar = new ast::VariableExpr{ loc, index }; 289 290 ast::ptr< ast::Expr > cond = ast::call( loc, cmp, indexVar, end ); 291 292 ast::ptr< ast::Expr > inc = ast::call( loc, update, indexVar ); 293 294 ast::ptr< ast::Expr > dstIndex = ast::call( loc, "?[?]", dstParam, indexVar ); 287 288 ast::ptr< ast::Expr > cond = new ast::UntypedExpr{ 289 loc, cmp, { new ast::VariableExpr{ loc, index }, end } }; 290 291 ast::ptr< ast::Expr > inc = new ast::UntypedExpr{ 292 loc, update, { new ast::VariableExpr{ loc, index } } }; 293 294 ast::ptr< ast::Expr > dstIndex = new ast::UntypedExpr{ 295 loc, new ast::NameExpr{ loc, "?[?]" }, 296 { dstParam, new ast::VariableExpr{ loc, index } } }; 295 297 296 298 // srcParam must keep track of the array indices to build the source parameter and/or 297 299 // array list initializer 298 srcParam.addArrayIndex( indexVar, array->dimension );300 srcParam.addArrayIndex( new ast::VariableExpr{ loc, index }, array->dimension ); 299 301 300 302 // for stmt's body, eventually containing call … … 382 384 if ( isUnnamedBitfield( obj ) ) return {}; 383 385 384 ast::ptr< ast::Type > addCast ;386 ast::ptr< ast::Type > addCast = nullptr; 385 387 if ( (fname == "?{}" || fname == "^?{}") && ( ! obj || ( obj && ! obj->bitfieldWidth ) ) ) { 386 388 assert( dstParam->result );
Note:
See TracChangeset
for help on using the changeset viewer.