Changes in / [f2e746d:ad1770be]
- Location:
- src
- Files:
-
- 2 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/utility.h
rf2e746d rad1770be 322 322 std::string filename; 323 323 324 324 /// Create a new unset CodeLocation. 325 325 CodeLocation() 326 326 : linenumber( -1 ) … … 328 328 {} 329 329 330 330 /// Create a new CodeLocation with the given values. 331 331 CodeLocation( const char* filename, int lineno ) 332 332 : linenumber( lineno ) … … 334 334 {} 335 335 336 337 338 339 340 341 342 336 bool isSet () const { 337 return -1 != linenumber; 338 } 339 340 bool isUnset () const { 341 return !isSet(); 342 } 343 343 344 344 void unset () { … … 353 353 return location.isSet() ? location.filename + ":" + std::to_string(location.linenumber) + " " : ""; 354 354 } 355 355 356 #endif // _UTILITY_H 356 357 -
src/GenPoly/Box.cc
rf2e746d rad1770be 765 765 arg = new AddressExpr( arg ); 766 766 } 767 if ( ! ResolvExpr::typesCompatible( param, arg->get_result(), SymTab::Indexer() ) ) { 768 // silence warnings by casting boxed parameters when the actual type does not match up with the formal type. 769 arg = new CastExpr( arg, param->clone() ); 770 } 767 771 } else { 768 772 // use type computed in unification to declare boxed variables … … 902 906 } // if 903 907 UntypedExpr *assign = new UntypedExpr( new NameExpr( "?=?" ) ); 904 UntypedExpr *deref = new UntypedExpr( new NameExpr( "*?" ) ); 905 deref->get_args().push_back( new CastExpr( new VariableExpr( *param++ ), new PointerType( Type::Qualifiers(), realType->get_returnVals().front()->get_type()->clone() ) ) ); 908 UntypedExpr *deref = UntypedExpr::createDeref( new CastExpr( new VariableExpr( *param++ ), new PointerType( Type::Qualifiers(), realType->get_returnVals().front()->get_type()->clone() ) ) ); 906 909 assign->get_args().push_back( deref ); 907 910 addAdapterParams( adapteeApp, arg, param, adapterType->get_parameters().end(), realParam, tyVars ); … … 1217 1220 1218 1221 Statement * Pass1::mutate( ReturnStmt *returnStmt ) { 1219 // maybe need access to the env when mutating the expr1220 if ( Expression * expr = returnStmt->get_expr() ) {1221 if ( expr->get_env() ) {1222 env = expr->get_env();1223 }1224 }1225 1226 1222 if ( retval && returnStmt->get_expr() ) { 1227 1223 assert( returnStmt->get_expr()->has_result() && ! returnStmt->get_expr()->get_result()->isVoid() ); … … 1539 1535 Type *declType = objectDecl->get_type(); 1540 1536 std::string bufName = bufNamer.newName(); 1541 ObjectDecl *newBuf = new ObjectDecl( bufName, Type::StorageClasses(), LinkageSpec::C, 0, 1542 new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Kind::Char), new NameExpr( sizeofName( mangleType(declType) ) ), 1537 ObjectDecl *newBuf = new ObjectDecl( bufName, Type::StorageClasses(), LinkageSpec::C, 0, 1538 new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::Kind::Char), new NameExpr( sizeofName( mangleType(declType) ) ), 1543 1539 true, false, std::list<Attribute*>{ new Attribute( std::string{"aligned"}, std::list<Expression*>{ new ConstantExpr( Constant::from_int(8) ) } ) } ), 0 ); 1544 1540 stmtsToAdd.push_back( new DeclStmt( noLabels, newBuf ) ); … … 1578 1574 } 1579 1575 1580 /// Returns an expression dereferenced n times1581 Expression *makeDerefdVar( Expression *derefdVar, long n ) {1582 for ( int i = 1; i < n; ++i ) {1583 UntypedExpr *derefExpr = new UntypedExpr( new NameExpr( "*?" ) );1584 derefExpr->get_args().push_back( derefdVar );1585 // xxx - should set results on derefExpr1586 derefdVar = derefExpr;1587 }1588 return derefdVar;1589 }1590 1591 1576 Expression *PolyGenericCalculator::mutate( MemberExpr *memberExpr ) { 1592 1577 // mutate, exiting early if no longer MemberExpr … … 1595 1580 if ( ! memberExpr ) return expr; 1596 1581 1597 // get declaration for base struct, exiting early if not found1598 int varDepth;1599 VariableExpr *varExpr = getBaseVar( memberExpr->get_aggregate(), &varDepth );1600 if ( ! varExpr ) return memberExpr;1601 ObjectDecl *objectDecl = dynamic_cast< ObjectDecl* >( varExpr->get_var() );1602 if ( ! objectDecl ) return memberExpr;1603 1604 1582 // only mutate member expressions for polymorphic types 1605 1583 int tyDepth; 1606 Type *objectType = hasPolyBase( objectDecl->get_type(), scopeTyVars, &tyDepth );1584 Type *objectType = hasPolyBase( memberExpr->get_aggregate()->get_result(), scopeTyVars, &tyDepth ); 1607 1585 if ( ! objectType ) return memberExpr; 1608 1586 findGeneric( objectType ); // ensure layout for this type is available … … 1622 1600 fieldLoc->get_args().push_back( aggr ); 1623 1601 fieldLoc->get_args().push_back( makeOffsetIndex( objectType, i ) ); 1602 fieldLoc->set_result( memberExpr->get_result()->clone() ); 1624 1603 newMemberExpr = fieldLoc; 1625 1604 } else if ( dynamic_cast< UnionInstType* >( objectType ) ) { 1626 // union members are all at offset zero, so build appropriately-dereferenced variable 1627 newMemberExpr = makeDerefdVar( varExpr->clone(), varDepth ); 1605 // union members are all at offset zero, so just use the aggregate expr 1606 Expression * aggr = memberExpr->get_aggregate()->clone(); 1607 delete aggr->get_env(); // xxx - there's a problem with keeping the env for some reason, so for now just get rid of it 1608 aggr->set_env( nullptr ); 1609 newMemberExpr = aggr; 1610 newMemberExpr->set_result( memberExpr->get_result()->clone() ); 1628 1611 } else return memberExpr; 1629 1612 assert( newMemberExpr ); … … 1633 1616 // Not all members of a polymorphic type are themselves of polymorphic type; in this case the member expression should be wrapped and dereferenced to form an lvalue 1634 1617 CastExpr *ptrCastExpr = new CastExpr( newMemberExpr, new PointerType( Type::Qualifiers(), memberType->clone() ) ); 1635 UntypedExpr *derefExpr = new UntypedExpr( new NameExpr( "*?" ) ); 1636 derefExpr->get_args().push_back( ptrCastExpr ); 1618 UntypedExpr *derefExpr = UntypedExpr::createDeref( ptrCastExpr ); 1637 1619 newMemberExpr = derefExpr; 1638 1620 } -
src/tests/Makefile.am
rf2e746d rad1770be 17 17 debug=yes 18 18 19 quick_test=vector_test avl_test operators numericConstants expression enum array typeof cast dtor-early-exit init_once 19 quick_test=vector_test avl_test operators numericConstants expression enum array typeof cast dtor-early-exit init_once attributes 20 20 21 21 if BUILD_CONCURRENCY … … 30 30 # applies to both programs 31 31 EXTRA_FLAGS = 32 BUILD_FLAGS = -g -Wall -Wno-unused-function @CFA_FLAGS@ ${EXTRA_FLAGS}32 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ ${EXTRA_FLAGS} 33 33 TEST_FLAGS = $(if $(test), 2> .err/${@}.log, ) 34 34 CFLAGS = ${TEST_FLAGS} ${BUILD_FLAGS} -
src/tests/Makefile.in
rf2e746d rad1770be 226 226 quick_test = vector_test avl_test operators numericConstants \ 227 227 expression enum array typeof cast dtor-early-exit init_once \ 228 $(am__append_1)228 attributes $(am__append_1) 229 229 @BUILD_CONCURRENCY_FALSE@concurrent = no 230 230 @BUILD_CONCURRENCY_TRUE@concurrent = yes … … 234 234 # applies to both programs 235 235 EXTRA_FLAGS = 236 BUILD_FLAGS = -g -Wall -Wno-unused-function @CFA_FLAGS@ ${EXTRA_FLAGS}236 BUILD_FLAGS = -g -Wall -Wno-unused-function -quiet @CFA_FLAGS@ ${EXTRA_FLAGS} 237 237 TEST_FLAGS = $(if $(test), 2> .err/${@}.log, ) 238 238 fstream_test_SOURCES = fstream_test.c -
src/tests/test.py
rf2e746d rad1770be 28 28 sh('echo "void ?{}(int*a,int b){}int main(){return 0;}" > .dummy.c') 29 29 ret, out = sh("make .dummy -s", print2stdout=True) 30 30 31 31 if ret != 0: 32 32 print("Failed to identify architecture:") … … 161 161 162 162 # build, skipping to next test on error 163 make_ret, _ = sh("""%s test=yes EXTRA_FLAGS=" -quiet%s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run)163 make_ret, _ = sh("""%s test=yes EXTRA_FLAGS="%s" %s 2> %s 1> /dev/null""" % (make_cmd, options, test.name, out_file), dry_run) 164 164 165 165 # if the make command succeds continue otherwise skip to diff … … 192 192 # fetch return code and error from the diff command 193 193 retcode, error = diff(".expect/%s.txt" % test.path, ".out/%s.log" % test.name, dry_run) 194 194 195 195 # clean the executable 196 196 sh("rm -f %s > /dev/null 2>&1" % test.name, dry_run) … … 269 269 if __name__ == "__main__": 270 270 #always run from same folder 271 chdir() 272 271 chdir() 272 273 273 # parse the command line arguments 274 274 options = getOptions()
Note: See TracChangeset
for help on using the changeset viewer.