source: src/ControlStruct/LabelGenerator.h @ a488783

ADTast-experimentalenumforall-pointer-decaypthread-emulationqualifiedEnum
Last change on this file since a488783 was de31a1d, checked in by Andrew Beach <ajbeach@…>, 3 years ago

Converted the two LabelGenerator? singletons into a single pure-static class.

  • Property mode set to 100644
File size: 1.1 KB
RevLine 
[51587aa]1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
[af68f0a]7// LabelGenerator.h --
[51587aa]8//
[843054c2]9// Author           : Rodolfo G. Esteves
[51587aa]10// Created On       : Mon May 18 07:44:20 2015
[b8ab91a]11// Last Modified By : Andrew Beach
[de31a1d]12// Last Modified On : Mon Nov  8 10:16:00 2021
13// Update Count     : 8
[51587aa]14//
[a08ba92]15
[6b0b624]16#pragma once
[51b7345]17
[d180746]18#include <string>           // for string
19
20#include "SynTree/Label.h"  // for Label
21
22class Statement;
[b8ab91a]23namespace ast {
24        class Stmt;
25        class Label;
26}
[51b7345]27
28namespace ControlStruct {
[b8ab91a]29
[de31a1d]30class LabelGenerator {
31        static int current;
32        static LabelGenerator *labelGenerator;
33protected:
34        LabelGenerator() {}
35public:
36        static LabelGenerator *getGenerator();
37        static Label newLabel(std::string suffix, Statement * stmt = nullptr);
38        static ast::Label newLabel( const std::string&, const ast::Stmt * );
39        static void reset() { current = 0; }
40        static void rewind() { current--; }
[b8ab91a]41};
42
[51b7345]43} // namespace ControlStruct
44
[51587aa]45// Local Variables: //
46// tab-width: 4 //
47// mode: c++ //
48// compile-command: "make install" //
49// End: //
Note: See TracBrowser for help on using the repository browser.