Changeset 09d1ad0 for src/SymTab
- Timestamp:
- Apr 19, 2016, 3:57:26 PM (8 years ago)
- 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:
- 6b6597c
- Parents:
- b644d6f
- Location:
- src/SymTab
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Indexer.cc
rb644d6f r09d1ad0 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 -
src/SymTab/Indexer.h
rb644d6f r09d1ad0 99 99 DeclarationWithType *lookupIdAtScope( const std::string &id, const std::string &mangleName, unsigned long scope ) const; 100 100 /// returns true if there exists a declaration with C linkage and the given name with a different mangled name 101 bool hasIncompatibleCDecl( const std::string &id, const std::string &mangleName ) const;101 bool hasIncompatibleCDecl( const std::string &id, const std::string &mangleName, unsigned long scope ) const; 102 102 // equivalents to lookup functions that only look at tables at scope `scope` (which should be >= tables->scope) 103 103 NamedTypeDecl *lookupTypeAtScope( const std::string &id, unsigned long scope ) const;
Note: See TracChangeset
for help on using the changeset viewer.