Ignore:
Timestamp:
Apr 4, 2016, 1:18:17 PM (8 years ago)
Author:
Aaron Moss <a3moss@…>
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:
afc1045
Parents:
89173242 (diff), 3cfe27f (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/TypedefTable.cc

    r89173242 rb3f9a0cb  
    1010// Created On       : Sat May 16 15:20:13 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Mar  2 17:25:55 2016
    13 // Update Count     : 20
     12// Last Modified On : Mon Mar 21 18:18:58 2016
     13// Update Count     : 23
    1414//
    1515
    1616#include <map>
    1717#include <list>
     18#include <cassert>
    1819#include "TypedefTable.h"
    19 #include <cassert>
    2020using namespace std;
    2121
     
    2929TypedefTable::TypedefTable() : currentScope( 0 ) {}
    3030
     31bool TypedefTable::exists( const string &identifier ) {
     32        return table.count( identifier ) > 0;
     33}
     34
    3135void TypedefTable::changeKind( const string &identifier, kind_t kind ) {
    3236        tableType::iterator id_pos = table.find( identifier );
    33         if ( id_pos == table.end() ) {
    34                 return;
    35         } else {
    36                 (*((*id_pos ).second.begin())).kind = kind;
    37                 return;
    38         } // if
     37        if ( id_pos == table.end() ) return;
     38        id_pos->second.begin()->kind = kind;
    3939}
    4040
    41 bool TypedefTable::isKind( const string &identifier, kind_t kind ) const {
     41int TypedefTable::isKind( const string &identifier ) const {
    4242        tableType::const_iterator id_pos = table.find( identifier );
    43         if ( id_pos == table.end() ) {
    44                 return true;
    45         } else {
    46                 return (*((*id_pos ).second.begin())).kind == kind;
    47         } // if
    48 }
    49 
    50 bool TypedefTable::isIdentifier( const string &identifier ) const {
    51         return isKind( identifier, ID );
    52 }
    53 
    54 bool TypedefTable::isTypedef( const string &identifier ) const {
    55         return isKind( identifier, TD );
    56 }
    57 
    58 bool TypedefTable::isTypegen( const string &identifier ) const {
    59         return isKind( identifier, TG );
     43        // Name lookup defaults to identifier, and then the identifier's kind is set by the parser.
     44        if ( id_pos == table.end() ) return IDENTIFIER;
     45        return id_pos->second.begin()->kind;
    6046}
    6147
Note: See TracChangeset for help on using the changeset viewer.