- Timestamp:
- Jun 28, 2018, 3:06:48 PM (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:
- 48ed81c
- Parents:
- 15f5c5e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Validate.cc
r15f5c5e rd419d8e 95 95 void previsit( UnionDecl * aggregateDecl ); 96 96 void previsit( StaticAssertDecl * assertDecl ); 97 void previsit( StructInstType * type ); 98 void previsit( UnionInstType * type ); 99 void previsit( EnumInstType * type ); 97 100 98 101 private: … … 339 342 } 340 343 344 namespace { 345 void qualifiedName( AggregateDecl * aggr, std::ostringstream & ss ) { 346 if ( aggr->parent ) qualifiedName( aggr->parent, ss ); 347 ss << "__" << aggr->name; 348 } 349 350 // mangle nested type names using entire parent chain 351 std::string qualifiedName( AggregateDecl * aggr ) { 352 std::ostringstream ss; 353 qualifiedName( aggr, ss ); 354 return ss.str(); 355 } 356 } 357 341 358 template< typename AggDecl > 342 359 void HoistStruct::handleAggregate( AggDecl *aggregateDecl ) { 343 360 if ( parentAggr ) { 361 aggregateDecl->parent = parentAggr; 362 aggregateDecl->name = qualifiedName( aggregateDecl ); 344 363 // Add elements in stack order corresponding to nesting structure. 345 364 declsToAddBefore.push_front( aggregateDecl ); … … 365 384 handleAggregate( aggregateDecl ); 366 385 } 386 387 void HoistStruct::previsit( StructInstType * type ) { 388 // need to reset type name after expanding to qualified name 389 assert( type->baseStruct ); 390 type->name = type->baseStruct->name; 391 } 392 393 void HoistStruct::previsit( UnionInstType * type ) { 394 assert( type->baseUnion ); 395 type->name = type->baseUnion->name; 396 } 397 398 void HoistStruct::previsit( EnumInstType * type ) { 399 assert( type->baseEnum ); 400 type->name = type->baseEnum->name; 401 } 402 367 403 368 404 void EnumAndPointerDecay::previsit( EnumDecl *enumDecl ) {
Note: See TracChangeset
for help on using the changeset viewer.