Changeset 298fe57
- Timestamp:
- Apr 29, 2022, 1:30:49 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 4cb1a24
- Parents:
- ffef246
- Files:
-
- 8 added
- 9 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
rffef246 r298fe57 2729 2729 ty->forall.emplace_back(new ast::TypeInstType(param)); 2730 2730 for (auto asst : param->assertions) { 2731 ty->assertions.emplace_back(new ast::VariableExpr({}, asst)); 2731 ty->assertions.emplace_back( 2732 new ast::VariableExpr(param->location, asst)); 2732 2733 } 2733 2734 } -
src/Common/utility.h
rffef246 r298fe57 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Tue Feb 11 13:00:36 202013 // Update Count : 5 011 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Apr 25 14:26:00 2022 13 // Update Count : 51 14 14 // 15 15 … … 230 230 } 231 231 232 template<typename Container, typename Pred> 233 void erase_if( Container & cont, Pred && pred ) { 234 auto keep_end = std::remove_if( cont.begin(), cont.end(), pred ); 235 cont.erase( keep_end, cont.end() ); 236 } 237 232 238 template< typename... Args > 233 239 auto zip(Args&&... args) -> decltype(zipWith(std::forward<Args>(args)..., std::make_pair)) { -
src/SymTab/Validate.cc
rffef246 r298fe57 10 10 // Created On : Sun May 17 21:50:04 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Nov 12 11:00:00 202113 // Update Count : 36 412 // Last Modified On : Fri Apr 29 9:45:00 2022 13 // Update Count : 365 14 14 // 15 15 … … 143 143 struct LinkReferenceToTypes_old final : public WithIndexer, public WithGuards, public WithVisitorRef<LinkReferenceToTypes_old>, public WithShortCircuiting { 144 144 LinkReferenceToTypes_old( const Indexer * indexer ); 145 145 146 void postvisit( TypeInstType * typeInst ); 146 147 … … 370 371 } 371 372 373 void linkReferenceToTypes( std::list< Declaration * > & translationUnit ) { 374 PassVisitor<LinkReferenceToTypes_old> lrt( nullptr ); 375 acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions 376 } 377 372 378 void validate_B( std::list< Declaration * > & translationUnit ) { 373 PassVisitor<LinkReferenceToTypes_old> lrt( nullptr );374 379 PassVisitor<FixQualifiedTypes> fixQual; 375 380 { 376 381 Stats::Heap::newPass("validate-B"); 377 382 Stats::Time::BlockGuard guard("validate-B"); 378 acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions383 //linkReferenceToTypes( translationUnit ); 379 384 mutateAll( translationUnit, fixQual ); // must happen after LinkReferenceToTypes_old, because aggregate members are accessed 380 385 HoistStruct::hoistStruct( translationUnit ); -
src/SymTab/Validate.h
rffef246 r298fe57 42 42 void validate_E( std::list< Declaration * > &translationUnit ); 43 43 void validate_F( std::list< Declaration * > &translationUnit ); 44 void linkReferenceToTypes( std::list< Declaration * > &translationUnit ); 44 45 45 46 const ast::Type * validateType( -
src/Validate/ForallPointerDecay.cpp
rffef246 r298fe57 10 10 // Created On : Tue Dec 7 16:15:00 2021 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Feb 11 10:59:00 202213 // Update Count : 012 // Last Modified On : Sat Apr 23 13:10:00 2022 13 // Update Count : 1 14 14 // 15 15 … … 237 237 } 238 238 239 std::vector<ast::ptr<ast::DeclWithType>> expandAssertions( 240 std::vector<ast::ptr<ast::DeclWithType>> const & old ) { 241 return TraitExpander::expandAssertions( old ); 242 } 243 239 244 } // namespace Validate 240 245 -
src/Validate/ForallPointerDecay.hpp
rffef246 r298fe57 10 10 // Created On : Tue Dec 7 16:15:00 2021 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tue Dec 8 11:50:00 202113 // Update Count : 012 // Last Modified On : Sat Apr 23 13:13:00 2022 13 // Update Count : 1 14 14 // 15 15 16 16 #pragma once 17 17 18 #include <vector> 19 #include "AST/Node.hpp" 20 18 21 namespace ast { 22 class DeclWithType; 19 23 class TranslationUnit; 20 24 } … … 27 31 void decayForallPointers( ast::TranslationUnit & transUnit ); 28 32 33 /// Expand all traits in an assertion list. 34 std::vector<ast::ptr<ast::DeclWithType>> expandAssertions( 35 std::vector<ast::ptr<ast::DeclWithType>> const & ); 36 29 37 } 30 38 -
src/Validate/GenericParameter.cpp
rffef246 r298fe57 10 10 // Created On : Fri Mar 21 10:02:00 2022 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Apr 13 10:09:00 202213 // Update Count : 012 // Last Modified On : Fri Apr 22 16:43:00 2022 13 // Update Count : 1 14 14 // 15 15 … … 22 22 #include "AST/TranslationUnit.hpp" 23 23 #include "AST/Type.hpp" 24 #include "Validate/NoIdSymbolTable.hpp" 24 25 25 26 namespace Validate { … … 138 139 // -------------------------------------------------------------------------- 139 140 140 // A SymbolTable that only has the operations used in the Translate Dimension 141 // pass. More importantly, it doesn't have some methods that should no be 142 // called by the Pass template (lookupId and addId). 143 class NoIdSymbolTable { 144 ast::SymbolTable base; 145 public: 146 # define FORWARD_X( func, types_and_names, just_names ) \ 147 inline auto func types_and_names -> decltype( base.func just_names ) { \ 148 return base.func just_names ; \ 149 } 150 # define FORWARD_0( func ) FORWARD_X( func, (), () ) 151 # define FORWARD_1( func, type ) FORWARD_X( func, (type arg), (arg) ) 152 # define FORWARD_2( func, t0, t1 ) FORWARD_X( func, (t0 a0, t1 a1), (a0, a1) ) 153 154 FORWARD_0( enterScope ) 155 FORWARD_0( leaveScope ) 156 FORWARD_1( lookupType, const std::string & ) 157 FORWARD_1( addType , const ast::NamedTypeDecl * ) 158 FORWARD_1( addStruct , const ast::StructDecl * ) 159 FORWARD_1( addEnum , const ast::EnumDecl * ) 160 FORWARD_1( addUnion , const ast::UnionDecl * ) 161 FORWARD_1( addTrait , const ast::TraitDecl * ) 162 FORWARD_2( addWith , const std::vector< ast::ptr<ast::Expr> > &, const ast::Decl * ) 163 }; 164 165 struct TranslateDimensionCore : public ast::WithGuards { 166 NoIdSymbolTable symtab; 141 struct TranslateDimensionCore : 142 public WithNoIdSymbolTable, public ast::WithGuards { 167 143 168 144 // SUIT: Struct- or Union- InstType -
src/Validate/module.mk
rffef246 r298fe57 20 20 Validate/CompoundLiteral.cpp \ 21 21 Validate/CompoundLiteral.hpp \ 22 Validate/EliminateTypedef.cpp \ 23 Validate/EliminateTypedef.hpp \ 24 Validate/FixQualifiedTypes.cpp \ 25 Validate/FixQualifiedTypes.hpp \ 22 26 Validate/ForallPointerDecay.cpp \ 23 27 Validate/ForallPointerDecay.hpp \ … … 26 30 Validate/HandleAttributes.cc \ 27 31 Validate/HandleAttributes.h \ 32 Validate/HoistStruct.cpp \ 33 Validate/HoistStruct.hpp \ 28 34 Validate/InitializerLength.cpp \ 29 35 Validate/InitializerLength.hpp \ 30 36 Validate/LabelAddressFixer.cpp \ 31 37 Validate/LabelAddressFixer.hpp \ 38 Validate/NoIdSymbolTable.hpp \ 32 39 Validate/ReturnCheck.cpp \ 33 40 Validate/ReturnCheck.hpp \ -
src/main.cc
rffef246 r298fe57 10 10 // Created On : Fri May 15 23:12:02 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Apr 13 11:11:00 202213 // Update Count : 67 212 // Last Modified On : Fri Apr 29 9:52:00 2022 13 // Update Count : 673 14 14 // 15 15 … … 75 75 #include "Tuples/Tuples.h" // for expandMemberTuples, expan... 76 76 #include "Validate/Autogen.hpp" // for autogenerateRoutines 77 #include "Validate/CompoundLiteral.hpp" // for handleCompoundLiterals 78 #include "Validate/EliminateTypedef.hpp" // for eliminateTypedef 79 #include "Validate/FindSpecialDecls.h" // for findGlobalDecls 80 #include "Validate/FixQualifiedTypes.hpp" // for fixQualifiedTypes 81 #include "Validate/ForallPointerDecay.hpp" // for decayForallPointers 77 82 #include "Validate/GenericParameter.hpp" // for fillGenericParameters, tr... 78 #include "Validate/FindSpecialDecls.h" // for findGlobalDecls 79 #include "Validate/ForallPointerDecay.hpp" // for decayForallPointers 80 #include "Validate/CompoundLiteral.hpp" // for handleCompoundLiterals 83 #include "Validate/HoistStruct.hpp" // for hoistStruct 81 84 #include "Validate/InitializerLength.hpp" // for setLengthFromInitializer 82 85 #include "Validate/LabelAddressFixer.hpp" // for fixLabelAddresses 86 #include "Validate/LinkReferenceToTypes.hpp"// for linkReferenceToTypes 83 87 #include "Validate/ReturnCheck.hpp" // for checkReturnStatements 84 88 #include "Virtual/ExpandCasts.h" // for expandCasts … … 328 332 // add the assignment statement after the initialization of a type parameter 329 333 PASS( "Validate-A", SymTab::validate_A( translationUnit ) ); 330 PASS( "Validate-B", SymTab::validate_B( translationUnit ) ); 334 335 // Must happen before auto-gen, because it uses the sized flag. 336 PASS( "Link Reference To Types", SymTab::linkReferenceToTypes( translationUnit ) ); 331 337 332 338 CodeTools::fillLocations( translationUnit ); … … 342 348 343 349 forceFillCodeLocations( transUnit ); 350 351 // Must happen after Link References To Types, 352 // because aggregate members are accessed. 353 PASS( "Fix Qualified Types", Validate::fixQualifiedTypes( transUnit ) ); 354 355 PASS( "Hoist Struct", Validate::hoistStruct( transUnit ) ); 356 PASS( "Eliminate Typedef", Validate::eliminateTypedef( transUnit ) ); 344 357 345 358 // Check as early as possible. Can't happen before … … 438 451 translationUnit = convert( move( transUnit ) ); 439 452 } else { 453 PASS( "Validate-B", SymTab::validate_B( translationUnit ) ); 440 454 PASS( "Validate-C", SymTab::validate_C( translationUnit ) ); 441 455 PASS( "Validate-D", SymTab::validate_D( translationUnit ) );
Note: See TracChangeset
for help on using the changeset viewer.