Changeset ac74057
- Timestamp:
- Sep 25, 2017, 5:05:12 PM (7 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:
- 92b3de1
- Parents:
- b4bfa0a
- Location:
- src
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/FixInit.cc
rb4bfa0a rac74057 36 36 #include "FixGlobalInit.h" // for fixGlobalInit 37 37 #include "GenInit.h" // for genCtorDtor 38 #include "GenPoly/DeclMutator.h" // for DeclMutator39 38 #include "GenPoly/GenPoly.h" // for getFunctionType 40 39 #include "GenPoly/PolyMutator.h" // for PolyMutator -
src/InitTweak/GenInit.cc
rb4bfa0a rac74057 26 26 #include "Common/UniqueName.h" // for UniqueName 27 27 #include "Common/utility.h" // for ValueGuard, maybeClone 28 #include "GenPoly/DeclMutator.h" // for DeclMutator29 28 #include "GenPoly/GenPoly.h" // for getFunctionType, isPolyType 30 29 #include "GenPoly/ScopedSet.h" // for ScopedSet, ScopedSet<>::const_iter... -
src/SymTab/Autogen.cc
rb4bfa0a rac74057 29 29 #include "Common/ScopedMap.h" // for ScopedMap<>::const_iterator, Scope... 30 30 #include "Common/utility.h" // for cloneAll, operator+ 31 #include "GenPoly/DeclMutator.h" // for DeclMutator32 31 #include "GenPoly/ScopedSet.h" // for ScopedSet, ScopedSet<>::iterator 33 32 #include "InitTweak/GenInit.h" // for fixReturnStatements … … 81 80 82 81 /// generates routines for tuple types. 83 /// Doesn't really need to be a mutator, but it's easier to reuse DeclMutator than it is to use AddVisit 84 /// or anything we currently have that supports adding new declarations for visitors 85 class AutogenTupleRoutines : public GenPoly::DeclMutator { 86 public: 87 typedef GenPoly::DeclMutator Parent; 88 using Parent::mutate; 89 90 virtual DeclarationWithType * mutate( FunctionDecl *functionDecl ); 91 92 virtual Type * mutate( TupleType *tupleType ); 93 94 virtual CompoundStmt * mutate( CompoundStmt *compoundStmt ); 82 struct AutogenTupleRoutines : public WithDeclsToAdd, public WithVisitorRef<AutogenTupleRoutines>, public WithGuards, public WithShortCircuiting { 83 void previsit( FunctionDecl *functionDecl ); 84 85 void postvisit( TupleType *tupleType ); 86 87 void previsit( CompoundStmt *compoundStmt ); 95 88 96 89 private: … … 105 98 // needs to be done separately because AutogenerateRoutines skips types that appear as function arguments, etc. 106 99 // AutogenTupleRoutines tupleGenerator; 107 // tupleGenerator.mutateDeclarationList( translationUnit);100 // acceptAll( translationUnit, tupleGenerator ); 108 101 } 109 102 … … 707 700 } 708 701 709 Type * AutogenTupleRoutines::mutate( TupleType * tupleType ) { 710 tupleType = strict_dynamic_cast< TupleType * >( Parent::mutate( tupleType ) ); 702 void AutogenTupleRoutines::postvisit( TupleType * tupleType ) { 711 703 std::string mangleName = SymTab::Mangler::mangleType( tupleType ); 712 if ( seenTuples.find( mangleName ) != seenTuples.end() ) return tupleType;704 if ( seenTuples.find( mangleName ) != seenTuples.end() ) return; 713 705 seenTuples.insert( mangleName ); 714 706 … … 758 750 makeTupleFunctionBody( dtorDecl ); 759 751 760 addDeclaration( ctorDecl ); 761 addDeclaration( copyCtorDecl ); 762 addDeclaration( dtorDecl ); 763 addDeclaration( assignDecl ); // assignment should come last since it uses copy constructor in return 764 765 return tupleType; 766 } 767 768 DeclarationWithType * AutogenTupleRoutines::mutate( FunctionDecl *functionDecl ) { 769 functionDecl->set_functionType( maybeMutate( functionDecl->get_functionType(), *this ) ); 752 declsToAddBefore.push_back( ctorDecl ); 753 declsToAddBefore.push_back( copyCtorDecl ); 754 declsToAddBefore.push_back( dtorDecl ); 755 declsToAddBefore.push_back( assignDecl ); // assignment should come last since it uses copy constructor in return 756 757 return; 758 } 759 760 void AutogenTupleRoutines::previsit( FunctionDecl *functionDecl ) { 761 visit_children = false; 762 functionDecl->set_functionType( maybeMutate( functionDecl->type, *visitor ) ); 770 763 functionNesting += 1; 771 functionDecl->set_statements( maybeMutate( functionDecl-> get_statements(), *this) );764 functionDecl->set_statements( maybeMutate( functionDecl->statements, *visitor ) ); 772 765 functionNesting -= 1; 773 return functionDecl; 774 } 775 776 CompoundStmt * AutogenTupleRoutines::mutate( CompoundStmt *compoundStmt ) { 777 seenTuples.beginScope(); 778 compoundStmt = strict_dynamic_cast< CompoundStmt * >( Parent::mutate( compoundStmt ) ); 779 seenTuples.endScope(); 780 return compoundStmt; 766 } 767 768 void AutogenTupleRoutines::previsit( CompoundStmt * ) { 769 GuardScope( seenTuples ); 781 770 } 782 771 } // SymTab -
src/Tuples/TupleExpansion.cc
rb4bfa0a rac74057 21 21 #include "Common/ScopedMap.h" // for ScopedMap 22 22 #include "Common/utility.h" // for CodeLocation 23 #include "GenPoly/DeclMutator.h" // for DeclMutator24 23 #include "InitTweak/InitTweak.h" // for getFunction 25 24 #include "Parser/LinkageSpec.h" // for Spec, C, Intrinsic
Note: See TracChangeset
for help on using the changeset viewer.