source:
src/ControlStruct/LabelGenerator.cc
@
c69adb7
Last change on this file since c69adb7 was 888cbe4, checked in by , 8 years ago | |
---|---|
|
|
File size: 1.2 KB |
Rev | Line | |
---|---|---|
[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" |
[888cbe4] | 21 | #include "SynTree/Attribute.h" |
[51b7345] | 22 | |
23 | namespace ControlStruct { | |
[a08ba92] | 24 | LabelGenerator *LabelGenerator::labelGenerator = 0; |
[51b7345] | 25 | |
[a08ba92] | 26 | LabelGenerator *LabelGenerator::getGenerator() { |
27 | if ( LabelGenerator::labelGenerator == 0 ) | |
28 | LabelGenerator::labelGenerator = new LabelGenerator(); | |
[51b7345] | 29 | |
[a08ba92] | 30 | return labelGenerator; |
31 | } | |
[51b7345] | 32 | |
[de62360d] | 33 | Label LabelGenerator::newLabel( std::string suffix ) { |
[5f2f2d7] | 34 | std::ostringstream os; |
[27de955] | 35 | os << "__L" << current++ << "__" << suffix; |
[5f2f2d7] | 36 | std::string ret = os.str(); |
[888cbe4] | 37 | Label l( ret ); |
38 | l.get_attributes().push_back( new Attribute("unused") ); | |
39 | return l; | |
[a08ba92] | 40 | } |
[51b7345] | 41 | } // namespace ControlStruct |
[a08ba92] | 42 | |
[51587aa] | 43 | // Local Variables: // |
44 | // tab-width: 4 // | |
45 | // mode: c++ // | |
46 | // compile-command: "make install" // | |
47 | // End: // |
Note: See TracBrowser
for help on using the repository browser.