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