Changes in src/SymTab/Indexer.cc [afc1045:0cb1d61]
- File:
-
- 1 edited
-
src/SymTab/Indexer.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Indexer.cc
rafc1045 r0cb1d61 511 511 } 512 512 513 bool Indexer::hasIncompatibleCDecl( const std::string &id, const std::string &mangleName ) const {513 bool Indexer::hasIncompatibleCDecl( const std::string &id, const std::string &mangleName, unsigned long scope ) const { 514 514 if ( ! tables ) return false; 515 if ( tables->scope < scope ) return false; 515 516 516 517 IdTable::const_iterator decls = tables->idTable.find( id ); … … 524 525 } 525 526 526 return tables->base.hasIncompatibleCDecl( id, mangleName );527 return tables->base.hasIncompatibleCDecl( id, mangleName, scope ); 527 528 } 528 529 … … 617 618 DeclarationWithType *existing = lookupIdAtScope( name, mangleName, scope ); 618 619 if ( ! existing || ! addedIdConflicts( existing, decl ) ) { 619 // this ensures that no two declarations with the same unmangled name both have C linkage620 if ( decl->get_linkage() == LinkageSpec::C && hasIncompatibleCDecl( name, mangleName ) ) {620 // this ensures that no two declarations with the same unmangled name at the same scope both have C linkage 621 if ( decl->get_linkage() == LinkageSpec::C && hasIncompatibleCDecl( name, mangleName, scope ) ) { 621 622 throw SemanticError( "invalid overload of C function ", decl ); 622 623 } // NOTE this is broken in Richard's original code in such a way that it never triggers (it … … 783 784 using std::cerr; 784 785 785 cerr << "===idTable===" << std::endl; 786 if ( tables ) dump( tables->idTable, os ); 787 cerr << "===typeTable===" << std::endl; 788 if ( tables ) dump( tables->typeTable, os ); 789 cerr << "===structTable===" << std::endl; 790 if ( tables ) dump( tables->structTable, os ); 791 cerr << "===enumTable===" << std::endl; 792 if ( tables ) dump( tables->enumTable, os ); 793 cerr << "===unionTable===" << std::endl; 794 if ( tables ) dump( tables->unionTable, os ); 795 cerr << "===contextTable===" << std::endl; 796 if ( tables ) dump( tables->traitTable, os ); 786 if ( tables ) { 787 os << "--- scope " << tables->scope << " ---" << std::endl; 788 789 os << "===idTable===" << std::endl; 790 dump( tables->idTable, os ); 791 os << "===typeTable===" << std::endl; 792 dump( tables->typeTable, os ); 793 os << "===structTable===" << std::endl; 794 dump( tables->structTable, os ); 795 os << "===enumTable===" << std::endl; 796 dump( tables->enumTable, os ); 797 os << "===unionTable===" << std::endl; 798 dump( tables->unionTable, os ); 799 os << "===contextTable===" << std::endl; 800 dump( tables->traitTable, os ); 801 802 tables->base.print( os, indent ); 803 } else { 804 os << "--- end ---" << std::endl; 805 } 806 797 807 } 798 808 } // namespace SymTab
Note:
See TracChangeset
for help on using the changeset viewer.