Changeset 8360977
- Timestamp:
- Dec 16, 2015, 3:20:19 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 0f889a77
- Parents:
- 5f6c42c
- Location:
- src/SymTab
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Mangler.cc
r5f6c42c r8360977 149 149 void Mangler::mangleRef( ReferenceToType *refType, std::string prefix ) { 150 150 printQualifiers( refType ); 151 151 152 mangleName << ( refType->get_name().length() + prefix.length() ) << prefix << refType->get_name(); 152 153 } 153 154 155 void Mangler::mangleGenericRef( ReferenceToType *refType, std::string prefix ) { 156 printQualifiers( refType ); 157 158 std::ostringstream oldName( mangleName.str() ); 159 mangleName.clear(); 160 161 mangleName << prefix << refType->get_name(); 162 163 std::list< Expression* >& params = refType->get_parameters(); 164 if ( ! params.empty() ) { 165 mangleName << "_"; 166 std::list< Type* > paramTypes; 167 for ( std::list< Expression* >::const_iterator param = params.begin(); param != params.end(); ++param ) { 168 TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param ); 169 assert(paramType && "Aggregate parameters should be type expressions"); 170 paramTypes.push_back( paramType->get_type() ); 171 } 172 acceptAll( paramTypes, *this ); 173 mangleName << "_"; 174 } 175 176 oldName << mangleName.str().length() << mangleName.str(); 177 mangleName.str( oldName.str() ); 178 } 179 154 180 void Mangler::visit( StructInstType *aggregateUseType ) { 155 mangle Ref( aggregateUseType, "s" );181 mangleGenericRef( aggregateUseType, "s" ); 156 182 } 157 183 158 184 void Mangler::visit( UnionInstType *aggregateUseType ) { 159 mangle Ref( aggregateUseType, "u" );185 mangleGenericRef( aggregateUseType, "u" ); 160 186 } 161 187 -
src/SymTab/Mangler.h
r5f6c42c r8360977 58 58 void mangleDecl( DeclarationWithType *declaration ); 59 59 void mangleRef( ReferenceToType *refType, std::string prefix ); 60 void mangleGenericRef( ReferenceToType *refType, std::string prefix ); 60 61 61 62 void printQualifiers( Type *type );
Note: See TracChangeset
for help on using the changeset viewer.