Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/ControlStruct/LabelFixer.h

    r51ec1ab ra16764a6  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jan 31 22:28:04 2022
    13 // Update Count     : 35
     12// Last Modified On : Sat Jul 22 09:17:24 2017
     13// Update Count     : 34
    1414//
    1515
     
    2626
    2727namespace ControlStruct {
    28 // normalizes label definitions and generates multi-level exit labels
    29 class LabelGenerator;
     28        /// normalizes label definitions and generates multi-level exit labels
     29        class LabelGenerator;
    3030
    31 class LabelFixer final : public WithGuards {
    32   public:
    33         LabelFixer( LabelGenerator *gen = 0 );
     31        class LabelFixer final : public WithGuards {
     32          public:
     33                LabelFixer( LabelGenerator *gen = 0 );
    3434
    35         std::map < Label, Statement * > *resolveJumps() throw ( SemanticErrorException );
     35                std::map < Label, Statement * > *resolveJumps() throw ( SemanticErrorException );
    3636
    37         // Declarations
    38         void previsit( FunctionDecl *functionDecl );
    39         void postvisit( FunctionDecl *functionDecl );
     37                // Declarations
     38                void previsit( FunctionDecl *functionDecl );
     39                void postvisit( FunctionDecl *functionDecl );
    4040
    41         // Statements
    42         void previsit( Statement *stmt );
    43         void previsit( BranchStmt *branchStmt );
     41                // Statements
     42                void previsit( Statement *stmt );
     43                void previsit( BranchStmt *branchStmt );
    4444
    45         // Expressions
    46         void previsit( LabelAddressExpr *addrExpr );
     45                // Expressions
     46                void previsit( LabelAddressExpr *addrExpr );
    4747
    48         Label setLabelsDef( std::list< Label > &, Statement *definition );
    49         template< typename UsageNode >
    50         void setLabelsUsg( Label, UsageNode *usage = 0 );
    51 
    52   private:
    53         class Entry {
    54                 public:
    55                 Entry( Statement *to ) : definition( to ) {}
    56                 bool defined() { return ( definition != 0 ); }
    57                 bool insideLoop();
    58 
    59                 Label get_label() const { return label; }
    60                 void set_label( Label lab ) { label = lab; }
    61 
    62                 Statement *get_definition() const { return definition; }
    63                 void set_definition( Statement *def ) { definition = def; }
     48                Label setLabelsDef( std::list< Label > &, Statement *definition );
     49                template< typename UsageNode >
     50                void setLabelsUsg( Label, UsageNode *usage = 0 );
    6451
    6552          private:
    66                 Label label;
    67                 Statement *definition;
     53                class Entry {
     54                        public:
     55                        Entry( Statement *to ) : definition( to ) {}
     56                        bool defined() { return ( definition != 0 ); }
     57                        bool insideLoop();
     58
     59                        Label get_label() const { return label; }
     60                        void set_label( Label lab ) { label = lab; }
     61
     62                        Statement *get_definition() const { return definition; }
     63                        void set_definition( Statement *def ) { definition = def; }
     64
     65                  private:
     66                        Label label;
     67                        Statement *definition;
     68                };
     69
     70                std::map < Label, Entry *> labelTable;
     71                LabelGenerator *generator;
    6872        };
    69 
    70         std::map < Label, Entry *> labelTable;
    71         LabelGenerator *generator;
    72 };
    7373} // namespace ControlStruct
    7474
Note: See TracChangeset for help on using the changeset viewer.