Changeset 0e73845
- Timestamp:
- Aug 19, 2018, 12:09:00 PM (6 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, no_list, persistent-indexer, pthread-emulation, qualifiedEnum
- Children:
- 04c77791
- Parents:
- 38587bc
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Mangler.cc
r38587bc r0e73845 149 149 void Mangler::postvisit( BasicType * basicType ) { 150 150 printQualifiers( basicType ); 151 assert ( basicType->get_kind() < BasicType::NUMBER_OF_BASIC_TYPES);151 assertf( basicType->get_kind() < BasicType::NUMBER_OF_BASIC_TYPES, "Unhandled basic type: %d", basicType->get_kind() ); 152 152 mangleName << Encoding::basicTypes[ basicType->get_kind() ]; 153 153 } … … 240 240 } else { 241 241 printQualifiers( typeInst ); 242 std::ostringstream numStream; 243 numStream << varNum->second.first; 244 switch ( (TypeDecl::Kind )varNum->second.second ) { 245 case TypeDecl::Dtype: 246 mangleName << "d"; 247 break; 248 case TypeDecl::Ftype: 249 mangleName << "f"; 250 break; 251 case TypeDecl::Ttype: 252 mangleName << "tVARGS"; 253 break; 254 default: 255 assert( false ); 256 } // switch 257 mangleName << numStream.str(); 242 assertf( varNum->second.second < TypeDecl::NUMBER_OF_KINDS, "Unhandled type variable kind: %d", varNum->second.second ); 243 mangleName << Encoding::typeVariables[varNum->second.second] << typeInst->get_name().size() << typeInst->get_name(); // varNum->second.first; 258 244 } // if 259 245 } … … 301 287 302 288 void Mangler::postvisit( TypeDecl * decl ) { 303 static const char *typePrefix[] = { "BT", "BD", "BF" };304 mangleName << typePrefix[ decl->get_kind() ] << ( decl->name.length() + 1) << decl->name;289 assertf( decl->get_kind() < TypeDecl::NUMBER_OF_KINDS, "Unhandled type variable kind: %d", decl->get_kind() ); 290 mangleName << Encoding::typeVariables[ decl->get_kind() ] << ( decl->name.length() ) << decl->name; 305 291 } 306 292 … … 316 302 if ( ! type->get_forall().empty() ) { 317 303 std::list< std::string > assertionNames; 318 int tcount = 0, dcount = 0, fcount = 0, vcount = 0;319 mangleName << "A";304 int dcount = 0, fcount = 0, vcount = 0, acount = 0; 305 mangleName << Encoding::forall; 320 306 for ( Type::ForallList::iterator i = type->forall.begin(); i != type->forall.end(); ++i ) { 321 307 switch ( (*i)->get_kind() ) { … … 340 326 (*assert)->accept( sub_mangler ); 341 327 assertionNames.push_back( sub_mangler.pass.mangleName.str() ); 328 acount++; 342 329 } // for 343 330 } // for 344 mangleName << tcount << "_" << dcount << "_" << fcount << "_" << vcount << "_";331 mangleName << dcount << "_" << fcount << "_" << vcount << "_" << acount << "_"; 345 332 std::copy( assertionNames.begin(), assertionNames.end(), std::ostream_iterator< std::string >( mangleName, "" ) ); 346 333 mangleName << "_"; -
src/SymTab/Mangler.h
r38587bc r0e73845 57 57 extern const std::string qualifiedTypeEnd; 58 58 59 extern const std::string forall; 60 extern const std::string typeVariables[]; 61 59 62 extern const std::string struct_t; 60 63 extern const std::string union_t; -
src/SymTab/ManglerCommon.cc
r38587bc r0e73845 16 16 #include "Mangler.h" 17 17 #include "SynTree/Type.h" 18 #include "SynTree/Declaration.h" 18 19 19 20 namespace SymTab { … … 82 83 const std::string qualifiedTypeEnd = "E"; 83 84 85 const std::string forall = "Q"; 86 const std::string typeVariables[] = { 87 "BD", // dtype 88 "BF", // ftype 89 "BT", // ttype 90 }; 91 static_assert( 92 sizeof(typeVariables)/sizeof(typeVariables[0]) == TypeDecl::NUMBER_OF_KINDS, 93 "Each type variable kind should have a corresponding mangler prefix" 94 ); 95 84 96 const std::string struct_t = "S"; 85 97 const std::string union_t = "U"; -
src/SynTree/Declaration.h
r38587bc r0e73845 202 202 typedef NamedTypeDecl Parent; 203 203 public: 204 enum Kind { Dtype, Ftype, Ttype };204 enum Kind { Dtype, Ftype, Ttype, NUMBER_OF_KINDS }; 205 205 206 206 Type * init;
Note: See TracChangeset
for help on using the changeset viewer.