Changes in src/SymTab/Mangler.cc [c0453ca3:1da22500]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Mangler.cc
rc0453ca3 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; … … 70 70 bool typeMode; ///< Produce a unique mangled name for a type 71 71 bool mangleGenericParams; ///< Include generic parameters in name mangling if true 72 bool inFunctionType = false; ///< Include type qualifiers if false.73 72 74 73 void mangleDecl( DeclarationWithType *declaration ); … … 190 189 191 190 void Mangler::postvisit( ReferenceType * refType ) { 192 // don't print prefix (e.g. 'R') for reference types so that references and non-references do not overload.193 // Further, do not print the qualifiers for a reference type (but do run printQualifers because of TypeDecls, etc.),194 // by pretending every reference type is a function parameter.195 GuardValue( inFunctionType );196 inFunctionType = true;197 191 printQualifiers( refType ); 192 mangleName << "R"; 198 193 maybeAccept( refType->base, *visitor ); 199 194 } … … 211 206 printQualifiers( functionType ); 212 207 mangleName << "F"; 213 // turn on inFunctionType so that printQualifiers does not print most qualifiers for function parameters,214 // since qualifiers on outermost parameter type do not differentiate function types, e.g.,215 // void (*)(const int) and void (*)(int) are the same type, but void (*)(const int *) and void (*)(int *) are different216 GuardValue( inFunctionType );217 inFunctionType = true;218 208 std::list< Type* > returnTypes = getTypes( functionType->get_returnVals() ); 219 209 acceptAll( returnTypes, *visitor ); … … 314 304 // skip if not including qualifiers 315 305 if ( typeMode ) return; 306 316 307 if ( ! type->get_forall().empty() ) { 317 308 std::list< std::string > assertionNames; … … 346 337 mangleName << "_"; 347 338 } // if 348 if ( ! inFunctionType ) { 349 // these qualifiers do not distinguish the outermost type of a function parameter 350 if ( type->get_const() ) { 351 mangleName << "C"; 352 } // if 353 if ( type->get_volatile() ) { 354 mangleName << "V"; 355 } // if 356 // Removed due to restrict not affecting function compatibility in GCC 357 // if ( type->get_isRestrict() ) { 358 // mangleName << "E"; 359 // } // if 360 if ( type->get_atomic() ) { 361 mangleName << "A"; 362 } // if 363 } 339 if ( type->get_const() ) { 340 mangleName << "C"; 341 } // if 342 if ( type->get_volatile() ) { 343 mangleName << "V"; 344 } // if 364 345 if ( type->get_mutex() ) { 365 346 mangleName << "M"; 366 347 } // if 348 // Removed due to restrict not affecting function compatibility in GCC 349 // if ( type->get_isRestrict() ) { 350 // mangleName << "E"; 351 // } // if 367 352 if ( type->get_lvalue() ) { 368 353 // mangle based on whether the type is lvalue, so that the resolver can differentiate lvalues and rvalues 369 354 mangleName << "L"; 370 355 } 371 372 if ( inFunctionType ) { 373 // turn off inFunctionType so that types can be differentiated for nested qualifiers 374 GuardValue( inFunctionType ); 375 inFunctionType = false; 376 } 356 if ( type->get_atomic() ) { 357 mangleName << "A"; 358 } // if 377 359 } 378 360 } // namespace
Note: See TracChangeset
for help on using the changeset viewer.