Changes in src/InitTweak/InitTweak.cc [175ad32:d180746]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/InitTweak.cc
r175ad32 rd180746 1 #include <algorithm> 1 #include <stddef.h> // for NULL 2 #include <algorithm> // for find, all_of 3 #include <cassert> // for assertf, assert, safe_dynamic_cast 4 #include <iostream> // for ostream, cerr, endl 5 #include <iterator> // for back_insert_iterator, back_inserter 6 #include <memory> // for __shared_ptr 7 8 #include "Common/SemanticError.h" // for SemanticError 9 #include "Common/UniqueName.h" // for UniqueName 10 #include "Common/utility.h" // for toString, deleteAll, maybeClone 11 #include "GenPoly/GenPoly.h" // for getFunctionType 2 12 #include "InitTweak.h" 3 #include "SynTree/Visitor.h" 4 #include "SynTree/Statement.h" 5 #include "SynTree/Initializer.h" 6 #include "SynTree/Expression.h" 7 #include "SynTree/Attribute.h" 8 #include "GenPoly/GenPoly.h" 9 #include "ResolvExpr/typeops.h" 13 #include "Parser/LinkageSpec.h" // for Spec, isBuiltin, Intrinsic 14 #include "ResolvExpr/typeops.h" // for typesCompatibleIgnoreQualifiers 15 #include "SymTab/Indexer.h" // for Indexer 16 #include "SynTree/Attribute.h" // for Attribute 17 #include "SynTree/Constant.h" // for Constant 18 #include "SynTree/Declaration.h" // for ObjectDecl, DeclarationWithType 19 #include "SynTree/Expression.h" // for Expression, UntypedExpr, Applicati... 20 #include "SynTree/Initializer.h" // for Initializer, ListInit, Designation 21 #include "SynTree/Label.h" // for Label, noLabels 22 #include "SynTree/Statement.h" // for CompoundStmt, ExprStmt, BranchStmt 23 #include "SynTree/Type.h" // for FunctionType, ArrayType, PointerType 24 #include "SynTree/Visitor.h" // for Visitor, maybeAccept 25 26 class UntypedValofExpr; 10 27 11 28 namespace InitTweak { … … 170 187 171 188 UntypedExpr * increment = new UntypedExpr( new NameExpr( "++?" ) ); 172 increment->get_args().push_back( index->clone() );189 increment->get_args().push_back( new AddressExpr( index->clone() ) ); 173 190 *out++ = new ExprStmt( noLabels, increment ); 174 191 } … … 380 397 template<typename CallExpr> 381 398 Expression *& callArg( CallExpr * callExpr, unsigned int pos ) { 382 if ( pos >= callExpr->get_args().size() ) assertf( false, " getCallArg for argument that doesn't exist: (%u); %s.", pos, toString( callExpr ).c_str());399 if ( pos >= callExpr->get_args().size() ) assertf( false, "asking for argument that doesn't exist. Return NULL/throw exception?" ); 383 400 for ( Expression *& arg : callExpr->get_args() ) { 384 401 if ( pos == 0 ) return arg; … … 458 475 } else if ( ArrayType * arrayType = dynamic_cast< ArrayType * >( type ) ) { 459 476 return arrayType->get_base(); 460 } else if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( type ) ) {461 return refType->get_base();462 477 } else { 463 478 return NULL; … … 545 560 if ( ftype->get_parameters().size() != 2 ) return 0; 546 561 547 Type * t1 = getPointerBase( ftype->get_parameters().front()->get_type());562 Type * t1 = ftype->get_parameters().front()->get_type(); 548 563 Type * t2 = ftype->get_parameters().back()->get_type(); 549 assert( t1 ); 550 551 if ( ResolvExpr::typesCompatibleIgnoreQualifiers( t1, t2, SymTab::Indexer() ) ) { 564 PointerType * ptrType = dynamic_cast< PointerType * > ( t1 ); 565 assert( ptrType ); 566 567 if ( ResolvExpr::typesCompatibleIgnoreQualifiers( ptrType->get_base(), t2, SymTab::Indexer() ) ) { 552 568 return function; 553 569 } else {
Note: See TracChangeset
for help on using the changeset viewer.