Changes in / [3403534:f04a8b81]
- Location:
- src
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/PolyMutator.cc
r3403534 rf04a8b81 30 30 31 31 void PolyMutator::mutateStatementList( std::list< Statement* > &statements ) { 32 SemanticError errors; 33 32 34 for ( std::list< Statement* >::iterator i = statements.begin(); i != statements.end(); ++i ) { 33 35 if ( ! stmtsToAddAfter.empty() ) { 34 36 statements.splice( i, stmtsToAddAfter ); 35 37 } // if 36 *i = (*i)->acceptMutator( *this ); 38 try { 39 *i = (*i)->acceptMutator( *this ); 40 } catch ( SemanticError &e ) { 41 errors.append( e ); 42 } // try 37 43 if ( ! stmtsToAdd.empty() ) { 38 44 statements.splice( i, stmtsToAdd ); … … 42 48 statements.splice( statements.end(), stmtsToAddAfter ); 43 49 } // if 50 if ( ! errors.isEmpty() ) { 51 throw errors; 52 } 44 53 } 45 54 -
src/InitTweak/GenInit.cc
r3403534 rf04a8b81 245 245 // constructed objects cannot be designated 246 246 if ( isDesignated( objDecl->get_init() ) ) throw SemanticError( "Cannot include designations in the initializer for a managed Object. If this is really what you want, then initialize with @=.", objDecl ); 247 // xxx - constructed objects should not have initializers nested too deeply 247 // constructed objects should not have initializers nested too deeply 248 if ( ! checkInitDepth( objDecl ) ) throw SemanticError( "Managed object's initializer is too deep ", objDecl ); 248 249 249 250 // call into genImplicitCall from Autogen.h to generate calls to ctor/dtor -
src/InitTweak/InitTweak.cc
r3403534 rf04a8b81 23 23 }; 24 24 25 class InitDepthChecker : public Visitor { 26 public: 27 bool depthOkay = true; 28 Type * type; 29 int curDepth = 0, maxDepth = 0; 30 InitDepthChecker( Type * type ) : type( type ) { 31 Type * t = type; 32 while ( ArrayType * at = dynamic_cast< ArrayType * >( t ) ) { 33 maxDepth++; 34 t = at->get_base(); 35 } 36 maxDepth++; 37 } 38 virtual void visit( ListInit * listInit ) { 39 curDepth++; 40 if ( curDepth > maxDepth ) depthOkay = false; 41 Visitor::visit( listInit ); 42 curDepth--; 43 } 44 }; 45 25 46 class InitFlattener : public Visitor { 26 47 public: … … 53 74 maybeAccept( init, finder ); 54 75 return finder.hasDesignations; 76 } 77 78 bool checkInitDepth( ObjectDecl * objDecl ) { 79 InitDepthChecker checker( objDecl->get_type() ); 80 maybeAccept( objDecl->get_init(), checker ); 81 return checker.depthOkay; 55 82 } 56 83 -
src/InitTweak/InitTweak.h
r3403534 rf04a8b81 40 40 /// True if the Initializer contains designations 41 41 bool isDesignated( Initializer * init ); 42 43 /// True if the ObjectDecl's Initializer nesting level is not deeper than the depth of its 44 /// type, where the depth of its type is the number of nested ArrayTypes + 1 45 bool checkInitDepth( ObjectDecl * objDecl ); 42 46 43 47 /// Non-Null if expr is a call expression whose target function is intrinsic -
src/tests/.expect/32/declarationSpecifier.txt
r3403534 rf04a8b81 530 530 return ((int )_retVal0); 531 531 } 532 __attribute__ ((constructor(),)) static void _init_declarationSpecifier(void){533 ((void)___constructor__F_P13s__anonymous0_autogen___1(((struct __anonymous0 *)(&__x10__CV13s__anonymous0_1))));534 ((void)___constructor__F_P13s__anonymous1_autogen___1(((struct __anonymous1 *)(&__x11__CV13s__anonymous1_1))));535 ((void)___constructor__F_P13s__anonymous2_autogen___1(((struct __anonymous2 *)(&__x12__CV13s__anonymous2_1))));536 ((void)___constructor__F_P13s__anonymous3_autogen___1(((struct __anonymous3 *)(&__x13__CV13s__anonymous3_1))));537 ((void)___constructor__F_P13s__anonymous4_autogen___1(((struct __anonymous4 *)(&__x14__CV13s__anonymous4_1))));538 ((void)___constructor__F_P13s__anonymous5_autogen___1(((struct __anonymous5 *)(&__x15__CV13s__anonymous5_1))));539 ((void)___constructor__F_P13s__anonymous6_autogen___1(((struct __anonymous6 *)(&__x16__CV13s__anonymous6_1))));540 ((void)___constructor__F_P13s__anonymous7_autogen___1(((struct __anonymous7 *)(&__x17__CV13s__anonymous7_1))));541 ((void)___constructor__F_P13s__anonymous8_autogen___1(((struct __anonymous8 *)(&__x29__CV13s__anonymous8_1))));542 ((void)___constructor__F_P13s__anonymous9_autogen___1(((struct __anonymous9 *)(&__x30__CV13s__anonymous9_1))));543 ((void)___constructor__F_P14s__anonymous10_autogen___1(((struct __anonymous10 *)(&__x31__CV14s__anonymous10_1))));544 ((void)___constructor__F_P14s__anonymous11_autogen___1(((struct __anonymous11 *)(&__x32__CV14s__anonymous11_1))));545 ((void)___constructor__F_P14s__anonymous12_autogen___1(((struct __anonymous12 *)(&__x33__CV14s__anonymous12_1))));546 ((void)___constructor__F_P14s__anonymous13_autogen___1(((struct __anonymous13 *)(&__x34__CV14s__anonymous13_1))));547 ((void)___constructor__F_P14s__anonymous14_autogen___1(((struct __anonymous14 *)(&__x35__CV14s__anonymous14_1))));548 ((void)___constructor__F_P14s__anonymous15_autogen___1(((struct __anonymous15 *)(&__x36__CV14s__anonymous15_1))));549 }550 __attribute__ ((destructor(),)) static void _destroy_declarationSpecifier(void){551 ((void)___destructor__F_P14s__anonymous15_autogen___1(((struct __anonymous15 *)(&__x36__CV14s__anonymous15_1))));552 ((void)___destructor__F_P14s__anonymous14_autogen___1(((struct __anonymous14 *)(&__x35__CV14s__anonymous14_1))));553 ((void)___destructor__F_P14s__anonymous13_autogen___1(((struct __anonymous13 *)(&__x34__CV14s__anonymous13_1))));554 ((void)___destructor__F_P14s__anonymous12_autogen___1(((struct __anonymous12 *)(&__x33__CV14s__anonymous12_1))));555 ((void)___destructor__F_P14s__anonymous11_autogen___1(((struct __anonymous11 *)(&__x32__CV14s__anonymous11_1))));556 ((void)___destructor__F_P14s__anonymous10_autogen___1(((struct __anonymous10 *)(&__x31__CV14s__anonymous10_1))));557 ((void)___destructor__F_P13s__anonymous9_autogen___1(((struct __anonymous9 *)(&__x30__CV13s__anonymous9_1))));558 ((void)___destructor__F_P13s__anonymous8_autogen___1(((struct __anonymous8 *)(&__x29__CV13s__anonymous8_1))));559 ((void)___destructor__F_P13s__anonymous7_autogen___1(((struct __anonymous7 *)(&__x17__CV13s__anonymous7_1))));560 ((void)___destructor__F_P13s__anonymous6_autogen___1(((struct __anonymous6 *)(&__x16__CV13s__anonymous6_1))));561 ((void)___destructor__F_P13s__anonymous5_autogen___1(((struct __anonymous5 *)(&__x15__CV13s__anonymous5_1))));562 ((void)___destructor__F_P13s__anonymous4_autogen___1(((struct __anonymous4 *)(&__x14__CV13s__anonymous4_1))));563 ((void)___destructor__F_P13s__anonymous3_autogen___1(((struct __anonymous3 *)(&__x13__CV13s__anonymous3_1))));564 ((void)___destructor__F_P13s__anonymous2_autogen___1(((struct __anonymous2 *)(&__x12__CV13s__anonymous2_1))));565 ((void)___destructor__F_P13s__anonymous1_autogen___1(((struct __anonymous1 *)(&__x11__CV13s__anonymous1_1))));566 ((void)___destructor__F_P13s__anonymous0_autogen___1(((struct __anonymous0 *)(&__x10__CV13s__anonymous0_1))));567 } -
src/tests/.expect/32/extension.txt
r3403534 rf04a8b81 86 86 __extension__ int __c__i_2; 87 87 }; 88 int __i__i_2; 89 ((void)((*((int *)(&__i__i_2)))=(__extension__ __a__i_1+__extension__ 3)) /* ?{} */); 88 int __i__i_2 = ((int )(__extension__ __a__i_1+__extension__ 3)); 90 89 ((void)__extension__ 3); 91 90 ((void)__extension__ __a__i_1); -
src/tests/.expect/32/gccExtensions.txt
r3403534 rf04a8b81 76 76 ((void)((*((int *)(&(*___dst__P2sS_2).__c__i_2)))=__c__i_2) /* ?{} */); 77 77 } 78 int __i__i_2; 79 ((void)((*((int *)(&__i__i_2)))=__extension__ 3) /* ?{} */); 78 int __i__i_2 = ((int )__extension__ 3); 80 79 __extension__ int __a__i_2; 81 80 __extension__ int __b__i_2; … … 133 132 } 134 133 struct s3 __x1__3ss3_2; 135 ((void)___constructor__F_P3ss3_autogen___2(((struct s3 *)(&__x1__3ss3_2))));136 134 struct s3 __y1__3ss3_2; 137 ((void)___constructor__F_P3ss3_autogen___2(((struct s3 *)(&__y1__3ss3_2))));138 135 struct s4 { 139 136 int __i__i_2; … … 141 138 inline struct s4 ___operator_assign__F3ss4_P3ss43ss4_autogen___2(struct s4 *___dst__P3ss4_2, struct s4 ___src__3ss4_2){ 142 139 ((void)((*___dst__P3ss4_2).__i__i_2=___src__3ss4_2.__i__i_2)); 143 ((void)___destructor__F_P3ss3_autogen___2(((struct s3 *)(&__y1__3ss3_2))));144 ((void)___destructor__F_P3ss3_autogen___2(((struct s3 *)(&__x1__3ss3_2))));145 140 return ((struct s4 )___src__3ss4_2); 146 141 } … … 158 153 } 159 154 struct s4 __x2__3ss4_2; 160 ((void)___constructor__F_P3ss4_autogen___2(((struct s4 *)(&__x2__3ss4_2))));161 155 struct s4 __y2__3ss4_2; 162 ((void)___constructor__F_P3ss4_autogen___2(((struct s4 *)(&__y2__3ss4_2))));163 156 int __m1__A0i_2[((unsigned int )10)]; 164 157 int __m2__A0A0i_2[((unsigned int )10)][((unsigned int )10)]; … … 166 159 int _retVal0 = { 0 }; 167 160 ((void)(_retVal0=0) /* ?{} */); 168 ((void)___destructor__F_P3ss4_autogen___2(((struct s4 *)(&__y2__3ss4_2))));169 ((void)___destructor__F_P3ss4_autogen___2(((struct s4 *)(&__x2__3ss4_2))));170 ((void)___destructor__F_P3ss3_autogen___2(((struct s3 *)(&__y1__3ss3_2))));171 ((void)___destructor__F_P3ss3_autogen___2(((struct s3 *)(&__x1__3ss3_2))));172 161 return ((int )_retVal0); 173 ((void)___destructor__F_P3ss4_autogen___2(((struct s4 *)(&__y2__3ss4_2))));174 ((void)___destructor__F_P3ss4_autogen___2(((struct s4 *)(&__x2__3ss4_2))));175 ((void)___destructor__F_P3ss3_autogen___2(((struct s3 *)(&__y1__3ss3_2))));176 ((void)___destructor__F_P3ss3_autogen___2(((struct s3 *)(&__x1__3ss3_2))));177 162 }
Note:
See TracChangeset
for help on using the changeset viewer.