Changes in src/SymTab/Mangler.cc [f465f0e:1da22500]
- File:
-
- 1 edited
-
src/SymTab/Mangler.cc (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Mangler.cc
rf465f0e r1da22500 35 35 namespace { 36 36 /// Mangles names to a unique C identifier 37 struct Mangler : public WithShortCircuiting, public WithVisitorRef<Mangler> , public WithGuards{37 struct Mangler : public WithShortCircuiting, public WithVisitorRef<Mangler> { 38 38 Mangler( bool mangleOverridable, bool typeMode, bool mangleGenericParams ); 39 39 Mangler( const Mangler & ) = delete; … … 55 55 void postvisit( EnumInstType * aggregateUseType ); 56 56 void postvisit( TypeInstType * aggregateUseType ); 57 void postvisit( TraitInstType * inst );58 57 void postvisit( TupleType * tupleType ); 59 58 void postvisit( VarArgsType * varArgsType ); … … 71 70 bool typeMode; ///< Produce a unique mangled name for a type 72 71 bool mangleGenericParams; ///< Include generic parameters in name mangling if true 73 bool inFunctionType = false; ///< Include type qualifiers if false.74 72 75 73 void mangleDecl( DeclarationWithType *declaration ); … … 191 189 192 190 void Mangler::postvisit( ReferenceType * refType ) { 193 // don't print prefix (e.g. 'R') for reference types so that references and non-references do not overload.194 // Further, do not print the qualifiers for a reference type (but do run printQualifers because of TypeDecls, etc.),195 // by pretending every reference type is a function parameter.196 GuardValue( inFunctionType );197 inFunctionType = true;198 191 printQualifiers( refType ); 192 mangleName << "R"; 199 193 maybeAccept( refType->base, *visitor ); 200 194 } … … 212 206 printQualifiers( functionType ); 213 207 mangleName << "F"; 214 // turn on inFunctionType so that printQualifiers does not print most qualifiers for function parameters,215 // since qualifiers on outermost parameter type do not differentiate function types, e.g.,216 // void (*)(const int) and void (*)(int) are the same type, but void (*)(const int *) and void (*)(int *) are different217 GuardValue( inFunctionType );218 inFunctionType = true;219 208 std::list< Type* > returnTypes = getTypes( functionType->get_returnVals() ); 220 209 acceptAll( returnTypes, *visitor ); … … 281 270 } 282 271 283 void Mangler::postvisit( TraitInstType * inst ) {284 printQualifiers( inst );285 mangleName << "_Y" << inst->name << "_";286 }287 288 272 void Mangler::postvisit( TupleType * tupleType ) { 289 273 printQualifiers( tupleType ); … … 320 304 // skip if not including qualifiers 321 305 if ( typeMode ) return; 306 322 307 if ( ! type->get_forall().empty() ) { 323 308 std::list< std::string > assertionNames; … … 352 337 mangleName << "_"; 353 338 } // if 354 if ( ! inFunctionType ) { 355 // these qualifiers do not distinguish the outermost type of a function parameter 356 if ( type->get_const() ) { 357 mangleName << "C"; 358 } // if 359 if ( type->get_volatile() ) { 360 mangleName << "V"; 361 } // if 362 // Removed due to restrict not affecting function compatibility in GCC 363 // if ( type->get_isRestrict() ) { 364 // mangleName << "E"; 365 // } // if 366 if ( type->get_atomic() ) { 367 mangleName << "A"; 368 } // if 369 } 339 if ( type->get_const() ) { 340 mangleName << "C"; 341 } // if 342 if ( type->get_volatile() ) { 343 mangleName << "V"; 344 } // if 370 345 if ( type->get_mutex() ) { 371 346 mangleName << "M"; 372 347 } // if 348 // Removed due to restrict not affecting function compatibility in GCC 349 // if ( type->get_isRestrict() ) { 350 // mangleName << "E"; 351 // } // if 373 352 if ( type->get_lvalue() ) { 374 353 // mangle based on whether the type is lvalue, so that the resolver can differentiate lvalues and rvalues 375 354 mangleName << "L"; 376 355 } 377 378 if ( inFunctionType ) { 379 // turn off inFunctionType so that types can be differentiated for nested qualifiers 380 GuardValue( inFunctionType ); 381 inFunctionType = false; 382 } 356 if ( type->get_atomic() ) { 357 mangleName << "A"; 358 } // if 383 359 } 384 360 } // namespace
Note:
See TracChangeset
for help on using the changeset viewer.