Changeset b1e63ac5 for src/InitTweak
- Timestamp:
- Jul 4, 2017, 9:40:16 AM (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:
- 208e5be
- Parents:
- 9c951e3 (diff), f7cb0bc (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/InitTweak
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixGlobalInit.cc
r9c951e3 rb1e63ac5 26 26 27 27 namespace InitTweak { 28 namespace {29 const std::list<Label> noLabels;30 }31 32 28 class GlobalFixer : public Visitor { 33 29 public: … … 129 125 130 126 // only modify global variables 131 void GlobalFixer::visit( FunctionDecl *functionDecl ) {}132 void GlobalFixer::visit( StructDecl *aggregateDecl ) {}133 void GlobalFixer::visit( UnionDecl *aggregateDecl ) {}134 void GlobalFixer::visit( EnumDecl *aggregateDecl ) {}135 void GlobalFixer::visit( TraitDecl *aggregateDecl ) {}136 void GlobalFixer::visit( TypeDecl *typeDecl ) {}127 void GlobalFixer::visit( __attribute__((unused)) FunctionDecl *functionDecl ) {} 128 void GlobalFixer::visit( __attribute__((unused)) StructDecl *aggregateDecl ) {} 129 void GlobalFixer::visit( __attribute__((unused)) UnionDecl *aggregateDecl ) {} 130 void GlobalFixer::visit( __attribute__((unused)) EnumDecl *aggregateDecl ) {} 131 void GlobalFixer::visit( __attribute__((unused)) TraitDecl *aggregateDecl ) {} 132 void GlobalFixer::visit( __attribute__((unused)) TypeDecl *typeDecl ) {} 137 133 138 134 } // namespace InitTweak -
src/InitTweak/FixInit.cc
r9c951e3 rb1e63ac5 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Mar 17 09:13:47201713 // Update Count : 7 112 // Last Modified On : Wed Jun 21 17:35:05 2017 13 // Update Count : 74 14 14 // 15 15 … … 20 20 #include <unordered_map> 21 21 #include <unordered_set> 22 22 23 #include "InitTweak.h" 23 24 #include "GenInit.h" 24 25 #include "FixInit.h" 25 26 #include "FixGlobalInit.h" 27 #include "CodeGen/GenType.h" // for warning/error messages 28 #include "Common/PassVisitor.h" 29 #include "GenPoly/DeclMutator.h" 30 #include "GenPoly/PolyMutator.h" 26 31 #include "ResolvExpr/Resolver.h" 27 32 #include "ResolvExpr/typeops.h" 33 #include "SymTab/Autogen.h" 34 #include "SymTab/Indexer.h" 35 #include "SynTree/AddStmtVisitor.h" 36 #include "SynTree/Attribute.h" 28 37 #include "SynTree/Declaration.h" 29 #include "SynTree/Type.h"30 38 #include "SynTree/Expression.h" 31 #include "SynTree/Attribute.h"32 #include "SynTree/Statement.h"33 39 #include "SynTree/Initializer.h" 34 40 #include "SynTree/Mutator.h" 35 #include "SymTab/Indexer.h" 36 #include "SymTab/Autogen.h" 37 #include "GenPoly/PolyMutator.h" 38 #include "GenPoly/DeclMutator.h" 39 #include "SynTree/AddStmtVisitor.h" 40 #include "CodeGen/GenType.h" // for warning/error messages 41 #include "SynTree/Statement.h" 42 #include "SynTree/Type.h" 41 43 #include "Tuples/Tuples.h" 42 44 … … 54 56 typedef std::unordered_map< int, int > UnqCount; 55 57 56 class InsertImplicitCalls final : public GenPoly::PolyMutator{58 class InsertImplicitCalls : public WithTypeSubstitution { 57 59 public: 58 60 /// wrap function application expressions as ImplicitCopyCtorExpr nodes so that it is easy to identify which … … 61 63 62 64 InsertImplicitCalls( EnvMap & envMap ) : envMap( envMap ) {} 63 typedef GenPoly::PolyMutator Parent; 64 using Parent::mutate; 65 virtual Expression * mutate( ApplicationExpr * appExpr ) override; 66 virtual Expression * mutate( StmtExpr * stmtExpr ) override; 65 66 Expression * postmutate( ApplicationExpr * appExpr ); 67 void premutate( StmtExpr * stmtExpr ); 67 68 68 69 // collects environments for relevant nodes … … 103 104 typedef AddStmtVisitor Parent; 104 105 using Parent::visit; 105 typedef std::set< ObjectDecl * > ObjectSet; 106 // use ordered data structure to maintain ordering for set_difference and for consistent error messages 107 typedef std::list< ObjectDecl * > ObjectSet; 106 108 virtual void visit( CompoundStmt *compoundStmt ) override; 107 109 virtual void visit( DeclStmt *stmt ) override; 108 110 109 111 // don't go into other functions 110 virtual void visit( FunctionDecl *decl ) override {}112 virtual void visit( __attribute__((unused)) FunctionDecl *decl ) override {} 111 113 112 114 protected: … … 115 117 116 118 // debug 117 struct printSet {118 typedef ObjDeclCollector::ObjectSet ObjectSet;119 printSet( const ObjectSet & objs ) : objs( objs ) {}119 template<typename ObjectSet> 120 struct PrintSet { 121 PrintSet( const ObjectSet & objs ) : objs( objs ) {} 120 122 const ObjectSet & objs; 121 123 }; 122 std::ostream & operator<<( std::ostream & out, const printSet & set) { 124 template<typename ObjectSet> 125 PrintSet<ObjectSet> printSet( const ObjectSet & objs ) { return PrintSet<ObjectSet>( objs ); } 126 template<typename ObjectSet> 127 std::ostream & operator<<( std::ostream & out, const PrintSet<ObjectSet> & set) { 123 128 out << "{ "; 124 129 for ( ObjectDecl * obj : set.objs ) { … … 190 195 }; 191 196 192 class FixInit final : public GenPoly::PolyMutator{197 class FixInit : public WithStmtsToAdd { 193 198 public: 194 199 /// expand each object declaration to use its constructor after it is declared. 195 200 static void fixInitializers( std::list< Declaration * > &translationUnit ); 196 201 197 typedef GenPoly::PolyMutator Parent; 198 using Parent::mutate; 199 virtual DeclarationWithType * mutate( ObjectDecl *objDecl ) override; 202 DeclarationWithType * postmutate( ObjectDecl *objDecl ); 200 203 201 204 std::list< Declaration * > staticDtorDecls; … … 300 303 namespace { 301 304 void InsertImplicitCalls::insert( std::list< Declaration * > & translationUnit, EnvMap & envMap ) { 302 InsertImplicitCallsinserter( envMap );305 PassVisitor<InsertImplicitCalls> inserter( envMap ); 303 306 mutateAll( translationUnit, inserter ); 304 307 } … … 310 313 311 314 void FixInit::fixInitializers( std::list< Declaration * > & translationUnit ) { 312 FixInitfixer;315 PassVisitor<FixInit> fixer; 313 316 314 317 // can't use mutateAll, because need to insert declarations at top-level … … 318 321 try { 319 322 *i = maybeMutate( *i, fixer ); 320 translationUnit.splice( i, fixer. staticDtorDecls );323 translationUnit.splice( i, fixer.pass.staticDtorDecls ); 321 324 } catch( SemanticError &e ) { 322 325 e.set_location( (*i)->location ); … … 350 353 } 351 354 352 Expression * InsertImplicitCalls::mutate( ApplicationExpr * appExpr ) { 353 appExpr = dynamic_cast< ApplicationExpr * >( Parent::mutate( appExpr ) ); 355 Expression * InsertImplicitCalls::postmutate( ApplicationExpr * appExpr ) { 354 356 assert( appExpr ); 355 357 … … 393 395 } 394 396 395 Expression * InsertImplicitCalls::mutate( StmtExpr * stmtExpr ) {397 void InsertImplicitCalls::premutate( StmtExpr * stmtExpr ) { 396 398 assert( env ); 397 399 envMap[stmtExpr] = env; 398 return Parent::mutate( stmtExpr );399 400 } 400 401 … … 696 697 } 697 698 698 DeclarationWithType *FixInit::mutate( ObjectDecl *objDecl ) { 699 // first recursively handle pieces of ObjectDecl so that they aren't missed by other visitors when the init 700 // is removed from the ObjectDecl 701 objDecl = dynamic_cast< ObjectDecl * >( Parent::mutate( objDecl ) ); 699 DeclarationWithType *FixInit::postmutate( ObjectDecl *objDecl ) { 700 // since this removes the init field from objDecl, it must occur after children are mutated (i.e. postmutate) 702 701 if ( ConstructorInit * ctorInit = dynamic_cast< ConstructorInit * >( objDecl->get_init() ) ) { 703 702 // a decision should have been made by the resolver, so ctor and init are not both non-NULL … … 729 728 // static bool __objName_uninitialized = true 730 729 BasicType * boolType = new BasicType( Type::Qualifiers(), BasicType::Bool ); 731 SingleInit * boolInitExpr = new SingleInit( new ConstantExpr( Constant ( boolType->clone(), "1" ) ), noDesignators);730 SingleInit * boolInitExpr = new SingleInit( new ConstantExpr( Constant::from_int( 1 ) ) ); 732 731 ObjectDecl * isUninitializedVar = new ObjectDecl( objDecl->get_mangleName() + "_uninitialized", Type::StorageClasses( Type::Static ), LinkageSpec::Cforall, 0, boolType, boolInitExpr ); 733 732 isUninitializedVar->fixUniqueId(); … … 736 735 UntypedExpr * setTrue = new UntypedExpr( new NameExpr( "?=?" ) ); 737 736 setTrue->get_args().push_back( new VariableExpr( isUninitializedVar ) ); 738 setTrue->get_args().push_back( new ConstantExpr( Constant ( boolType->clone(), "0") ) );737 setTrue->get_args().push_back( new ConstantExpr( Constant::from_int( 0 ) ) ); 739 738 740 739 // generate body of if … … 750 749 751 750 Statement * dtor = ctorInit->get_dtor(); 752 objDecl->set_init( NULL);753 ctorInit->set_ctor( NULL);751 objDecl->set_init( nullptr ); 752 ctorInit->set_ctor( nullptr ); 754 753 ctorInit->set_dtor( nullptr ); 755 754 if ( dtor ) { … … 804 803 } else { 805 804 stmtsToAddAfter.push_back( ctor ); 806 objDecl->set_init( NULL);807 ctorInit->set_ctor( NULL);805 objDecl->set_init( nullptr ); 806 ctorInit->set_ctor( nullptr ); 808 807 } 809 808 } // if 810 809 } else if ( Initializer * init = ctorInit->get_init() ) { 811 810 objDecl->set_init( init ); 812 ctorInit->set_init( NULL);811 ctorInit->set_init( nullptr ); 813 812 } else { 814 813 // no constructor and no initializer, which is okay 815 objDecl->set_init( NULL);814 objDecl->set_init( nullptr ); 816 815 } // if 817 816 delete ctorInit; … … 821 820 822 821 void ObjDeclCollector::visit( CompoundStmt * compoundStmt ) { 823 std::set< ObjectDecl * >prevVars = curVars;822 ObjectSet prevVars = curVars; 824 823 Parent::visit( compoundStmt ); 825 824 curVars = prevVars; … … 829 828 // keep track of all variables currently in scope 830 829 if ( ObjectDecl * objDecl = dynamic_cast< ObjectDecl * > ( stmt->get_decl() ) ) { 831 curVars. insert( objDecl );830 curVars.push_back( objDecl ); 832 831 } // if 833 832 Parent::visit( stmt ); … … 896 895 Parent::visit( compoundStmt ); 897 896 898 // add destructors for the current scope that we're exiting 897 // add destructors for the current scope that we're exiting, unless the last statement is a return, which 898 // causes unreachable code warnings 899 899 std::list< Statement * > & statements = compoundStmt->get_kids(); 900 insertDtors( reverseDeclOrder.front().begin(), reverseDeclOrder.front().end(), back_inserter( statements ) ); 900 if ( ! statements.empty() && ! dynamic_cast< ReturnStmt * >( statements.back() ) ) { 901 insertDtors( reverseDeclOrder.front().begin(), reverseDeclOrder.front().end(), back_inserter( statements ) ); 902 } 901 903 reverseDeclOrder.pop_front(); 902 904 } 903 905 904 void InsertDtors::visit( ReturnStmt * returnStmt ) {906 void InsertDtors::visit( __attribute((unused)) ReturnStmt * returnStmt ) { 905 907 // return exits all scopes, so dump destructors for all scopes 906 908 for ( OrderedDecls & od : reverseDeclOrder ) { … … 941 943 ) 942 944 if ( ! diff.empty() ) { 945 // create an auxilliary set for fast lookup -- can't make diff a set, because diff ordering should be consistent for error messages. 946 std::unordered_set<ObjectDecl *> needsDestructor( diff.begin(), diff.end() ); 947 943 948 // go through decl ordered list of objectdecl. for each element that occurs in diff, output destructor 944 949 OrderedDecls ordered; 945 950 for ( OrderedDecls & rdo : reverseDeclOrder ) { 946 951 // add elements from reverseDeclOrder into ordered if they occur in diff - it is key that this happens in reverse declaration order. 947 copy_if( rdo.begin(), rdo.end(), back_inserter( ordered ), [&]( ObjectDecl * objDecl ) { return diff.count( objDecl ); } );952 copy_if( rdo.begin(), rdo.end(), back_inserter( ordered ), [&]( ObjectDecl * objDecl ) { return needsDestructor.count( objDecl ); } ); 948 953 } // for 949 954 insertDtors( ordered.begin(), ordered.end(), back_inserter( stmtsToAdd ) ); -
src/InitTweak/GenInit.cc
r9c951e3 rb1e63ac5 16 16 #include <stack> 17 17 #include <list> 18 19 #include "InitTweak.h" 18 20 #include "GenInit.h" 19 #include "InitTweak.h" 21 22 #include "Common/PassVisitor.h" 23 24 #include "GenPoly/DeclMutator.h" 25 #include "GenPoly/PolyMutator.h" 26 #include "GenPoly/ScopedSet.h" 27 28 #include "ResolvExpr/typeops.h" 29 20 30 #include "SynTree/Declaration.h" 21 #include "SynTree/Type.h"22 31 #include "SynTree/Expression.h" 23 #include "SynTree/Statement.h"24 32 #include "SynTree/Initializer.h" 25 33 #include "SynTree/Mutator.h" 34 #include "SynTree/Statement.h" 35 #include "SynTree/Type.h" 36 26 37 #include "SymTab/Autogen.h" 27 38 #include "SymTab/Mangler.h" 28 #include "GenPoly/PolyMutator.h"29 #include "GenPoly/DeclMutator.h"30 #include "GenPoly/ScopedSet.h"31 #include "ResolvExpr/typeops.h"32 39 33 40 namespace InitTweak { … … 37 44 } 38 45 39 class ReturnFixer final : public GenPoly::PolyMutator { 40 public: 46 struct ReturnFixer : public WithStmtsToAdd, public WithGuards { 41 47 /// consistently allocates a temporary variable for the return value 42 48 /// of a function so that anything which the resolver decides can be constructed … … 44 50 static void makeReturnTemp( std::list< Declaration * > &translationUnit ); 45 51 46 ReturnFixer(); 47 48 typedef GenPoly::PolyMutator Parent; 49 using Parent::mutate; 50 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ) override; 51 virtual Statement * mutate( ReturnStmt * returnStmt ) override; 52 void premutate( FunctionDecl *functionDecl ); 53 void premutate( ReturnStmt * returnStmt ); 52 54 53 55 protected: … … 56 58 }; 57 59 58 class CtorDtor final : public GenPoly::PolyMutator { 59 public: 60 typedef GenPoly::PolyMutator Parent; 61 using Parent::mutate; 60 struct CtorDtor : public WithGuards, public WithShortCircuiting { 62 61 /// create constructor and destructor statements for object declarations. 63 62 /// the actual call statements will be added in after the resolver has run … … 66 65 static void generateCtorDtor( std::list< Declaration * > &translationUnit ); 67 66 68 virtual DeclarationWithType * mutate( ObjectDecl * ) override; 69 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ) override; 67 void previsit( ObjectDecl * ); 68 void previsit( FunctionDecl *functionDecl ); 69 70 70 // should not traverse into any of these declarations to find objects 71 71 // that need to be constructed or destructed 72 v irtual Declaration* mutate( StructDecl *aggregateDecl ) override;73 v irtual Declaration* mutate( UnionDecl *aggregateDecl ) override { return aggregateDecl; }74 v irtual Declaration* mutate( EnumDecl *aggregateDecl ) override { return aggregateDecl; }75 v irtual Declaration* mutate( TraitDecl *aggregateDecl ) override { return aggregateDecl; }76 v irtual TypeDecl* mutate( TypeDecl *typeDecl ) override { return typeDecl; }77 v irtual Declaration* mutate( TypedefDecl *typeDecl ) override { return typeDecl; }78 79 v irtual Type * mutate( FunctionType *funcType ) override { return funcType; }80 81 v irtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) override;72 void previsit( StructDecl *aggregateDecl ); 73 void previsit( UnionDecl *aggregateDecl ) { visit_children = false; } 74 void previsit( EnumDecl *aggregateDecl ) { visit_children = false; } 75 void previsit( TraitDecl *aggregateDecl ) { visit_children = false; } 76 void previsit( TypeDecl *typeDecl ) { visit_children = false; } 77 void previsit( TypedefDecl *typeDecl ) { visit_children = false; } 78 79 void previsit( FunctionType *funcType ) { visit_children = false; } 80 81 void previsit( CompoundStmt * compoundStmt ); 82 82 83 83 private: … … 131 131 132 132 void ReturnFixer::makeReturnTemp( std::list< Declaration * > & translationUnit ) { 133 ReturnFixerfixer;133 PassVisitor<ReturnFixer> fixer; 134 134 mutateAll( translationUnit, fixer ); 135 135 } 136 136 137 ReturnFixer::ReturnFixer() {} 138 139 Statement *ReturnFixer::mutate( ReturnStmt *returnStmt ) { 137 void ReturnFixer::premutate( ReturnStmt *returnStmt ) { 140 138 std::list< DeclarationWithType * > & returnVals = ftype->get_returnVals(); 141 139 assert( returnVals.size() == 0 || returnVals.size() == 1 ); … … 148 146 construct->get_args().push_back( new AddressExpr( new VariableExpr( returnVals.front() ) ) ); 149 147 construct->get_args().push_back( returnStmt->get_expr() ); 150 stmtsToAdd .push_back(new ExprStmt(noLabels, construct));148 stmtsToAddBefore.push_back(new ExprStmt(noLabels, construct)); 151 149 152 150 // return the retVal object 153 151 returnStmt->set_expr( new VariableExpr( returnVals.front() ) ); 154 152 } // if 155 return returnStmt; 156 } 157 158 DeclarationWithType* ReturnFixer::mutate( FunctionDecl *functionDecl ) { 159 ValueGuard< FunctionType * > oldFtype( ftype ); 160 ValueGuard< std::string > oldFuncName( funcName ); 153 } 154 155 void ReturnFixer::premutate( FunctionDecl *functionDecl ) { 156 GuardValue( ftype ); 157 GuardValue( funcName ); 161 158 162 159 ftype = functionDecl->get_functionType(); 163 160 funcName = functionDecl->get_name(); 164 return Parent::mutate( functionDecl );165 161 } 166 162 … … 212 208 213 209 void CtorDtor::generateCtorDtor( std::list< Declaration * > & translationUnit ) { 214 CtorDtorctordtor;215 mutateAll( translationUnit, ctordtor );210 PassVisitor<CtorDtor> ctordtor; 211 acceptAll( translationUnit, ctordtor ); 216 212 } 217 213 … … 291 287 } 292 288 293 DeclarationWithType * CtorDtor::mutate( ObjectDecl * objDecl ) {289 void CtorDtor::previsit( ObjectDecl * objDecl ) { 294 290 handleDWT( objDecl ); 295 291 // hands off if @=, extern, builtin, etc. … … 303 299 objDecl->set_init( genCtorInit( objDecl ) ); 304 300 } 305 return Parent::mutate( objDecl ); 306 } 307 308 DeclarationWithType * CtorDtor::mutate( FunctionDecl *functionDecl ) { 309 ValueGuard< bool > oldInFunc = inFunction; 301 } 302 303 void CtorDtor::previsit( FunctionDecl *functionDecl ) { 304 GuardValue( inFunction ); 310 305 inFunction = true; 311 306 312 307 handleDWT( functionDecl ); 313 308 314 managedTypes.beginScope();309 GuardScope( managedTypes ); 315 310 // go through assertions and recursively add seen ctor/dtors 316 311 for ( auto & tyDecl : functionDecl->get_functionType()->get_forall() ) { 317 312 for ( DeclarationWithType *& assertion : tyDecl->get_assertions() ) { 318 assertion = assertion->acceptMutator( *this);313 handleDWT( assertion ); 319 314 } 320 315 } 321 // parameters should not be constructed and destructed, so don't mutate FunctionType 322 functionDecl->set_statements( maybeMutate( functionDecl->get_statements(), *this ) ); 323 324 managedTypes.endScope(); 325 return functionDecl; 326 } 327 328 Declaration* CtorDtor::mutate( StructDecl *aggregateDecl ) { 316 317 PassVisitor<CtorDtor> newCtorDtor; 318 newCtorDtor.pass = *this; 319 maybeAccept( functionDecl->get_statements(), newCtorDtor ); 320 visit_children = false; // do not try and construct parameters or forall parameters - must happen after maybeAccept 321 } 322 323 void CtorDtor::previsit( StructDecl *aggregateDecl ) { 324 visit_children = false; // do not try to construct and destruct aggregate members 325 329 326 // don't construct members, but need to take note if there is a managed member, 330 327 // because that means that this type is also managed … … 338 335 } 339 336 } 340 return aggregateDecl; 341 } 342 343 CompoundStmt * CtorDtor::mutate( CompoundStmt * compoundStmt ) { 344 managedTypes.beginScope(); 345 CompoundStmt * stmt = Parent::mutate( compoundStmt ); 346 managedTypes.endScope(); 347 return stmt; 348 } 349 337 } 338 339 void CtorDtor::previsit( CompoundStmt * compoundStmt ) { 340 GuardScope( managedTypes ); 341 } 350 342 } // namespace InitTweak 351 343 -
src/InitTweak/InitTweak.cc
r9c951e3 rb1e63ac5 14 14 public: 15 15 bool hasDesignations = false; 16 template<typename Init> 17 void handleInit( Init * init ) { 18 if ( ! init->get_designators().empty() ) hasDesignations = true; 19 else Visitor::visit( init ); 20 } 21 virtual void visit( SingleInit * singleInit ) { handleInit( singleInit); } 22 virtual void visit( ListInit * listInit ) { handleInit( listInit); } 16 virtual void visit( Designation * des ) { 17 if ( ! des->get_designators().empty() ) hasDesignations = true; 18 else Visitor::visit( des ); 19 } 23 20 }; 24 21 … … 92 89 InitImpl( Initializer * init ) : init( init ) {} 93 90 94 virtual std::list< Expression * > next( std::list< Expression * > & indices ) {91 virtual std::list< Expression * > next( __attribute((unused)) std::list< Expression * > & indices ) { 95 92 // this is wrong, but just a placeholder for now 96 93 // if ( ! flattened ) flatten( indices ); … … 248 245 } 249 246 250 Statement * ExprImpl::buildListInit( UntypedExpr * dst,std::list< Expression * > & indices ) {247 Statement * ExprImpl::buildListInit( __attribute((unused)) UntypedExpr * dst, __attribute((unused)) std::list< Expression * > & indices ) { 251 248 return NULL; 252 249 } … … 477 474 ConstExprChecker() : isConstExpr( true ) {} 478 475 479 virtual void visit( ApplicationExpr *applicationExpr ) { isConstExpr = false; } 480 virtual void visit( UntypedExpr *untypedExpr ) { isConstExpr = false; } 476 using Visitor::visit; 477 478 virtual void visit( __attribute((unused)) ApplicationExpr *applicationExpr ) { isConstExpr = false; } 479 virtual void visit( __attribute((unused)) UntypedExpr *untypedExpr ) { isConstExpr = false; } 481 480 virtual void visit( NameExpr *nameExpr ) { 482 481 // xxx - temporary hack, because 0 and 1 really should be constexprs, even though they technically aren't in Cforall today … … 489 488 if ( ! dynamic_cast< NameExpr * >( arg) && ! dynamic_cast< VariableExpr * >( arg ) && ! dynamic_cast< MemberExpr * >( arg ) && ! dynamic_cast< UntypedMemberExpr * >( arg ) ) isConstExpr = false; 490 489 } 491 virtual void visit( LabelAddressExpr *labAddressExpr ) { isConstExpr = false; }492 virtual void visit( UntypedMemberExpr *memberExpr ) { isConstExpr = false; }493 virtual void visit( MemberExpr *memberExpr ) { isConstExpr = false; }494 virtual void visit( VariableExpr *variableExpr ) { isConstExpr = false; }490 virtual void visit( __attribute((unused)) LabelAddressExpr *labAddressExpr ) { isConstExpr = false; } 491 virtual void visit( __attribute((unused)) UntypedMemberExpr *memberExpr ) { isConstExpr = false; } 492 virtual void visit( __attribute((unused)) MemberExpr *memberExpr ) { isConstExpr = false; } 493 virtual void visit( __attribute((unused)) VariableExpr *variableExpr ) { isConstExpr = false; } 495 494 // these might be okay? 496 495 // virtual void visit( SizeofExpr *sizeofExpr ); … … 503 502 // virtual void visit( LogicalExpr *logicalExpr ); 504 503 // virtual void visit( ConditionalExpr *conditionalExpr ); 505 virtual void visit( TypeExpr *typeExpr ) { isConstExpr = false; }506 virtual void visit( AsmExpr *asmExpr ) { isConstExpr = false; }507 virtual void visit( UntypedValofExpr *valofExpr ) { isConstExpr = false; }508 virtual void visit( CompoundLiteralExpr *compLitExpr ) { isConstExpr = false; }509 virtual void visit( UntypedTupleExpr *tupleExpr ) { isConstExpr = false; }510 virtual void visit( TupleExpr *tupleExpr ) { isConstExpr = false; }511 virtual void visit( TupleAssignExpr *tupleExpr ) { isConstExpr = false; }504 virtual void visit( __attribute((unused)) TypeExpr *typeExpr ) { isConstExpr = false; } 505 virtual void visit( __attribute((unused)) AsmExpr *asmExpr ) { isConstExpr = false; } 506 virtual void visit( __attribute((unused)) UntypedValofExpr *valofExpr ) { isConstExpr = false; } 507 virtual void visit( __attribute((unused)) CompoundLiteralExpr *compLitExpr ) { isConstExpr = false; } 508 virtual void visit( __attribute((unused)) UntypedTupleExpr *tupleExpr ) { isConstExpr = false; } 509 virtual void visit( __attribute((unused)) TupleExpr *tupleExpr ) { isConstExpr = false; } 510 virtual void visit( __attribute((unused)) TupleAssignExpr *tupleExpr ) { isConstExpr = false; } 512 511 513 512 bool isConstExpr;
Note:
See TracChangeset
for help on using the changeset viewer.