// // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo // // The contents of this file are covered under the licence agreement in the // file "LICENCE" distributed with Cforall. // // LabelGenerator.h -- // // Author : Rodolfo G. Esteves // Created On : Mon May 18 07:44:20 2015 // Last Modified By : Andrew Beach // Last Modified On : Mon Nov 1 12:19:00 2021 // Update Count : 7 // #pragma once #include // for string #include "SynTree/Label.h" // for Label class Statement; namespace ast { class Stmt; class Label; } namespace ControlStruct { class LabelGenerator { public: static LabelGenerator *getGenerator(); Label newLabel(std::string suffix, Statement * stmt = nullptr); void reset() { current = 0; } void rewind() { current--; } protected: LabelGenerator(): current(0) {} private: int current; static LabelGenerator *labelGenerator; }; class LabelGenerator_new { int current; static LabelGenerator_new *labelGenerator; LabelGenerator_new() : current(0) {} public: static LabelGenerator_new *getGenerator(); ast::Label newLabel( const std::string& suffix, const ast::Stmt * stmt ); void reset() { current = 0; } void rewind() { --current; } }; } // namespace ControlStruct // Local Variables: // // tab-width: 4 // // mode: c++ // // compile-command: "make install" // // End: //