Changes in src/SymTab/Validate.cc [45161b4d:630a82a]
- File:
-
- 1 edited
-
src/SymTab/Validate.cc (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/Validate.cc
r45161b4d r630a82a 10 10 // Created On : Sun May 17 21:50:04 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Apr 13 16:39:30 201613 // Update Count : 2 5112 // Last Modified On : Thu Apr 7 16:45:30 2016 13 // Update Count : 243 14 14 // 15 15 … … 190 190 AggDecl *handleAggregate( AggDecl * aggDecl ); 191 191 192 template<typename AggDecl>193 void addImplicitTypedef( AggDecl * aggDecl );194 195 192 typedef std::map< std::string, std::pair< TypedefDecl *, int > > TypedefMap; 196 193 TypedefMap typedefNames; … … 1017 1014 } 1018 1015 1019 // there may be typedefs nested within aggregates in order for everything to work properly, these should be removed 1020 // as well 1016 // there may be typedefs nested within aggregates 1017 // in order for everything to work properly, these 1018 // should be removed as well 1021 1019 template<typename AggDecl> 1022 1020 AggDecl *EliminateTypedef::handleAggregate( AggDecl * aggDecl ) { … … 1032 1030 return aggDecl; 1033 1031 } 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 } 1032 1050 1033 Declaration *EliminateTypedef::mutate( StructDecl * structDecl ) { 1051 addImplicitTypedef( structDecl );1052 1034 Mutator::mutate( structDecl ); 1053 1035 return handleAggregate( structDecl ); … … 1055 1037 1056 1038 Declaration *EliminateTypedef::mutate( UnionDecl * unionDecl ) { 1057 addImplicitTypedef( unionDecl );1058 1039 Mutator::mutate( unionDecl ); 1059 1040 return handleAggregate( unionDecl ); … … 1061 1042 1062 1043 Declaration *EliminateTypedef::mutate( EnumDecl * enumDecl ) { 1063 addImplicitTypedef( enumDecl );1064 1044 Mutator::mutate( enumDecl ); 1065 1045 return handleAggregate( enumDecl ); 1066 1046 } 1067 1047 1068 Declaration *EliminateTypedef::mutate( TraitDecl * contextDecl ) {1048 Declaration *EliminateTypedef::mutate( TraitDecl * contextDecl ) { 1069 1049 Mutator::mutate( contextDecl ); 1070 1050 return handleAggregate( contextDecl );
Note:
See TracChangeset
for help on using the changeset viewer.