ADT
        aaron-thesis
        arm-eh
        ast-experimental
        cleanup-dtors
        deferred_resn
        demangler
        enum
        forall-pointer-decay
        jacob/cs343-translation
        jenkins-sandbox
        new-ast
        new-ast-unique-expr
        new-env
        no_list
        persistent-indexer
        pthread-emulation
        qualifiedEnum
        resolv-new
        with_gc
      
      
      
| Line |   | 
|---|
| 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 | //
 | 
|---|
| 7 | // LabelGenerator.cc --
 | 
|---|
| 8 | //
 | 
|---|
| 9 | // Author           : Rodolfo G. Esteves
 | 
|---|
| 10 | // Created On       : Mon May 18 07:44:20 2015
 | 
|---|
| 11 | // Last Modified By : Andrew Beach
 | 
|---|
| 12 | // Last Modified On : Thr Aug 14 14:14:00 2015
 | 
|---|
| 13 | // Update Count     : 14
 | 
|---|
| 14 | //
 | 
|---|
| 15 | 
 | 
|---|
| 16 | #include <iostream>             // for operator<<, basic_ostream
 | 
|---|
| 17 | #include <sstream>              // for ostringstream
 | 
|---|
| 18 | #include <list>                 // for list
 | 
|---|
| 19 | 
 | 
|---|
| 20 | #include "LabelGenerator.h"
 | 
|---|
| 21 | #include "SynTree/Attribute.h"  // for Attribute
 | 
|---|
| 22 | #include "SynTree/Label.h"      // for Label, operator<<
 | 
|---|
| 23 | #include "SynTree/Statement.h"  // for Statement
 | 
|---|
| 24 | 
 | 
|---|
| 25 | namespace ControlStruct {
 | 
|---|
| 26 |         LabelGenerator *LabelGenerator::labelGenerator = 0;
 | 
|---|
| 27 | 
 | 
|---|
| 28 |         LabelGenerator *LabelGenerator::getGenerator() {
 | 
|---|
| 29 |                 if ( LabelGenerator::labelGenerator == 0 )
 | 
|---|
| 30 |                         LabelGenerator::labelGenerator = new LabelGenerator();
 | 
|---|
| 31 | 
 | 
|---|
| 32 |                 return labelGenerator;
 | 
|---|
| 33 |         }
 | 
|---|
| 34 | 
 | 
|---|
| 35 |         Label LabelGenerator::newLabel( std::string suffix, Statement * stmt ) {
 | 
|---|
| 36 |                 std::ostringstream os;
 | 
|---|
| 37 |                 os << "__L" << current++ << "__" << suffix;
 | 
|---|
| 38 |                 if ( stmt && ! stmt->get_labels().empty() ) {
 | 
|---|
| 39 |                         os << "_" << stmt->get_labels().front() << "__";
 | 
|---|
| 40 |                 }
 | 
|---|
| 41 |                 std::string ret = os.str();
 | 
|---|
| 42 |                 Label l( ret );
 | 
|---|
| 43 |                 l.get_attributes().push_back( new Attribute("unused") );
 | 
|---|
| 44 |                 return l;
 | 
|---|
| 45 |         }
 | 
|---|
| 46 | } // namespace ControlStruct
 | 
|---|
| 47 | 
 | 
|---|
| 48 | // Local Variables: //
 | 
|---|
| 49 | // tab-width: 4 //
 | 
|---|
| 50 | // mode: c++ //
 | 
|---|
| 51 | // compile-command: "make install" //
 | 
|---|
| 52 | // End: //
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.