Changeset b11fac4 for src/SymTab/Validate.cc
- Timestamp:
- Apr 13, 2016, 5:40:32 PM (8 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:
- 02af22de
- Parents:
- 02ad3f5 (diff), 45161b4d (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Validate.cc
r02ad3f5 rb11fac4 10 10 // Created On : Sun May 17 21:50:04 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Apr 7 16:45:30 201613 // Update Count : 2 4312 // Last Modified On : Wed Apr 13 16:39:30 2016 13 // Update Count : 251 14 14 // 15 15 … … 190 190 AggDecl *handleAggregate( AggDecl * aggDecl ); 191 191 192 template<typename AggDecl> 193 void addImplicitTypedef( AggDecl * aggDecl ); 194 192 195 typedef std::map< std::string, std::pair< TypedefDecl *, int > > TypedefMap; 193 196 TypedefMap typedefNames; … … 1014 1017 } 1015 1018 1016 // there may be typedefs nested within aggregates 1017 // in order for everything to work properly, these 1018 // should be removed as well 1019 // there may be typedefs nested within aggregates in order for everything to work properly, these should be removed 1020 // as well 1019 1021 template<typename AggDecl> 1020 1022 AggDecl *EliminateTypedef::handleAggregate( AggDecl * aggDecl ) { … … 1030 1032 return aggDecl; 1031 1033 } 1032 1034 1035 template<typename AggDecl> 1036 void EliminateTypedef::addImplicitTypedef( AggDecl * aggDecl ) { 1037 if ( typedefNames.count( aggDecl->get_name() ) == 0 ) { 1038 Type *type; 1039 if ( StructDecl * newDeclStructDecl = dynamic_cast< StructDecl * >( aggDecl ) ) { 1040 type = new StructInstType( Type::Qualifiers(), newDeclStructDecl->get_name() ); 1041 } else if ( UnionDecl * newDeclUnionDecl = dynamic_cast< UnionDecl * >( aggDecl ) ) { 1042 type = new UnionInstType( Type::Qualifiers(), newDeclUnionDecl->get_name() ); 1043 } else if ( EnumDecl * newDeclEnumDecl = dynamic_cast< EnumDecl * >( aggDecl ) ) { 1044 type = new EnumInstType( Type::Qualifiers(), newDeclEnumDecl->get_name() ); 1045 } // if 1046 TypedefDecl * tyDecl = new TypedefDecl( aggDecl->get_name(), DeclarationNode::NoStorageClass, type ); 1047 typedefNames[ aggDecl->get_name() ] = std::make_pair( tyDecl, scopeLevel ); 1048 } // if 1049 } 1033 1050 Declaration *EliminateTypedef::mutate( StructDecl * structDecl ) { 1051 addImplicitTypedef( structDecl ); 1034 1052 Mutator::mutate( structDecl ); 1035 1053 return handleAggregate( structDecl ); … … 1037 1055 1038 1056 Declaration *EliminateTypedef::mutate( UnionDecl * unionDecl ) { 1057 addImplicitTypedef( unionDecl ); 1039 1058 Mutator::mutate( unionDecl ); 1040 1059 return handleAggregate( unionDecl ); … … 1042 1061 1043 1062 Declaration *EliminateTypedef::mutate( EnumDecl * enumDecl ) { 1063 addImplicitTypedef( enumDecl ); 1044 1064 Mutator::mutate( enumDecl ); 1045 1065 return handleAggregate( enumDecl ); 1046 1066 } 1047 1067 1048 1068 Declaration *EliminateTypedef::mutate( TraitDecl * contextDecl ) { 1049 1069 Mutator::mutate( contextDecl ); 1050 1070 return handleAggregate( contextDecl );
Note: See TracChangeset
for help on using the changeset viewer.