Ignore:
Timestamp:
Jun 24, 2015, 4:04:19 PM (10 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
Children:
94e0864d
Parents:
a1d5d2a
Message:

fix computed goto, fixed -std=, implicit typedefs for enum and aggregates, add _Noreturn _Thread_local

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TypedefTable.cc

    ra1d5d2a rde62360d  
    1010// Created On       : Sat May 16 15:20:13 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat May 16 15:24:03 2015
    13 // Update Count     : 2
     12// Last Modified On : Sun Jun 21 11:46:15 2015
     13// Update Count     : 7
    1414//
    1515
     
    2929TypedefTable::TypedefTable() : currentScope( 0 ) {}
    3030
    31 bool TypedefTable::isKind( string identifier, kind_t kind ) const {
     31bool TypedefTable::isKind( const string &identifier, kind_t kind ) const {
    3232        tableType::const_iterator id_pos = table.find( identifier );
    33         if ( id_pos == table.end()) {
     33        if ( id_pos == table.end() ) {
    3434                return true;
    3535        } else {
    3636                return (*((*id_pos ).second.begin())).kind == kind;
    37         }
     37        } // if
    3838}
    3939
    40 bool TypedefTable::isIdentifier( string identifier ) const {
     40bool TypedefTable::isIdentifier( const string &identifier ) const {
    4141        return isKind( identifier, ID );
    4242}
    4343
    44 bool TypedefTable::isTypedef( string identifier ) const {
     44bool TypedefTable::isTypedef( const string &identifier ) const {
    4545        return isKind( identifier, TD );
    4646}
    4747
    48 bool TypedefTable::isTypegen( string identifier ) const {
     48bool TypedefTable::isTypegen( const string &identifier ) const {
    4949        return isKind( identifier, TG );
    5050}
     
    6666                        while ( listPos != (*curPos ).second.end() && listPos->scope > scope ) {
    6767                                listPos++;
    68                         }
     68                        } // while
    6969                        (*curPos ).second.insert( listPos, newEntry );
    70                 }
    71         }
     70                } // if
     71        } // if
    7272}
    7373
     
    102102}
    103103
    104 void TypedefTable::openContext( std::string contextName ) {
     104void TypedefTable::openContext( const std::string &contextName ) {
    105105        map< string, deferListType >::iterator i = contexts.find( contextName );
    106106        if ( i != contexts.end() ) {
     
    108108                for ( deferListType::iterator i = entries.begin(); i != entries.end(); i++) {
    109109                        addToEnclosingScope( i->identifier, i->kind );
    110                 }
    111         }
     110                } // for
     111        } // if
    112112}
    113113
    114 void TypedefTable::enterScope( void ) {
     114void TypedefTable::enterScope() {
    115115        currentScope += 1;
    116116        deferListStack.push( deferListType() );
     
    119119}
    120120
    121 void TypedefTable::leaveScope( void ) {
     121void TypedefTable::leaveScope() {
    122122        debugPrint( "Leaving scope " << currentScope << endl );
    123123        for ( tableType::iterator i = table.begin(); i != table.end(); ) {
     
    129129                        table.erase( i++ );
    130130                } else ++i;
    131         }
     131        } // for
    132132        currentScope -= 1;
    133133        for ( deferListType::iterator i = deferListStack.top().begin(); i != deferListStack.top().end(); i++) {
    134134                addToCurrentScope( i->identifier, i->kind );
    135         }
     135        } // for
    136136        deferListStack.pop();
    137137        debugPrint( "nextIdentifiers size is " << nextIdentifiers.size() << " top is " << nextIdentifiers.top() << endl );
     
    139139}
    140140
    141 void TypedefTable::enterContext( std::string contextName ) {
     141void TypedefTable::enterContext( const std::string &contextName ) {
    142142        currentContext = contextName;
    143143        contextScope = currentScope;
    144144}
    145145
    146 void TypedefTable::leaveContext( void ) {
     146void TypedefTable::leaveContext() {
    147147        currentContext = "";
    148148}
     
    156156                }
    157157                debugPrint( endl );
    158         }
     158        } // for
    159159}
    160160
Note: See TracChangeset for help on using the changeset viewer.