Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r45161b4d r630a82a  
    1010// Created On       : Sun May 17 21:50:04 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Apr 13 16:39:30 2016
    13 // Update Count     : 251
     12// Last Modified On : Thu Apr  7 16:45:30 2016
     13// Update Count     : 243
    1414//
    1515
     
    190190                AggDecl *handleAggregate( AggDecl * aggDecl );
    191191
    192                 template<typename AggDecl>
    193                 void addImplicitTypedef( AggDecl * aggDecl );
    194                
    195192                typedef std::map< std::string, std::pair< TypedefDecl *, int > > TypedefMap;
    196193                TypedefMap typedefNames;
     
    10171014        }
    10181015
    1019         // there may be typedefs nested within aggregates in order for everything to work properly, these should be removed
    1020         // as well
     1016        // there may be typedefs nested within aggregates
     1017        // in order for everything to work properly, these
     1018        // should be removed as well
    10211019        template<typename AggDecl>
    10221020        AggDecl *EliminateTypedef::handleAggregate( AggDecl * aggDecl ) {
     
    10321030                return aggDecl;
    10331031        }
    1034        
    1035         template<typename AggDecl>
    1036         void EliminateTypedef::addImplicitTypedef( AggDecl * aggDecl ) {
    1037                 if ( typedefNames.count( aggDecl->get_name() ) == 0 ) {
    1038                         Type *type;
    1039                         if ( StructDecl * newDeclStructDecl = dynamic_cast< StructDecl * >( aggDecl ) ) {
    1040                                 type = new StructInstType( Type::Qualifiers(), newDeclStructDecl->get_name() );
    1041                         } else if ( UnionDecl * newDeclUnionDecl = dynamic_cast< UnionDecl * >( aggDecl ) ) {
    1042                                 type = new UnionInstType( Type::Qualifiers(), newDeclUnionDecl->get_name() );
    1043                         } else if ( EnumDecl * newDeclEnumDecl = dynamic_cast< EnumDecl * >( aggDecl )  ) {
    1044                                 type = new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() );
    1045                         } // if
    1046                         TypedefDecl * tyDecl = new TypedefDecl( aggDecl->get_name(), DeclarationNode::NoStorageClass, type );
    1047                         typedefNames[ aggDecl->get_name() ] = std::make_pair( tyDecl, scopeLevel );
    1048                 } // if
    1049         }
     1032
    10501033        Declaration *EliminateTypedef::mutate( StructDecl * structDecl ) {
    1051                 addImplicitTypedef( structDecl );
    10521034                Mutator::mutate( structDecl );
    10531035                return handleAggregate( structDecl );
     
    10551037
    10561038        Declaration *EliminateTypedef::mutate( UnionDecl * unionDecl ) {
    1057                 addImplicitTypedef( unionDecl );
    10581039                Mutator::mutate( unionDecl );
    10591040                return handleAggregate( unionDecl );
     
    10611042
    10621043        Declaration *EliminateTypedef::mutate( EnumDecl * enumDecl ) {
    1063                 addImplicitTypedef( enumDecl );
    10641044                Mutator::mutate( enumDecl );
    10651045                return handleAggregate( enumDecl );
    10661046        }
    10671047
    1068         Declaration *EliminateTypedef::mutate( TraitDecl * contextDecl ) {
     1048                Declaration *EliminateTypedef::mutate( TraitDecl * contextDecl ) {
    10691049                Mutator::mutate( contextDecl );
    10701050                return handleAggregate( contextDecl );
Note: See TracChangeset for help on using the changeset viewer.