Changeset b726084 for src/GenPoly
- Timestamp:
- Nov 9, 2016, 2:51:42 PM (8 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 30b65d8, d073e3c
- Parents:
- 141b786 (diff), 84118d8 (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/GenPoly
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/GenPoly/Box.cc
r141b786 rb726084 64 64 65 65 /// Adds layout-generation functions to polymorphic types 66 class LayoutFunctionBuilder : public DeclMutator {66 class LayoutFunctionBuilder final : public DeclMutator { 67 67 unsigned int functionNesting; // current level of nested functions 68 68 public: 69 69 LayoutFunctionBuilder() : functionNesting( 0 ) {} 70 70 71 virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ); 72 virtual Declaration *mutate( StructDecl *structDecl ); 73 virtual Declaration *mutate( UnionDecl *unionDecl ); 71 using DeclMutator::mutate; 72 virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ) override; 73 virtual Declaration *mutate( StructDecl *structDecl ) override; 74 virtual Declaration *mutate( UnionDecl *unionDecl ) override; 74 75 }; 75 76 76 77 /// Replaces polymorphic return types with out-parameters, replaces calls to polymorphic functions with adapter calls as needed, and adds appropriate type variables to the function call 77 class Pass1 : public PolyMutator {78 class Pass1 final : public PolyMutator { 78 79 public: 79 80 Pass1(); 80 virtual Expression *mutate( ApplicationExpr *appExpr ); 81 virtual Expression *mutate( AddressExpr *addrExpr ); 82 virtual Expression *mutate( UntypedExpr *expr ); 83 virtual DeclarationWithType* mutate( FunctionDecl *functionDecl ); 84 virtual TypeDecl *mutate( TypeDecl *typeDecl ); 85 virtual Expression *mutate( CommaExpr *commaExpr ); 86 virtual Expression *mutate( ConditionalExpr *condExpr ); 87 virtual Statement * mutate( ReturnStmt *returnStmt ); 88 virtual Type *mutate( PointerType *pointerType ); 89 virtual Type * mutate( FunctionType *functionType ); 90 91 virtual void doBeginScope(); 92 virtual void doEndScope(); 81 82 using PolyMutator::mutate; 83 virtual Expression *mutate( ApplicationExpr *appExpr ) override; 84 virtual Expression *mutate( AddressExpr *addrExpr ) override; 85 virtual Expression *mutate( UntypedExpr *expr ) override; 86 virtual DeclarationWithType* mutate( FunctionDecl *functionDecl ) override; 87 virtual TypeDecl *mutate( TypeDecl *typeDecl ) override; 88 virtual Expression *mutate( CommaExpr *commaExpr ) override; 89 virtual Expression *mutate( ConditionalExpr *condExpr ) override; 90 virtual Statement * mutate( ReturnStmt *returnStmt ) override; 91 virtual Type *mutate( PointerType *pointerType ) override; 92 virtual Type * mutate( FunctionType *functionType ) override; 93 94 virtual void doBeginScope() override; 95 virtual void doEndScope() override; 93 96 private: 94 97 /// Pass the extra type parameters from polymorphic generic arguments or return types into a function application … … 135 138 /// * Moves polymorphic returns in function types to pointer-type parameters 136 139 /// * adds type size and assertion parameters to parameter lists 137 class Pass2 : public PolyMutator {140 class Pass2 final : public PolyMutator { 138 141 public: 139 142 template< typename DeclClass > 140 143 DeclClass *handleDecl( DeclClass *decl, Type *type ); 141 virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ); 142 virtual ObjectDecl *mutate( ObjectDecl *objectDecl ); 143 virtual TypeDecl *mutate( TypeDecl *typeDecl ); 144 virtual TypedefDecl *mutate( TypedefDecl *typedefDecl ); 145 virtual Type *mutate( PointerType *pointerType ); 146 virtual Type *mutate( FunctionType *funcType ); 144 145 using PolyMutator::mutate; 146 virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ) override; 147 virtual ObjectDecl *mutate( ObjectDecl *objectDecl ) override; 148 virtual TypeDecl *mutate( TypeDecl *typeDecl ) override; 149 virtual TypedefDecl *mutate( TypedefDecl *typedefDecl ) override; 150 virtual Type *mutate( PointerType *pointerType ) override; 151 virtual Type *mutate( FunctionType *funcType ) override; 147 152 148 153 private: … … 156 161 /// * Calculates polymorphic offsetof expressions from offset array 157 162 /// * Inserts dynamic calculation of polymorphic type layouts where needed 158 class PolyGenericCalculator : public PolyMutator {163 class PolyGenericCalculator final : public PolyMutator { 159 164 public: 160 165 typedef PolyMutator Parent; … … 163 168 template< typename DeclClass > 164 169 DeclClass *handleDecl( DeclClass *decl, Type *type ); 165 virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ) ;166 virtual ObjectDecl *mutate( ObjectDecl *objectDecl ) ;167 virtual TypedefDecl *mutate( TypedefDecl *objectDecl ) ;168 virtual TypeDecl *mutate( TypeDecl *objectDecl ) ;169 virtual Statement *mutate( DeclStmt *declStmt ) ;170 virtual Type *mutate( PointerType *pointerType ) ;171 virtual Type *mutate( FunctionType *funcType ) ;172 virtual Expression *mutate( MemberExpr *memberExpr ) ;173 virtual Expression *mutate( SizeofExpr *sizeofExpr ) ;174 virtual Expression *mutate( AlignofExpr *alignofExpr ) ;175 virtual Expression *mutate( OffsetofExpr *offsetofExpr ) ;176 virtual Expression *mutate( OffsetPackExpr *offsetPackExpr ) ;177 178 virtual void doBeginScope() ;179 virtual void doEndScope() ;170 virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ) override; 171 virtual ObjectDecl *mutate( ObjectDecl *objectDecl ) override; 172 virtual TypedefDecl *mutate( TypedefDecl *objectDecl ) override; 173 virtual TypeDecl *mutate( TypeDecl *objectDecl ) override; 174 virtual Statement *mutate( DeclStmt *declStmt ) override; 175 virtual Type *mutate( PointerType *pointerType ) override; 176 virtual Type *mutate( FunctionType *funcType ) override; 177 virtual Expression *mutate( MemberExpr *memberExpr ) override; 178 virtual Expression *mutate( SizeofExpr *sizeofExpr ) override; 179 virtual Expression *mutate( AlignofExpr *alignofExpr ) override; 180 virtual Expression *mutate( OffsetofExpr *offsetofExpr ) override; 181 virtual Expression *mutate( OffsetPackExpr *offsetPackExpr ) override; 182 183 virtual void doBeginScope() override; 184 virtual void doEndScope() override; 180 185 181 186 private: … … 197 202 198 203 /// Replaces initialization of polymorphic values with alloca, declaration of dtype/ftype with appropriate void expression, and sizeof expressions of polymorphic types with the proper variable 199 class Pass3 : public PolyMutator {204 class Pass3 final : public PolyMutator { 200 205 public: 201 206 template< typename DeclClass > 202 207 DeclClass *handleDecl( DeclClass *decl, Type *type ); 203 virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ); 204 virtual ObjectDecl *mutate( ObjectDecl *objectDecl ); 205 virtual TypedefDecl *mutate( TypedefDecl *objectDecl ); 206 virtual TypeDecl *mutate( TypeDecl *objectDecl ); 207 virtual Type *mutate( PointerType *pointerType ); 208 virtual Type *mutate( FunctionType *funcType ); 208 209 using PolyMutator::mutate; 210 virtual DeclarationWithType *mutate( FunctionDecl *functionDecl ) override; 211 virtual ObjectDecl *mutate( ObjectDecl *objectDecl ) override; 212 virtual TypedefDecl *mutate( TypedefDecl *objectDecl ) override; 213 virtual TypeDecl *mutate( TypeDecl *objectDecl ) override; 214 virtual Type *mutate( PointerType *pointerType ) override; 215 virtual Type *mutate( FunctionType *funcType ) override; 209 216 private: 210 217 }; -
src/GenPoly/InstantiateGeneric.cc
r141b786 rb726084 147 147 148 148 /// Mutator pass that replaces concrete instantiations of generic types with actual struct declarations, scoped appropriately 149 class GenericInstantiator : public DeclMutator {149 class GenericInstantiator final : public DeclMutator { 150 150 /// Map of (generic type, parameter list) pairs to concrete type instantiations 151 151 InstantiationMap< AggregateDecl, AggregateDecl > instantiations; … … 158 158 GenericInstantiator() : DeclMutator(), instantiations(), dtypeStatics(), typeNamer("_conc_") {} 159 159 160 virtual Type* mutate( StructInstType *inst ); 161 virtual Type* mutate( UnionInstType *inst ); 162 163 virtual void doBeginScope(); 164 virtual void doEndScope(); 160 using DeclMutator::mutate; 161 virtual Type* mutate( StructInstType *inst ) override; 162 virtual Type* mutate( UnionInstType *inst ) override; 163 164 virtual void doBeginScope() override; 165 virtual void doEndScope() override; 165 166 private: 166 167 /// Wrap instantiation lookup for structs -
src/GenPoly/Specialize.cc
r141b786 rb726084 36 36 const std::list<Label> noLabels; 37 37 38 class Specialize : public PolyMutator {38 class Specialize final : public PolyMutator { 39 39 public: 40 40 Specialize( std::string paramPrefix = "_p" ); 41 41 42 virtual Expression * mutate( ApplicationExpr *applicationExpr ); 43 virtual Expression * mutate( AddressExpr *castExpr ); 44 virtual Expression * mutate( CastExpr *castExpr ); 42 using PolyMutator::mutate; 43 virtual Expression * mutate( ApplicationExpr *applicationExpr ) override; 44 virtual Expression * mutate( AddressExpr *castExpr ) override; 45 virtual Expression * mutate( CastExpr *castExpr ) override; 45 46 // virtual Expression * mutate( LogicalExpr *logicalExpr ); 46 47 // virtual Expression * mutate( ConditionalExpr *conditionalExpr );
Note: See TracChangeset
for help on using the changeset viewer.