Changeset 417117e
- Timestamp:
- Jun 28, 2019, 3:50:21 PM (5 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
- Children:
- 03bf5c8
- Parents:
- 55b6476
- Location:
- src
- Files:
-
- 1 added
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Expr.cpp
r55b6476 r417117e 20 20 #include <vector> 21 21 22 #include "Eval.hpp" // for call 22 23 #include "GenericSubstitution.hpp" 23 24 #include "Stmt.hpp" … … 51 52 assert( arg ); 52 53 53 UntypedExpr * ret = new UntypedExpr{ 54 loc, new NameExpr{loc, "*?"}, std::vector<ptr<Expr>>{ ptr<Expr>{ arg } } 55 }; 54 UntypedExpr * ret = call( loc, "*?", arg ); 56 55 if ( const Type * ty = arg->result ) { 57 56 const Type * base = InitTweak::getPointerBase( ty ); … … 74 73 assert( lhs && rhs ); 75 74 76 UntypedExpr * ret = new UntypedExpr{ 77 loc, new NameExpr{loc, "?=?"}, std::vector<ptr<Expr>>{ ptr<Expr>{ lhs }, ptr<Expr>{ rhs } } 78 }; 75 UntypedExpr * ret = call( loc, "?=?", lhs, rhs ); 79 76 if ( lhs->result && rhs->result ) { 80 77 // if both expressions are typed, assumes that this assignment is a C bitwise assignment, -
src/AST/Pass.impl.hpp
r55b6476 r417117e 1920 1920 guard_symtab guard { *this }; 1921 1921 auto new_node = p.second->accept( *this ); 1922 if (new_node != p.second) mutated = false;1922 if (new_node != p.second) mutated = true; 1923 1923 new_map.insert({ p.first, new_node }); 1924 1924 } … … 1936 1936 guard_symtab guard { *this }; 1937 1937 auto new_node = p.second->accept( *this ); 1938 if (new_node != p.second) mutated = false;1938 if (new_node != p.second) mutated = true; 1939 1939 new_map.insert({ p.first, new_node }); 1940 1940 } -
src/AST/TypeSubstitution.cpp
r55b6476 r417117e 183 183 // bind type variables from generic type instantiations 184 184 if ( auto decl = type->aggr() ) { 185 const std::vector<ptr<TypeDecl>> &baseParameters = decl->params; 186 if (! type->params.empty()) { 187 for ( const TypeDecl * tyvar : baseParameters ) { 185 if ( ! type->params.empty() ) { 186 for ( const TypeDecl * tyvar : decl->params ) { 188 187 boundVars.insert( tyvar->name ); 189 188 } // for -
src/ResolvExpr/CandidateFinder.cpp
r55b6476 r417117e 370 370 // push empty tuple expression 371 371 newResult.parent = i; 372 std::vector< ast::ptr< ast::Expr > > emptyList; 373 newResult.expr = 374 new ast::TupleExpr{ CodeLocation{}, move( emptyList ) }; 372 newResult.expr = new ast::TupleExpr{ CodeLocation{}, {} }; 375 373 argType = newResult.expr->result; 376 374 } else { -
src/ResolvExpr/ResolveTypeof.cc
r55b6476 r417117e 153 153 } 154 154 155 return newType ;155 return newType.release(); 156 156 } 157 157 }; -
src/ResolvExpr/Resolver.cc
r55b6476 r417117e 1109 1109 1110 1110 // set up and resolve expression cast to void 1111 ast:: CastExpr *untyped = new ast::CastExpr{ expr };1111 ast::ptr< ast::CastExpr > untyped = new ast::CastExpr{ expr }; 1112 1112 CandidateRef choice = findUnfinishedKindExpression( 1113 1113 untyped, symtab, "", anyCandidate, ResolvMode::withAdjustment() ); … … 1248 1248 }; 1249 1249 1250 void resolve( std::list< ast::ptr< ast::Decl> >& translationUnit ) {1250 void resolve( std::list< ast::ptr< ast::Decl > >& translationUnit ) { 1251 1251 ast::Pass< Resolver_new > resolver; 1252 1252 accept_all( translationUnit, resolver ); … … 1282 1282 ast::ptr< ast::FunctionDecl > ret = functionDecl; 1283 1283 for ( unsigned i = 0; i < functionDecl->type->params.size(); ++i ) { 1284 const ast::ptr< ast::DeclWithType> & d = functionDecl->type->params[i];1284 const ast::ptr< ast::DeclWithType > & d = functionDecl->type->params[i]; 1285 1285 1286 1286 if ( const ast::ObjectDecl * obj = d.as< ast::ObjectDecl >() ) { … … 1299 1299 } 1300 1300 } 1301 return ret. get();1301 return ret.release(); 1302 1302 } 1303 1303 -
src/SymTab/Autogen.h
r55b6476 r417117e 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" … … 264 265 } 265 266 266 ast::ptr< ast::Expr > begin, end, cmp, update; 267 ast::ptr< ast::Expr > begin, end; 268 std::string cmp, update; 267 269 268 270 if ( forward ) { … … 270 272 begin = ast::ConstantExpr::from_int( loc, 0 ); 271 273 end = array->dimension; 272 cmp = new ast::NameExpr{ loc, "?<?" };273 update = new ast::NameExpr{ loc, "++?" };274 cmp = "?<?"; 275 update = "++?"; 274 276 } else { 275 277 // generate: for ( int i = N-1; i >= 0; --i ) 276 begin = new ast::UntypedExpr{ 277 loc, new ast::NameExpr{ loc, "?-?" }, 278 { array->dimension, ast::ConstantExpr::from_int( loc, 1 ) } }; 278 begin = ast::call( 279 loc, "?-?", array->dimension, ast::ConstantExpr::from_int( loc, 1 ) ); 279 280 end = ast::ConstantExpr::from_int( loc, 0 ); 280 cmp = new ast::NameExpr{ loc, "?>=?" };281 update = new ast::NameExpr{ loc, "--?" };281 cmp = "?>=?"; 282 update = "--?"; 282 283 } 283 284 … … 285 286 loc, indexName.newName(), new ast::BasicType{ ast::BasicType::SignedInt }, 286 287 new ast::SingleInit{ loc, begin } }; 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 } } }; 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 ); 297 295 298 296 // srcParam must keep track of the array indices to build the source parameter and/or 299 297 // array list initializer 300 srcParam.addArrayIndex( new ast::VariableExpr{ loc, index }, array->dimension );298 srcParam.addArrayIndex( indexVar, array->dimension ); 301 299 302 300 // for stmt's body, eventually containing call … … 384 382 if ( isUnnamedBitfield( obj ) ) return {}; 385 383 386 ast::ptr< ast::Type > addCast = nullptr;384 ast::ptr< ast::Type > addCast; 387 385 if ( (fname == "?{}" || fname == "^?{}") && ( ! obj || ( obj && ! obj->bitfieldWidth ) ) ) { 388 386 assert( dstParam->result ); -
src/Tuples/Explode.cc
r55b6476 r417117e 129 129 for ( const ast::Expr * expr : tupleExpr->exprs ) { 130 130 exprs.emplace_back( applyCast( expr, false ) ); 131 //exprs.emplace_back( ast::ptr< ast::Expr >( applyCast( expr, false ) ) );132 131 } 133 132 if ( first ) { -
src/Tuples/Explode.h
r55b6476 r417117e 210 210 } 211 211 // Cast a reference away to a value-type to allow further explosion. 212 if ( dynamic_cast< const ast::ReferenceType *>( local->result.get()) ) {212 if ( local->result.as< ast::ReferenceType >() ) { 213 213 local = new ast::CastExpr{ local, tupleType }; 214 214 } … … 220 220 // delete idx; 221 221 } 222 // delete local;223 222 } 224 223 } else {
Note: See TracChangeset
for help on using the changeset viewer.