Changeset ffec1bf for src/SymTab
- Timestamp:
- Jul 25, 2022, 2:23:28 PM (4 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum, stuck-waitfor-destruct
- Children:
- 4c48be0, 5cf1228, def751f
- Parents:
- 9e23b446 (diff), 1f950c3b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)links above to see all the changes relative to each parent. - Location:
- src/SymTab
- Files:
-
- 6 edited
-
FixFunction.cc (modified) (3 diffs)
-
FixFunction.h (modified) (3 diffs)
-
Mangler.cc (modified) (1 diff)
-
Validate.cc (modified) (7 diffs)
-
Validate.h (modified) (2 diffs)
-
ValidateType.cc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/FixFunction.cc
r9e23b446 rffec1bf 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 16:19:49 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Mon Mar 6 23:36:59 201713 // Update Count : 611 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Jul 12 14:28:00 2022 13 // Update Count : 7 14 14 // 15 15 … … 122 122 } 123 123 124 void previsit( const ast::FunctionType * ) { visit_children = false; } 125 126 const ast::Type * postvisit( const ast::FunctionType * type ) { 127 return new ast::PointerType( type ); 128 } 129 124 130 void previsit( const ast::VoidType * ) { isVoid = true; } 125 131 … … 145 151 } 146 152 153 const ast::Type * fixFunction( const ast::Type * type, bool & isVoid ) { 154 ast::Pass< FixFunction_new > fixer; 155 type = type->accept( fixer ); 156 isVoid |= fixer.core.isVoid; 157 return type; 158 } 159 147 160 } // namespace SymTab 148 161 -
src/SymTab/FixFunction.h
r9e23b446 rffec1bf 10 10 // Created On : Sun May 17 17:02:08 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:45:55 201713 // Update Count : 412 // Last Modified On : Tue Jul 12 14:19:00 2022 13 // Update Count : 5 14 14 // 15 15 … … 21 21 namespace ast { 22 22 class DeclWithType; 23 class Type; 23 24 } 24 25 … … 31 32 /// Sets isVoid to true if type is void 32 33 const ast::DeclWithType * fixFunction( const ast::DeclWithType * dwt, bool & isVoid ); 34 const ast::Type * fixFunction( const ast::Type * type, bool & isVoid ); 33 35 } // namespace SymTab 34 36 -
src/SymTab/Mangler.cc
r9e23b446 rffec1bf 537 537 } 538 538 539 __attribute__((unused)) 539 540 inline std::vector< ast::ptr< ast::Type > > getTypes( const std::vector< ast::ptr< ast::DeclWithType > > & decls ) { 540 541 std::vector< ast::ptr< ast::Type > > ret; -
src/SymTab/Validate.cc
r9e23b446 rffec1bf 10 10 // Created On : Sun May 17 21:50:04 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue May 17 14:36:00 202213 // Update Count : 36 612 // Last Modified On : Tue Jul 12 15:00:00 2022 13 // Update Count : 367 14 14 // 15 15 … … 294 294 }; 295 295 296 void validate _A( std::list< Declaration * > & translationUnit) {296 void validate( std::list< Declaration * > &translationUnit, __attribute__((unused)) bool doDebug ) { 297 297 PassVisitor<HoistTypeDecls> hoistDecls; 298 298 { … … 305 305 decayEnumsAndPointers( translationUnit ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist; before LinkReferenceToTypes_old because it is an indexer and needs correct types for mangling 306 306 } 307 }308 309 void validate_B( std::list< Declaration * > & translationUnit ) {310 307 PassVisitor<FixQualifiedTypes> fixQual; 311 308 { 312 309 Stats::Heap::newPass("validate-B"); 313 310 Stats::Time::BlockGuard guard("validate-B"); 314 //linkReferenceToTypes( translationUnit );311 linkReferenceToTypes( translationUnit ); // Must happen before auto-gen, because it uses the sized flag. 315 312 mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes_old, because aggregate members are accessed 316 313 HoistStruct::hoistStruct( translationUnit ); 317 314 EliminateTypedef::eliminateTypedef( translationUnit ); 318 315 } 319 }320 321 void validate_C( std::list< Declaration * > & translationUnit ) {322 316 PassVisitor<ValidateGenericParameters> genericParams; 323 317 PassVisitor<ResolveEnumInitializers> rei( nullptr ); … … 343 337 }); 344 338 } 345 }346 347 void validate_D( std::list< Declaration * > & translationUnit ) {348 339 { 349 340 Stats::Heap::newPass("validate-D"); … … 362 353 }); 363 354 } 364 }365 366 void validate_E( std::list< Declaration * > & translationUnit ) {367 355 PassVisitor<CompoundLiteral> compoundliteral; 368 356 { … … 384 372 } 385 373 } 386 }387 388 void validate_F( std::list< Declaration * > & translationUnit ) {389 374 PassVisitor<LabelAddressFixer> labelAddrFixer; 390 375 { … … 410 395 } 411 396 } 412 }413 414 void validate( std::list< Declaration * > &translationUnit, __attribute__((unused)) bool doDebug ) {415 validate_A( translationUnit );416 validate_B( translationUnit );417 validate_C( translationUnit );418 validate_D( translationUnit );419 validate_E( translationUnit );420 validate_F( translationUnit );421 397 } 422 398 -
src/SymTab/Validate.h
r9e23b446 rffec1bf 11 11 // Created On : Sun May 17 21:53:34 2015 12 12 // Last Modified By : Andrew Beach 13 // Last Modified On : Tue May 17 14:35:00 202214 // Update Count : 513 // Last Modified On : Tue Jul 12 15:30:00 2022 14 // Update Count : 6 15 15 // 16 16 … … 19 19 #include <list> // for list 20 20 21 struct CodeLocation; 22 class Declaration; 23 class Type; 24 25 namespace ast { 26 class Type; 27 class SymbolTable; 28 } 21 class Declaration; 29 22 30 23 namespace SymTab { 31 class Indexer;32 33 24 /// Normalizes struct and function declarations 34 25 void validate( std::list< Declaration * > &translationUnit, bool doDebug = false ); 35 36 // Sub-passes of validate.37 void validate_A( std::list< Declaration * > &translationUnit );38 void validate_B( std::list< Declaration * > &translationUnit );39 void validate_C( std::list< Declaration * > &translationUnit );40 void validate_D( std::list< Declaration * > &translationUnit );41 void validate_E( std::list< Declaration * > &translationUnit );42 void validate_F( std::list< Declaration * > &translationUnit );43 26 } // namespace SymTab 44 27 -
src/SymTab/ValidateType.cc
r9e23b446 rffec1bf 222 222 // visit enum members first so that the types of self-referencing members are updated properly 223 223 // Replace the enum base; right now it works only for StructEnum 224 if ( enumDecl->base && dynamic_cast<TypeInstType*>(enumDecl->base) ) { 225 std::string baseName = static_cast<TypeInstType*>(enumDecl->base)->name; 226 const StructDecl * st = local_indexer->lookupStruct( baseName ); 227 if ( st ) { 228 enumDecl->base = new StructInstType(Type::Qualifiers(),const_cast<StructDecl *>(st)); // Just linking in the node 224 if ( enumDecl->base ) { 225 if ( const TypeInstType * base = dynamic_cast< TypeInstType * >(enumDecl->base) ) { 226 if ( const StructDecl * decl = local_indexer->lookupStruct( base->name ) ) { 227 enumDecl->base = new StructInstType( Type::Qualifiers(), const_cast< StructDecl * >( decl ) ); // Just linking in the node 228 } 229 } else if ( const PointerType * ptr = dynamic_cast< PointerType * >(enumDecl->base) ) { 230 if ( const TypeInstType * ptrBase = dynamic_cast< TypeInstType * >( ptr->base ) ) { 231 if ( const StructDecl * decl = local_indexer->lookupStruct( ptrBase->name ) ) { 232 enumDecl->base = new PointerType( Type::Qualifiers(), 233 new StructInstType( Type::Qualifiers(), const_cast< StructDecl * >( decl ) ) ); 234 } 235 } 229 236 } 230 237 } 238 231 239 if ( enumDecl->body ) { 232 240 ForwardEnumsType::iterator fwds = forwardEnums.find( enumDecl->name );
Note:
See TracChangeset
for help on using the changeset viewer.