Changes in / [d4b37ab:25404c7]
- Location:
- src
- Files:
-
- 10 deleted
- 13 edited
-
AST/Convert.cpp (modified) (3 diffs)
-
AST/Decl.hpp (modified) (1 diff)
-
CodeGen/CodeGenerator.cc (modified) (3 diffs)
-
CodeGen/CodeGenerator.h (modified) (3 diffs)
-
CodeGen/GenType.cc (modified) (1 diff)
-
ResolvExpr/CandidateFinder.cpp (modified) (3 diffs)
-
SymTab/FixFunction.cc (modified) (3 diffs)
-
SymTab/FixFunction.h (modified) (3 diffs)
-
SymTab/Validate.cc (modified) (8 diffs)
-
SymTab/Validate.h (modified) (2 diffs)
-
Validate/EliminateTypedef.cpp (modified) (3 diffs)
-
Validate/EnumAndPointerDecay.cpp (deleted)
-
Validate/EnumAndPointerDecay.hpp (deleted)
-
Validate/FixReturnTypes.cpp (deleted)
-
Validate/FixReturnTypes.hpp (deleted)
-
Validate/HoistTypeDecls.cpp (deleted)
-
Validate/HoistTypeDecls.hpp (deleted)
-
Validate/ReplaceTypedef.cpp (deleted)
-
Validate/ReplaceTypedef.hpp (deleted)
-
Validate/VerifyCtorDtorAssign.cpp (deleted)
-
Validate/VerifyCtorDtorAssign.hpp (deleted)
-
Validate/module.mk (modified) (3 diffs)
-
main.cc (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
rd4b37ab r25404c7 168 168 auto attr = get<Attribute>().acceptL( node->attributes ); 169 169 170 // This field can be unset very early on (Pre-FixReturnTypes).171 auto newType = (type) ? type->clone() : nullptr;172 173 170 auto decl = new ObjectDecl( 174 171 node->name, … … 176 173 LinkageSpec::Spec( node->linkage.val ), 177 174 bfwd, 178 newType,175 type->clone(), 179 176 nullptr, // prevent infinite loop 180 177 attr, … … 1582 1579 1583 1580 virtual void visit( const ObjectDecl * old ) override final { 1584 if ( inCache( old ) ) {1585 return;1586 }1587 1581 auto&& type = GET_ACCEPT_1(type, Type); 1588 1582 auto&& init = GET_ACCEPT_1(init, Init); 1589 1583 auto&& bfwd = GET_ACCEPT_1(bitfieldWidth, Expr); 1590 1584 auto&& attr = GET_ACCEPT_V(attributes, Attribute); 1591 1585 if ( inCache( old ) ) { 1586 return; 1587 } 1592 1588 auto decl = new ast::ObjectDecl( 1593 1589 old->location, -
src/AST/Decl.hpp
rd4b37ab r25404c7 315 315 316 316 EnumDecl( const CodeLocation& loc, const std::string& name, 317 std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall, Type const* base = nullptr,317 std::vector<ptr<Attribute>>&& attrs = {}, Linkage::Spec linkage = Linkage::Cforall, Type * base = nullptr, 318 318 std::unordered_map< std::string, long long > enumValues = std::unordered_map< std::string, long long >() ) 319 319 : AggregateDecl( loc, name, std::move(attrs), linkage ), base(base), enumValues(enumValues) {} -
src/CodeGen/CodeGenerator.cc
rd4b37ab r25404c7 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Wed Jun 29 14:34:00 202213 // Update Count : 54 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Feb 2 20:30:30 2022 13 // Update Count : 541 14 14 // 15 15 #include "CodeGenerator.h" … … 18 18 #include <list> // for _List_iterator, list, list<>::it... 19 19 20 #include "AST/Decl.hpp" // for DeclWithType21 20 #include "Common/UniqueName.h" // for UniqueName 22 21 #include "Common/utility.h" // for CodeLocation, toString … … 1239 1238 } // if 1240 1239 } 1241 1242 std::string genName( ast::DeclWithType const * decl ) {1243 if ( const OperatorInfo * opInfo = operatorLookup( decl->name ) ) {1244 return opInfo->outputName;1245 } else {1246 return decl->name;1247 }1248 }1249 1250 1240 } // namespace CodeGen 1251 1241 -
src/CodeGen/CodeGenerator.h
rd4b37ab r25404c7 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Wed Jun 29 14:32:00202213 // Update Count : 6 511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 1 09:23:21 2022 13 // Update Count : 64 14 14 // 15 15 … … 26 26 #include "SynTree/Visitor.h" // for Visitor 27 27 #include "SynTree/SynTree.h" // for Visitor Nodes 28 29 namespace ast {30 class DeclWithType;31 }32 28 33 29 namespace CodeGen { … … 186 182 /// returns C-compatible name of declaration 187 183 std::string genName( DeclarationWithType * decl ); 188 std::string genName( ast::DeclWithType const * decl );189 184 190 185 inline std::ostream & operator<<( std::ostream & os, const CodeGenerator::LineEnder & endl ) { -
src/CodeGen/GenType.cc
rd4b37ab r25404c7 254 254 255 255 void GenType::postvisit( EnumInstType * enumInst ) { 256 if ( enumInst->baseEnum && enumInst->baseEnum->base ) {256 if ( enumInst->baseEnum->base ) { 257 257 typeString = genType(enumInst->baseEnum->base, "", options) + typeString; 258 258 } else { -
src/ResolvExpr/CandidateFinder.cpp
rd4b37ab r25404c7 41 41 #include "Common/utility.h" // for move, copy 42 42 #include "SymTab/Mangler.h" 43 #include "SymTab/Validate.h" // for validateType 43 44 #include "Tuples/Tuples.h" // for handleTupleAssignment 44 45 #include "InitTweak/InitTweak.h" // for getPointerBase … … 1090 1091 assert( toType ); 1091 1092 toType = resolveTypeof( toType, context ); 1093 // toType = SymTab::validateType( castExpr->location, toType, symtab ); 1092 1094 toType = adjustExprType( toType, tenv, symtab ); 1093 1095 … … 1580 1582 // calculate target type 1581 1583 const ast::Type * toType = resolveTypeof( initAlt.type, context ); 1584 // toType = SymTab::validateType( initExpr->location, toType, symtab ); 1582 1585 toType = adjustExprType( toType, tenv, symtab ); 1583 1586 // The call to find must occur inside this loop, otherwise polymorphic return -
src/SymTab/FixFunction.cc
rd4b37ab r25404c7 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 16:19:49 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Tue Jul 12 14:28:00 202213 // Update Count : 711 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Mar 6 23:36:59 2017 13 // Update Count : 6 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 130 124 void previsit( const ast::VoidType * ) { isVoid = true; } 131 125 … … 151 145 } 152 146 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 160 147 } // namespace SymTab 161 148 -
src/SymTab/FixFunction.h
rd4b37ab r25404c7 10 10 // Created On : Sun May 17 17:02:08 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 12 14:19:00 202213 // Update Count : 512 // Last Modified On : Sat Jul 22 09:45:55 2017 13 // Update Count : 4 14 14 // 15 15 … … 21 21 namespace ast { 22 22 class DeclWithType; 23 class Type;24 23 } 25 24 … … 32 31 /// Sets isVoid to true if type is void 33 32 const ast::DeclWithType * fixFunction( const ast::DeclWithType * dwt, bool & isVoid ); 34 const ast::Type * fixFunction( const ast::Type * type, bool & isVoid );35 33 } // namespace SymTab 36 34 -
src/SymTab/Validate.cc
rd4b37ab r25404c7 10 10 // Created On : Sun May 17 21:50:04 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Jul 12 15:00:00 202213 // Update Count : 36 712 // Last Modified On : Tue May 17 14:36:00 2022 13 // Update Count : 366 14 14 // 15 15 … … 294 294 }; 295 295 296 void validate ( std::list< Declaration * > &translationUnit, __attribute__((unused)) bool doDebug) {296 void validate_A( std::list< Declaration * > & translationUnit ) { 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 ) { 307 310 PassVisitor<FixQualifiedTypes> fixQual; 308 311 { … … 314 317 EliminateTypedef::eliminateTypedef( translationUnit ); 315 318 } 319 } 320 321 void validate_C( std::list< Declaration * > & translationUnit ) { 316 322 PassVisitor<ValidateGenericParameters> genericParams; 317 323 PassVisitor<ResolveEnumInitializers> rei( nullptr ); … … 337 343 }); 338 344 } 345 } 346 347 void validate_D( std::list< Declaration * > & translationUnit ) { 339 348 { 340 349 Stats::Heap::newPass("validate-D"); … … 353 362 }); 354 363 } 364 } 365 366 void validate_E( std::list< Declaration * > & translationUnit ) { 355 367 PassVisitor<CompoundLiteral> compoundliteral; 356 368 { … … 372 384 } 373 385 } 386 } 387 388 void validate_F( std::list< Declaration * > & translationUnit ) { 374 389 PassVisitor<LabelAddressFixer> labelAddrFixer; 375 390 { … … 395 410 } 396 411 } 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 ); 397 421 } 398 422 -
src/SymTab/Validate.h
rd4b37ab r25404c7 11 11 // Created On : Sun May 17 21:53:34 2015 12 12 // Last Modified By : Andrew Beach 13 // Last Modified On : Tue Jul 12 15:30:00 202214 // Update Count : 613 // Last Modified On : Tue May 17 14:35:00 2022 14 // Update Count : 5 15 15 // 16 16 … … 19 19 #include <list> // for list 20 20 21 class Declaration; 21 struct CodeLocation; 22 class Declaration; 23 class Type; 24 25 namespace ast { 26 class Type; 27 class SymbolTable; 28 } 22 29 23 30 namespace SymTab { 31 class Indexer; 32 24 33 /// Normalizes struct and function declarations 25 34 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 ); 26 43 } // namespace SymTab 27 44 -
src/Validate/EliminateTypedef.cpp
rd4b37ab r25404c7 10 10 // Created On : Wed Apr 20 16:37:00 2022 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jul 11 16:30:00 202213 // Update Count : 112 // Last Modified On : Mon Apr 25 14:26:00 2022 13 // Update Count : 0 14 14 // 15 15 … … 28 28 29 29 struct EliminateTypedefCore { 30 // Remove typedefs from inside aggregates.31 30 ast::StructDecl const * previsit( ast::StructDecl const * decl ); 32 31 ast::UnionDecl const * previsit( ast::UnionDecl const * decl ); 33 // Remove typedefs from statement lists.34 32 ast::CompoundStmt const * previsit( ast::CompoundStmt const * stmt ); 35 // Remove typedefs from control structure initializers.36 ast::IfStmt const * previsit( ast::IfStmt const * stmt );37 ast::ForStmt const * previsit( ast::ForStmt const * stmt );38 ast::WhileDoStmt const * previsit( ast::WhileDoStmt const * stmt );39 33 }; 40 34 … … 69 63 } 70 64 71 ast::IfStmt const * EliminateTypedefCore::previsit( ast::IfStmt const * stmt ) {72 return field_erase_if( stmt, &ast::IfStmt::inits, isTypedefStmt );73 }74 75 ast::ForStmt const * EliminateTypedefCore::previsit( ast::ForStmt const * stmt ) {76 return field_erase_if( stmt, &ast::ForStmt::inits, isTypedefStmt );77 }78 79 ast::WhileDoStmt const * EliminateTypedefCore::previsit( ast::WhileDoStmt const * stmt ) {80 return field_erase_if( stmt, &ast::WhileDoStmt::inits, isTypedefStmt );81 }82 83 65 } // namespace 84 66 -
src/Validate/module.mk
rd4b37ab r25404c7 26 26 Validate/EliminateTypedef.cpp \ 27 27 Validate/EliminateTypedef.hpp \ 28 Validate/EnumAndPointerDecay.cpp \29 Validate/EnumAndPointerDecay.hpp \30 28 Validate/FindSpecialDeclsNew.cpp \ 31 29 Validate/FixQualifiedTypes.cpp \ 32 30 Validate/FixQualifiedTypes.hpp \ 33 Validate/FixReturnTypes.cpp \34 Validate/FixReturnTypes.hpp \35 31 Validate/ForallPointerDecay.cpp \ 36 32 Validate/ForallPointerDecay.hpp \ … … 41 37 Validate/HoistStruct.cpp \ 42 38 Validate/HoistStruct.hpp \ 43 Validate/HoistTypeDecls.cpp \44 Validate/HoistTypeDecls.hpp \45 39 Validate/InitializerLength.cpp \ 46 40 Validate/InitializerLength.hpp \ … … 50 44 Validate/LinkReferenceToTypes.hpp \ 51 45 Validate/NoIdSymbolTable.hpp \ 52 Validate/ReplaceTypedef.cpp \53 Validate/ReplaceTypedef.hpp \54 46 Validate/ReturnCheck.cpp \ 55 Validate/ReturnCheck.hpp \ 56 Validate/VerifyCtorDtorAssign.cpp \ 57 Validate/VerifyCtorDtorAssign.hpp 47 Validate/ReturnCheck.hpp 58 48 59 49 SRCDEMANGLE += $(SRC_VALIDATE) -
src/main.cc
rd4b37ab r25404c7 10 10 // Created On : Fri May 15 23:12:02 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Ju l 12 12:02:00 202213 // Update Count : 67 512 // Last Modified On : Tue Jun 7 13:29:00 2022 13 // Update Count : 674 14 14 // 15 15 … … 78 78 #include "Validate/CompoundLiteral.hpp" // for handleCompoundLiterals 79 79 #include "Validate/EliminateTypedef.hpp" // for eliminateTypedef 80 #include "Validate/EnumAndPointerDecay.hpp" // for decayEnumsAndPointers81 80 #include "Validate/FindSpecialDecls.h" // for findGlobalDecls 82 81 #include "Validate/FixQualifiedTypes.hpp" // for fixQualifiedTypes 83 #include "Validate/FixReturnTypes.hpp" // for fixReturnTypes84 82 #include "Validate/ForallPointerDecay.hpp" // for decayForallPointers 85 83 #include "Validate/GenericParameter.hpp" // for fillGenericParameters, tr... 86 84 #include "Validate/HoistStruct.hpp" // for hoistStruct 87 #include "Validate/HoistTypeDecls.hpp" // for hoistTypeDecls88 85 #include "Validate/InitializerLength.hpp" // for setLengthFromInitializer 89 86 #include "Validate/LabelAddressFixer.hpp" // for fixLabelAddresses 90 87 #include "Validate/LinkReferenceToTypes.hpp" // for linkReferenceToTypes 91 #include "Validate/ReplaceTypedef.hpp" // for replaceTypedef92 88 #include "Validate/ReturnCheck.hpp" // for checkReturnStatements 93 #include "Validate/VerifyCtorDtorAssign.hpp" // for verifyCtorDtorAssign94 89 #include "Virtual/ExpandCasts.h" // for expandCasts 95 90 … … 336 331 } // if 337 332 333 // add the assignment statement after the initialization of a type parameter 334 PASS( "Validate-A", SymTab::validate_A( translationUnit ) ); 335 338 336 CodeTools::fillLocations( translationUnit ); 339 337 … … 348 346 349 347 forceFillCodeLocations( transUnit ); 350 351 // Must happen before auto-gen, or anything that examines ops.352 PASS( "Verify Ctor, Dtor & Assign", Validate::verifyCtorDtorAssign( transUnit ) );353 354 PASS( "Hoist Type Decls", Validate::hoistTypeDecls( transUnit ) );355 // Hoist Type Decls pulls some declarations out of contexts where356 // locations are not tracked. Perhaps they should be, but for now357 // the full fill solves it.358 forceFillCodeLocations( transUnit );359 360 PASS( "Replace Typedefs", Validate::replaceTypedef( transUnit ) );361 362 // Must happen before auto-gen.363 PASS( "Fix Return Types", Validate::fixReturnTypes( transUnit ) );364 365 // Must happen before Link Reference to Types, it needs correct366 // types for mangling.367 PASS( "Enum and Pointer Decay", Validate::decayEnumsAndPointers( transUnit ) );368 348 369 349 // Must happen before auto-gen, because it uses the sized flag. … … 473 453 translationUnit = convert( move( transUnit ) ); 474 454 } else { 475 // add the assignment statement after the initialization of a type parameter 476 PASS( "Validate", SymTab::validate( translationUnit ) ); 455 PASS( "Validate-B", SymTab::validate_B( translationUnit ) ); 456 PASS( "Validate-C", SymTab::validate_C( translationUnit ) ); 457 PASS( "Validate-D", SymTab::validate_D( translationUnit ) ); 458 PASS( "Validate-E", SymTab::validate_E( translationUnit ) ); 459 PASS( "Validate-F", SymTab::validate_F( translationUnit ) ); 477 460 478 461 if ( symtabp ) {
Note:
See TracChangeset
for help on using the changeset viewer.