Changeset 85dac33
- Timestamp:
- Jul 19, 2019, 2:00:30 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 335d81f
- Parents:
- 8ac3b0e
- Location:
- src
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/FindOpenVars.cc
r8ac3b0e r85dac33 9 9 // Author : Richard C. Bilson 10 10 // Created On : Sun May 17 09:42:48 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Sun May 17 09:45:25 201513 // Update Count : 311 // Last Modified By : Andrew 12 // Last Modified On : Fri Jul 12 14:18:00 2019 13 // Update Count : 4 14 14 // 15 15 … … 29 29 FindOpenVars_old( OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen ); 30 30 31 void previsit( PointerType * pointerType );32 void previsit( ArrayType * arrayType );33 void previsit( FunctionType * functionType );34 void previsit( TupleType * tupleType );31 void previsit( const PointerType * pointerType ); 32 void previsit( const ArrayType * arrayType ); 33 void previsit( const FunctionType * functionType ); 34 void previsit( const TupleType * tupleType ); 35 35 36 void common_action( Type *type );36 void common_action( const Type *type ); 37 37 38 38 OpenVarSet &openVars, &closedVars; … … 41 41 }; 42 42 43 void findOpenVars( Type *type, OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen ) {43 void findOpenVars( const Type *type, OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen ) { 44 44 PassVisitor<FindOpenVars_old> finder( openVars, closedVars, needAssertions, haveAssertions, firstIsOpen ); 45 45 type->accept( finder ); … … 50 50 } 51 51 52 void FindOpenVars_old::common_action( Type *type ) {52 void FindOpenVars_old::common_action( const Type * type ) { 53 53 if ( nextIsOpen ) { 54 for ( Type::ForallList::const_iterator i = type-> get_forall().begin(); i != type->get_forall().end(); ++i ) {54 for ( Type::ForallList::const_iterator i = type->forall.begin(); i != type->forall.end(); ++i ) { 55 55 openVars[ (*i)->get_name() ] = TypeDecl::Data{ (*i) }; 56 56 for ( std::list< DeclarationWithType* >::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) { … … 61 61 } 62 62 } else { 63 for ( Type::ForallList::const_iterator i = type-> get_forall().begin(); i != type->get_forall().end(); ++i ) {63 for ( Type::ForallList::const_iterator i = type->forall.begin(); i != type->forall.end(); ++i ) { 64 64 closedVars[ (*i)->get_name() ] = TypeDecl::Data{ (*i) }; 65 65 for ( std::list< DeclarationWithType* >::const_iterator assert = (*i)->get_assertions().begin(); assert != (*i)->get_assertions().end(); ++assert ) { … … 78 78 } 79 79 80 void FindOpenVars_old::previsit( PointerType *pointerType) {80 void FindOpenVars_old::previsit(const PointerType * pointerType) { 81 81 common_action( pointerType ); 82 82 } 83 83 84 void FindOpenVars_old::previsit( ArrayType *arrayType) {84 void FindOpenVars_old::previsit(const ArrayType * arrayType) { 85 85 common_action( arrayType ); 86 86 } 87 87 88 void FindOpenVars_old::previsit( FunctionType *functionType) {88 void FindOpenVars_old::previsit(const FunctionType * functionType) { 89 89 common_action( functionType ); 90 90 nextIsOpen = ! nextIsOpen; … … 92 92 } 93 93 94 void FindOpenVars_old::previsit( TupleType *tupleType) {94 void FindOpenVars_old::previsit(const TupleType * tupleType) { 95 95 common_action( tupleType ); 96 96 } … … 104 104 bool nextIsOpen; 105 105 106 FindOpenVars_new( 107 ast::OpenVarSet & o, ast::OpenVarSet & c, ast::AssertionSet & n, 106 FindOpenVars_new( 107 ast::OpenVarSet & o, ast::OpenVarSet & c, ast::AssertionSet & n, 108 108 ast::AssertionSet & h, FirstMode firstIsOpen ) 109 109 : open( o ), closed( c ), need( n ), have( h ), nextIsOpen( firstIsOpen ) {} … … 135 135 } 136 136 137 void findOpenVars( 138 const ast::Type * type, ast::OpenVarSet & open, ast::OpenVarSet & closed, 137 void findOpenVars( 138 const ast::Type * type, ast::OpenVarSet & open, ast::OpenVarSet & closed, 139 139 ast::AssertionSet & need, ast::AssertionSet & have, FirstMode firstIsOpen ) { 140 140 ast::Pass< FindOpenVars_new > finder{ open, closed, need, have, firstIsOpen }; -
src/ResolvExpr/FindOpenVars.h
r8ac3b0e r85dac33 26 26 namespace ResolvExpr { 27 27 // Updates open and closed variables and their associated assertions 28 void findOpenVars( Type *type, OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen );28 void findOpenVars( const Type *type, OpenVarSet &openVars, OpenVarSet &closedVars, AssertionSet &needAssertions, AssertionSet &haveAssertions, bool firstIsOpen ); 29 29 30 30 enum FirstMode { FirstClosed, FirstOpen }; -
src/ResolvExpr/Occurs.cc
r8ac3b0e r85dac33 24 24 struct Occurs : public WithVisitorRef<Occurs> { 25 25 Occurs( std::string varName, const TypeEnvironment &env ); 26 void previsit( TypeInstType * typeInst );26 void previsit( const TypeInstType * typeInst ); 27 27 28 28 bool result; … … 31 31 }; 32 32 33 bool occurs( Type *type, std::stringvarName, const TypeEnvironment &env ) {33 bool occurs( const Type *type, const std::string & varName, const TypeEnvironment &env ) { 34 34 PassVisitor<Occurs> occur( varName, env ); 35 35 type->accept( occur ); … … 45 45 } 46 46 47 void Occurs::previsit( TypeInstType * typeInst ) {47 void Occurs::previsit( const TypeInstType * typeInst ) { 48 48 /// std::cerr << "searching for vars: "; 49 49 /// std::copy( eqvVars.begin(), eqvVars.end(), std::ostream_iterator< std::string >( std::cerr, " " ) ); -
src/ResolvExpr/ResolveAssertions.cc
r8ac3b0e r85dac33 73 73 CandidateList matches; 74 74 75 DeferItem( DeclarationWithType* decl, const AssertionSetValue& info, CandidateList&& matches )75 DeferItem( const DeclarationWithType* decl, const AssertionSetValue& info, CandidateList&& matches ) 76 76 : decl(decl), info(info), matches(std::move(matches)) {} 77 77 -
src/ResolvExpr/TypeEnvironment.cc
r8ac3b0e r85dac33 315 315 } 316 316 317 bool isFtype( Type *type ) {318 if ( dynamic_cast< FunctionType* >( type ) ) {317 bool isFtype( const Type *type ) { 318 if ( dynamic_cast< const FunctionType * >( type ) ) { 319 319 return true; 320 } else if ( TypeInstType *typeInst = dynamic_cast< TypeInstType* >( type ) ) {320 } else if ( const TypeInstType *typeInst = dynamic_cast< const TypeInstType * >( type ) ) { 321 321 return typeInst->get_isFtype(); 322 322 } // if -
src/ResolvExpr/typeops.h
r8ac3b0e r85dac33 149 149 150 150 // in Occurs.cc 151 bool occurs( Type * type, std::stringvarName, const TypeEnvironment & env );151 bool occurs( const Type * type, const std::string & varName, const TypeEnvironment & env ); 152 152 // new AST version in TypeEnvironment.cpp (only place it was used in old AST) 153 153 … … 200 200 201 201 // in TypeEnvironment.cc 202 bool isFtype( Type * type );202 bool isFtype( const Type * type ); 203 203 } // namespace ResolvExpr 204 204 -
src/SynTree/Type.cc
r8ac3b0e r85dac33 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 : Thu Jan 31 21:54:16201913 // Update Count : 4 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Jul 12 15:48:00 2019 13 // Update Count : 44 14 14 // 15 15 #include "Type.h" … … 141 141 } 142 142 143 const Type * Type::stripReferences() const { 144 const Type * type; 145 const ReferenceType * ref; 146 for ( type = this; (ref = dynamic_cast<const ReferenceType *>( type )); type = ref->base ); 147 return type; 148 } 149 143 150 int Type::referenceDepth() const { return 0; } 144 151 -
src/SynTree/Type.h
r8ac3b0e r85dac33 172 172 /// return type without outer references 173 173 Type * stripReferences(); 174 const Type * stripReferences() const; 174 175 175 176 /// return the number of references occuring consecutively on the outermost layer of this type (i.e. do not count references nested within other types) … … 256 257 BasicType( const Type::Qualifiers & tq, Kind bt, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 257 258 258 Kind get_kind() { return kind; }259 Kind get_kind() const { return kind; } 259 260 void set_kind( Kind newValue ) { kind = newValue; } 260 261
Note: See TracChangeset
for help on using the changeset viewer.