Changeset b8ab91a for src/ControlStruct/LabelGenerator.cc
- Timestamp:
- Nov 5, 2021, 1:46:46 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 21fe17f
- Parents:
- 77c01ec
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ControlStruct/LabelGenerator.cc
r77c01ec rb8ab91a 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Mon Mar 11 22:23:20 201913 // Update Count : 1 511 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Nov 1 12:21:00 2021 13 // Update Count : 16 14 14 // 15 15 … … 19 19 20 20 #include "LabelGenerator.h" 21 22 #include "AST/Attribute.hpp" 23 #include "AST/Label.hpp" 24 #include "AST/Stmt.hpp" 21 25 #include "SynTree/Attribute.h" // for Attribute 22 26 #include "SynTree/Label.h" // for Label, operator<< … … 43 47 return l; 44 48 } 49 50 LabelGenerator_new * LabelGenerator_new::labelGenerator = nullptr; 51 52 LabelGenerator_new * LabelGenerator_new::getGenerator() { 53 if ( nullptr == labelGenerator ) { 54 labelGenerator = new LabelGenerator_new(); 55 } 56 return labelGenerator; 57 } 58 59 ast::Label LabelGenerator_new::newLabel( 60 const std::string & suffix, const ast::Stmt * stmt ) { 61 assert( stmt ); 62 63 std::ostringstream os; 64 os << "__L" << current++ << "__" << suffix; 65 if ( stmt && !stmt->labels.empty() ) { 66 os << "_" << stmt->labels.front() << "__"; 67 } 68 ast::Label ret_label( stmt->location, os.str() ); 69 ret_label.attributes.push_back( new ast::Attribute( "unused" ) ); 70 return ret_label; 71 } 72 45 73 } // namespace ControlStruct 46 74
Note: See TracChangeset
for help on using the changeset viewer.