Changeset c6e2c18 for src/SymTab
- Timestamp:
- Nov 28, 2017, 10:21:50 AM (8 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 9c35431
- Parents:
- c0d00b6 (diff), c029f4d (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. - Location:
- src/SymTab
- Files:
-
- 2 edited
-
Autogen.cc (modified) (2 diffs)
-
Validate.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Autogen.cc
rc0d00b6 rc6e2c18 375 375 continue; 376 376 } 377 memCtorType->parameters.push_back( new ObjectDecl( field->name, Type::StorageClasses(), LinkageSpec::Cforall, 0, field->get_type()->clone(), 0 ) ); 377 // do not carry over field's attributes to parameter type 378 Type * paramType = field->get_type()->clone(); 379 deleteAll( paramType->attributes ); 380 paramType->attributes.clear(); 381 // add a parameter corresponding to this field 382 memCtorType->parameters.push_back( new ObjectDecl( field->name, Type::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType, nullptr ) ); 378 383 FunctionDecl * ctor = genFunc( "?{}", memCtorType->clone(), functionNesting ); 379 384 makeFieldCtorBody( aggregateDecl->members.begin(), aggregateDecl->members.end(), ctor ); … … 506 511 break; 507 512 } 508 memCtorType->parameters.push_back( new ObjectDecl( field->name, Type::StorageClasses(), LinkageSpec::Cforall, nullptr, field->get_type()->clone(), nullptr ) ); 513 // do not carry over field's attributes to parameter type 514 Type * paramType = field->get_type()->clone(); 515 deleteAll( paramType->attributes ); 516 paramType->attributes.clear(); 517 // add a parameter corresponding to this field 518 memCtorType->parameters.push_back( new ObjectDecl( field->name, Type::StorageClasses(), LinkageSpec::Cforall, nullptr, paramType, nullptr ) ); 509 519 FunctionDecl * ctor = genFunc( "?{}", memCtorType->clone(), functionNesting ); 510 520 ObjectDecl * srcParam = strict_dynamic_cast<ObjectDecl *>( ctor->type->parameters.back() ); -
src/SymTab/Validate.cc
rc0d00b6 rc6e2c18 201 201 Declaration * postmutate( TraitDecl * contextDecl ); 202 202 203 void premutate( FunctionType * ftype ); 204 203 205 private: 204 206 template<typename AggDecl> … … 214 216 TypeDeclMap typedeclNames; 215 217 int scopeLevel; 218 bool inFunctionType = false; 216 219 }; 217 220 … … 725 728 Type *ret = def->second.first->base->clone(); 726 729 ret->get_qualifiers() |= typeInst->get_qualifiers(); 730 // attributes are not carried over from typedef to function parameters/return values 731 if ( ! inFunctionType ) { 732 ret->attributes.splice( ret->attributes.end(), typeInst->attributes ); 733 } else { 734 deleteAll( ret->attributes ); 735 ret->attributes.clear(); 736 } 727 737 // place instance parameters on the typedef'd type 728 738 if ( ! typeInst->parameters.empty() ) { … … 901 911 Declaration *EliminateTypedef::postmutate( TraitDecl * traitDecl ) { 902 912 return handleAggregate( traitDecl ); 913 } 914 915 void EliminateTypedef::premutate( FunctionType * ) { 916 GuardValue( inFunctionType ); 917 inFunctionType = true; 903 918 } 904 919
Note:
See TracChangeset
for help on using the changeset viewer.