Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/IdTable.cc

    r4aa0858 r843054c2  
    99// Author           : Richard C. Bilson
    1010// Created On       : Sun May 17 17:04:02 2015
    11 // Last Modified By : Rob Schluntz
    12 // Last Modified On : Wed Aug 19 15:47:58 2015
    13 // Update Count     : 38
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Sun May 17 17:07:43 2015
     13// Update Count     : 3
    1414//
    1515
     
    5252                if ( decl->get_linkage() == LinkageSpec::C ) {
    5353                        manglename = name;
    54                 } else if ( LinkageSpec::isOverridable( decl->get_linkage() ) ) {
    55                         // mangle the name without including the appropriate suffix
    56                         // this will make it so that overridable routines are placed
    57                         // into the same "bucket" as their user defined versions.
    58                         manglename = Mangler::mangle( decl, false );
    5954                } else {
    6055                        manglename = Mangler::mangle( decl );
     
    6964                        std::stack< DeclEntry >& entry = it->second;
    7065                        if ( ! entry.empty() && entry.top().second == scopeLevel ) {
    71                                 // typesCompatible doesn't really do the right thing here. When checking compatibility of function types,
    72                                 // we should ignore outermost pointer qualifiers, except _Atomic?
    73 
    7466                                if ( decl->get_linkage() != LinkageSpec::C || ResolvExpr::typesCompatible( decl->get_type(), entry.top().first->get_type(), Indexer() ) ) {
    7567                                        FunctionDecl *newentry = dynamic_cast< FunctionDecl* >( decl );
    7668                                        FunctionDecl *old = dynamic_cast< FunctionDecl* >( entry.top().first );
    77                                         if ( LinkageSpec::isOverridable( old->get_linkage() ) ) {
    78                                                 // new definition shadows the autogenerated one, even at the same scope
    79                                                 declTable[ manglename ].push( DeclEntry( decl, scopeLevel ) );
    80                                         } else if ( newentry && old && newentry->get_statements() && old->get_statements() ) {
    81                                                 throw SemanticError( "duplicate function definition for 1 ", decl );
     69                                        if ( newentry && old && newentry->get_statements() && old->get_statements() ) {
     70                                                throw SemanticError( "duplicate function definition for ", decl );
    8271                                        } else {
    83                                                 // two objects with the same mangled name defined in the same scope.
    84                                                 // both objects must be marked extern for this to be okay
    8572                                                ObjectDecl *newobj = dynamic_cast< ObjectDecl* >( decl );
    8673                                                ObjectDecl *oldobj = dynamic_cast< ObjectDecl* >( entry.top().first );
    87                                                 if ( newobj && oldobj && newobj->get_storageClass() != DeclarationNode::Extern && oldobj->get_storageClass() != DeclarationNode::Extern ) {
     74                                                if ( newobj && oldobj && newobj->get_init() && oldobj->get_init() ) {
    8875                                                        throw SemanticError( "duplicate definition for ", decl );
    8976                                                } // if
    9077                                        } // if
    9178                                } else {
    92                                         // C definitions with the same name but incompatible types
    93                                         throw SemanticError( "duplicate definition for 2 ", decl );
     79                                        throw SemanticError( "duplicate definition for ", decl );
    9480                                } // if
    9581                        } else {
     
    9884                } // if
    9985                // ensure the set of routines with C linkage cannot be overloaded
    100                 // this ensures that no two declarations with the same unmangled name both have C linkage
    10186                for ( InnerTableType::iterator i = declTable.begin(); i != declTable.end(); ++i ) {
    10287                        if ( ! i->second.empty() && i->second.top().first->get_linkage() == LinkageSpec::C && declTable.size() > 1 ) {
Note: See TracChangeset for help on using the changeset viewer.