Changeset 777ed2b for src/SymTab/Indexer.cc
- Timestamp:
- Jul 11, 2018, 11:55:59 AM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 0fc52b6
- Parents:
- fc20514 (diff), 7de22b28 (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Indexer.cc
rfc20514 r777ed2b 272 272 } 273 273 274 NamedTypeDecl *Indexer::globalLookupType( const std::string &id ) const { 275 return lookupTypeAtScope( id, 0 ); 276 } 277 278 StructDecl *Indexer::globalLookupStruct( const std::string &id ) const { 279 return lookupStructAtScope( id, 0 ); 280 } 281 282 UnionDecl *Indexer::globalLookupUnion( const std::string &id ) const { 283 return lookupUnionAtScope( id, 0 ); 284 } 285 286 EnumDecl *Indexer::globalLookupEnum( const std::string &id ) const { 287 return lookupEnumAtScope( id, 0 ); 288 } 289 274 290 EnumDecl *Indexer::lookupEnum( const std::string &id ) const { 275 291 if ( ! tables ) return 0; … … 347 363 if ( ! tables ) return 0; 348 364 if ( tables->scope < scope ) return 0; 365 if ( tables->scope > scope ) return tables->base.lookupTypeAtScope( id, scope ); 349 366 350 367 TypeTable::const_iterator ret = tables->typeTable.find( id ); … … 355 372 if ( ! tables ) return 0; 356 373 if ( tables->scope < scope ) return 0; 374 if ( tables->scope > scope ) return tables->base.lookupStructAtScope( id, scope ); 357 375 358 376 StructTable::const_iterator ret = tables->structTable.find( id ); … … 363 381 if ( ! tables ) return 0; 364 382 if ( tables->scope < scope ) return 0; 383 if ( tables->scope > scope ) return tables->base.lookupEnumAtScope( id, scope ); 365 384 366 385 EnumTable::const_iterator ret = tables->enumTable.find( id ); … … 371 390 if ( ! tables ) return 0; 372 391 if ( tables->scope < scope ) return 0; 392 if ( tables->scope > scope ) return tables->base.lookupUnionAtScope( id, scope ); 373 393 374 394 UnionTable::const_iterator ret = tables->unionTable.find( id ); … … 379 399 if ( ! tables ) return 0; 380 400 if ( tables->scope < scope ) return 0; 401 if ( tables->scope > scope ) return tables->base.lookupTraitAtScope( id, scope ); 381 402 382 403 TraitTable::const_iterator ret = tables->traitTable.find( id ); … … 486 507 487 508 bool addedTypeConflicts( NamedTypeDecl *existing, NamedTypeDecl *added ) { 488 if ( existing-> get_base() == 0) {509 if ( existing->base == nullptr ) { 489 510 return false; 490 } else if ( added-> get_base() == 0) {511 } else if ( added->base == nullptr ) { 491 512 return true; 492 513 } else { 493 SemanticError( added, "redeclaration of " ); 494 } 514 assert( existing->base && added->base ); 515 // typedef redeclarations are errors only if types are different 516 if ( ! ResolvExpr::typesCompatible( existing->base, added->base, Indexer() ) ) { 517 SemanticError( added->location, "redeclaration of " + added->name ); 518 } 519 } 520 // does not need to be added to the table if both existing and added have a base that are the same 521 return true; 495 522 } 496 523 … … 499 526 makeWritable(); 500 527 501 const std::string &id = decl-> get_name();528 const std::string &id = decl->name; 502 529 TypeTable::iterator existing = tables->typeTable.find( id ); 503 530 if ( existing == tables->typeTable.end() ) { … … 532 559 makeWritable(); 533 560 534 const std::string &id = decl-> get_name();561 const std::string &id = decl->name; 535 562 StructTable::iterator existing = tables->structTable.find( id ); 536 563 if ( existing == tables->structTable.end() ) { … … 551 578 makeWritable(); 552 579 553 const std::string &id = decl-> get_name();580 const std::string &id = decl->name; 554 581 EnumTable::iterator existing = tables->enumTable.find( id ); 555 582 if ( existing == tables->enumTable.end() ) { … … 575 602 makeWritable(); 576 603 577 const std::string &id = decl-> get_name();604 const std::string &id = decl->name; 578 605 UnionTable::iterator existing = tables->unionTable.find( id ); 579 606 if ( existing == tables->unionTable.end() ) { … … 594 621 makeWritable(); 595 622 596 const std::string &id = decl-> get_name();623 const std::string &id = decl->name; 597 624 TraitTable::iterator existing = tables->traitTable.find( id ); 598 625 if ( existing == tables->traitTable.end() ) {
Note: See TracChangeset
for help on using the changeset viewer.