source: src/ControlStruct/LabelGenerator.cc @ 0f8e4ac

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 0f8e4ac was 0f8e4ac, checked in by Rob Schluntz <rschlunt@…>, 8 years ago

change Label from a string typedef to a 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//
[0f8e4ac]7// LabelGenerator.cc --
[51587aa]8//
[843054c2]9// Author           : Rodolfo G. Esteves
[51587aa]10// Created On       : Mon May 18 07:44:20 2015
[5f2f2d7]11// Last Modified By : Peter A. Buhr
[de62360d]12// Last Modified On : Tue Jun 23 12:18:34 2015
13// Update Count     : 13
[51587aa]14//
[a08ba92]15
[51b7345]16#include <iostream>
[5f2f2d7]17#include <sstream>
[51b7345]18
19#include "LabelGenerator.h"
[0f8e4ac]20#include "SynTree/Label.h"
[51b7345]21
22namespace ControlStruct {
[a08ba92]23        LabelGenerator *LabelGenerator::labelGenerator = 0;
[51b7345]24
[a08ba92]25        LabelGenerator *LabelGenerator::getGenerator() {
26                if ( LabelGenerator::labelGenerator == 0 )
27                        LabelGenerator::labelGenerator = new LabelGenerator();
[51b7345]28
[a08ba92]29                return labelGenerator;
30        }
[51b7345]31
[de62360d]32        Label LabelGenerator::newLabel( std::string suffix ) {
[5f2f2d7]33                std::ostringstream os;
[27de955]34                os << "__L" << current++ << "__" << suffix;
[5f2f2d7]35                std::string ret = os.str();
[a08ba92]36                return Label( ret );
37        }
[51b7345]38} // namespace ControlStruct
[a08ba92]39
[51587aa]40// Local Variables: //
41// tab-width: 4 //
42// mode: c++ //
43// compile-command: "make install" //
44// End: //
Note: See TracBrowser for help on using the repository browser.