Changeset 8cb149f for src/ControlStruct
- Timestamp:
- Feb 2, 2022, 2:50:46 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 21a99cc
- Parents:
- 4de48c5 (diff), 4e7171f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/ControlStruct
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/ControlStruct/ForExprMutator.cc ¶
r4de48c5 r8cb149f 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Mar 11 22:26:52 201913 // Update Count : 1 412 // Last Modified On : Tue Feb 1 09:26:12 2022 13 // Update Count : 16 14 14 // 15 15 … … 45 45 return hoist( forStmt, forStmt->initialization ); 46 46 } 47 Statement * ForExprMutator::postmutate( While Stmt * whileStmt ) {48 return hoist( while Stmt, whileStmt->initialization );47 Statement * ForExprMutator::postmutate( WhileDoStmt * whileDoStmt ) { 48 return hoist( whileDoStmt, whileDoStmt->initialization ); 49 49 } 50 50 } // namespace ControlStruct -
TabularUnified src/ControlStruct/ForExprMutator.h ¶
r4de48c5 r8cb149f 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sun Jan 30 09:14:46202213 // Update Count : 612 // Last Modified On : Tue Feb 1 09:18:50 2022 13 // Update Count : 7 14 14 // 15 15 … … 18 18 class IfStmt; 19 19 class ForStmt; 20 class While Stmt;20 class WhileDoStmt; 21 21 class Statement; 22 22 … … 26 26 Statement * postmutate( IfStmt * ); 27 27 Statement * postmutate( ForStmt * ); 28 Statement * postmutate( While Stmt * );28 Statement * postmutate( WhileDoStmt * ); 29 29 }; 30 30 } // namespace ControlStruct -
TabularUnified src/ControlStruct/HoistControlDecls.cpp ¶
r4de48c5 r8cb149f 10 10 // Created On : Fri Dec 3 15:34:00 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jan 31 18:52:35202213 // Update Count : 2 312 // Last Modified On : Tue Feb 1 18:59:47 2022 13 // Update Count : 25 14 14 // 15 15 … … 35 35 36 36 CompoundStmt * block = new CompoundStmt( stmt->location ); // create empty compound statement 37 // { 38 // } 37 // {} 39 38 40 39 for ( const Stmt * next : stmt->inits ) { // link conditional declarations into compound … … 69 68 return hoist<ForStmt>( stmt ); 70 69 } 71 const Stmt * postvisit( const While Stmt * stmt ) {72 return hoist<While Stmt>( stmt );70 const Stmt * postvisit( const WhileDoStmt * stmt ) { 71 return hoist<WhileDoStmt>( stmt ); 73 72 } 74 73 }; -
TabularUnified src/ControlStruct/LabelFixer.cc ¶
r4de48c5 r8cb149f 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jan 31 22:28:31202213 // Update Count : 16 112 // Last Modified On : Tue Feb 1 09:12:09 2022 13 // Update Count : 162 14 14 // 15 15 … … 29 29 bool LabelFixer::Entry::insideLoop() { 30 30 return ( dynamic_cast< ForStmt * > ( definition ) || 31 dynamic_cast< While Stmt * > ( definition ) );31 dynamic_cast< WhileDoStmt * > ( definition ) ); 32 32 } 33 33 -
TabularUnified src/ControlStruct/LabelGeneratorNew.cpp ¶
r4de48c5 r8cb149f 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jan 31 18:51:10202213 // Update Count : 7 112 // Last Modified On : Wed Feb 2 09:11:17 2022 13 // Update Count : 72 14 14 // 15 15 … … 28 28 static int current = 0; 29 29 30 assert ( ( (void)"CFA internal error: parameter statement cannot be null pointer", stmt ));30 assertf( stmt, "CFA internal error: parameter statement cannot be null pointer" ); 31 31 32 32 enum { size = 128 }; 33 33 char buf[size]; // space to build label 34 34 int len = snprintf( buf, size, "__L%d__%s", current++, suffix.c_str() ); 35 assert ( ( (void)"CFA Internal error: buffer overflow creating label", len < size ));35 assertf( len < size, "CFA Internal error: buffer overflow creating label" ); 36 36 37 37 // What does this do? 38 38 if ( ! stmt->labels.empty() ) { 39 39 len = snprintf( buf + len, size - len, "_%s__", stmt->labels.front().name.c_str() ); 40 assert ( ( (void)"CFA Internal error: buffer overflow creating label", len < size - len ));40 assertf( len < size - len, "CFA Internal error: buffer overflow creating label" ); 41 41 } // if 42 42 -
TabularUnified src/ControlStruct/MLEMutator.cc ¶
r4de48c5 r8cb149f 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Wed Jan 22 11:50:00 202013 // Update Count : 22 311 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 1 09:26:28 2022 13 // Update Count : 225 14 14 // 15 15 … … 39 39 namespace { 40 40 bool isLoop( const MultiLevelExitMutator::Entry & e ) { 41 return dynamic_cast< While Stmt * >( e.get_controlStructure() )41 return dynamic_cast< WhileDoStmt * >( e.get_controlStructure() ) 42 42 || dynamic_cast< ForStmt * >( e.get_controlStructure() ); 43 43 } … … 295 295 } 296 296 297 void MultiLevelExitMutator::premutate( While Stmt * whileStmt ) {298 return prehandleLoopStmt( while Stmt );297 void MultiLevelExitMutator::premutate( WhileDoStmt * whileDoStmt ) { 298 return prehandleLoopStmt( whileDoStmt ); 299 299 } 300 300 … … 303 303 } 304 304 305 Statement * MultiLevelExitMutator::postmutate( While Stmt * whileStmt ) {306 return posthandleLoopStmt( while Stmt );305 Statement * MultiLevelExitMutator::postmutate( WhileDoStmt * whileDoStmt ) { 306 return posthandleLoopStmt( whileDoStmt ); 307 307 } 308 308 -
TabularUnified src/ControlStruct/MLEMutator.h ¶
r4de48c5 r8cb149f 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Wed Jan 22 11:50:00 202013 // Update Count : 4811 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 1 09:27:24 2022 13 // Update Count : 50 14 14 // 15 15 … … 42 42 void premutate( CompoundStmt *cmpndStmt ); 43 43 Statement * postmutate( BranchStmt *branchStmt ) throw ( SemanticErrorException ); 44 void premutate( While Stmt *whileStmt );45 Statement * postmutate( While Stmt *whileStmt );44 void premutate( WhileDoStmt *whileDoStmt ); 45 Statement * postmutate( WhileDoStmt *whileDoStmt ); 46 46 void premutate( ForStmt *forStmt ); 47 47 Statement * postmutate( ForStmt *forStmt ); … … 67 67 stmt( stmt ), breakExit( breakExit ), contExit( contExit ) {} 68 68 69 explicit Entry( While Stmt *stmt, Label breakExit, Label contExit ) :69 explicit Entry( WhileDoStmt *stmt, Label breakExit, Label contExit ) : 70 70 stmt( stmt ), breakExit( breakExit ), contExit( contExit ) {} 71 71 -
TabularUnified src/ControlStruct/MultiLevelExit.cpp ¶
r4de48c5 r8cb149f 10 10 // Created On : Mon Nov 1 13:48:00 2021 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jan 31 22:35:08202213 // Update Count : 2 812 // Last Modified On : Tue Feb 1 18:48:47 2022 13 // Update Count : 29 14 14 // 15 15 … … 40 40 41 41 enum Kind { 42 ForStmtK, While StmtK, CompoundStmtK, IfStmtK, CaseStmtK, SwitchStmtK, TryStmtK42 ForStmtK, WhileDoStmtK, CompoundStmtK, IfStmtK, CaseStmtK, SwitchStmtK, TryStmtK 43 43 } kind; 44 44 … … 53 53 Entry( const ForStmt * stmt, Label breakExit, Label contExit ) : 54 54 stmt( stmt ), firstTarget( breakExit ), secondTarget( contExit ), kind( ForStmtK ) {} 55 Entry( const While Stmt * stmt, Label breakExit, Label contExit ) :56 stmt( stmt ), firstTarget( breakExit ), secondTarget( contExit ), kind( While StmtK ) {}55 Entry( const WhileDoStmt * stmt, Label breakExit, Label contExit ) : 56 stmt( stmt ), firstTarget( breakExit ), secondTarget( contExit ), kind( WhileDoStmtK ) {} 57 57 Entry( const CompoundStmt *stmt, Label breakExit ) : 58 58 stmt( stmt ), firstTarget( breakExit ), secondTarget(), kind( CompoundStmtK ) {} … … 66 66 stmt( stmt ), firstTarget( breakExit ), secondTarget(), kind( TryStmtK ) {} 67 67 68 bool isContTarget() const { return kind <= While StmtK; }68 bool isContTarget() const { return kind <= WhileDoStmtK; } 69 69 bool isBreakTarget() const { return kind != CaseStmtK; } 70 70 bool isFallTarget() const { return kind == CaseStmtK; } … … 72 72 73 73 // These routines set a target as being "used" by a BranchStmt 74 Label useContExit() { assert( kind <= While StmtK ); return useTarget(secondTarget); }74 Label useContExit() { assert( kind <= WhileDoStmtK ); return useTarget(secondTarget); } 75 75 Label useBreakExit() { assert( kind != CaseStmtK ); return useTarget(firstTarget); } 76 76 Label useFallExit() { assert( kind == CaseStmtK ); return useTarget(firstTarget); } … … 78 78 79 79 // These routines check if a specific label for a statement is used by a BranchStmt 80 bool isContUsed() const { assert( kind <= While StmtK ); return secondTarget.used; }80 bool isContUsed() const { assert( kind <= WhileDoStmtK ); return secondTarget.used; } 81 81 bool isBreakUsed() const { assert( kind != CaseStmtK ); return firstTarget.used; } 82 82 bool isFallUsed() const { assert( kind == CaseStmtK ); return firstTarget.used; } … … 112 112 const CompoundStmt * previsit( const CompoundStmt * ); 113 113 const BranchStmt * postvisit( const BranchStmt * ); 114 void previsit( const While Stmt * );115 const While Stmt * postvisit( const WhileStmt * );114 void previsit( const WhileDoStmt * ); 115 const WhileDoStmt * postvisit( const WhileDoStmt * ); 116 116 void previsit( const ForStmt * ); 117 117 const ForStmt * postvisit( const ForStmt * ); … … 342 342 } 343 343 344 void MultiLevelExitCore::previsit( const While Stmt * stmt ) {344 void MultiLevelExitCore::previsit( const WhileDoStmt * stmt ) { 345 345 return prehandleLoopStmt( stmt ); 346 346 } 347 347 348 const While Stmt * MultiLevelExitCore::postvisit( const WhileStmt * stmt ) {348 const WhileDoStmt * MultiLevelExitCore::postvisit( const WhileDoStmt * stmt ) { 349 349 return posthandleLoopStmt( stmt ); 350 350 }
Note: See TracChangeset
for help on using the changeset viewer.