Changes in src/SymTab/Autogen.cc [fa4805f:ce8c12f]
- File:
-
- 1 edited
-
src/SymTab/Autogen.cc (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Autogen.cc
rfa4805f rce8c12f 9 9 // Author : Rob Schluntz 10 10 // Created On : Thu Mar 03 15:45:56 2016 11 // Last Modified By : Andrew Beach12 // Last Modified On : Wed Jun 28 15:30:00201713 // Update Count : 6 111 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 17 09:41:08 2017 13 // Update Count : 60 14 14 // 15 15 … … 176 176 FunctionType * ftype = funcDecl->get_functionType(); 177 177 assert( ! ftype->get_parameters().empty() ); 178 Type * t = safe_dynamic_cast< PointerType * >( ftype->get_parameters().front()->get_type() )->get_base(); 178 Type * t = InitTweak::getPointerBase( ftype->get_parameters().front()->get_type() ); 179 assert( t ); 179 180 map.insert( Mangler::mangleType( t ), true ); 180 181 } … … 262 263 // E ?=?(E volatile*, int), 263 264 // ?=?(E _Atomic volatile*, int); 264 void makeEnumFunctions( Enum InstType *refType, unsigned int functionNesting, std::list< Declaration * > &declsToAdd ) {265 void makeEnumFunctions( EnumDecl *enumDecl, EnumInstType *refType, unsigned int functionNesting, std::list< Declaration * > &declsToAdd ) { 265 266 266 267 // T ?=?(E *, E); … … 400 401 /// generates struct constructors, destructor, and assignment functions 401 402 void makeStructFunctions( StructDecl *aggregateDecl, StructInstType *refType, unsigned int functionNesting, std::list< Declaration * > & declsToAdd, const std::vector< FuncData > & data ) { 402 // Builtins do not use autogeneration.403 if ( aggregateDecl->get_linkage() == LinkageSpec::Builtin ||404 aggregateDecl->get_linkage() == LinkageSpec::BuiltinC ) {405 return;406 }407 408 403 // Make function polymorphic in same parameters as generic struct, if applicable 409 404 const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions … … 492 487 493 488 /// generates the body of a union assignment/copy constructor/field constructor 494 void makeUnionAssignBody( FunctionDecl * funcDecl ) {489 void makeUnionAssignBody( FunctionDecl * funcDecl, bool isDynamicLayout ) { 495 490 FunctionType * ftype = funcDecl->get_functionType(); 496 491 assert( ftype->get_parameters().size() == 2 ); … … 512 507 // Make function polymorphic in same parameters as generic union, if applicable 513 508 const std::list< TypeDecl* > & typeParams = aggregateDecl->get_parameters(); // List of type variables to be placed on the generated functions 514 509 bool isDynamicLayout = hasDynamicLayout( aggregateDecl ); // NOTE this flag is an incredibly ugly kludge; we should fix the assignment signature instead (ditto for struct) 510 515 511 // default ctor/dtor need only first parameter 516 512 // void ?{}(T *); void ^?{}(T *); … … 538 534 FunctionDecl *dtorDecl = genFunc( "^?{}", dtorType, functionNesting ); 539 535 540 makeUnionAssignBody( assignDecl );536 makeUnionAssignBody( assignDecl, isDynamicLayout ); 541 537 542 538 // body of assignment and copy ctor is the same 543 makeUnionAssignBody( copyCtorDecl );539 makeUnionAssignBody( copyCtorDecl, isDynamicLayout ); 544 540 545 541 // create a constructor which takes the first member type as a parameter. … … 556 552 FunctionDecl * ctor = genFunc( "?{}", memCtorType, functionNesting ); 557 553 558 makeUnionAssignBody( ctor );554 makeUnionAssignBody( ctor, isDynamicLayout ); 559 555 memCtors.push_back( ctor ); 560 556 // only generate a ctor for the first field … … 583 579 EnumInstType *enumInst = new EnumInstType( Type::Qualifiers(), enumDecl->get_name() ); 584 580 // enumInst->set_baseEnum( enumDecl ); 585 makeEnumFunctions( enum Inst, functionNesting, declsToAddAfter );581 makeEnumFunctions( enumDecl, enumInst, functionNesting, declsToAddAfter ); 586 582 } 587 583 }
Note:
See TracChangeset
for help on using the changeset viewer.