Changeset fd236ed for src/InitTweak/InitTweak.cc
- Timestamp:
- Nov 30, 2017, 5:11:36 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:
- 1cb934d
- Parents:
- c50d54d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/InitTweak.cc
rc50d54d rfd236ed 5 5 #include <memory> // for __shared_ptr 6 6 7 #include "Common/PassVisitor.h" 7 8 #include "Common/SemanticError.h" // for SemanticError 8 9 #include "Common/UniqueName.h" // for UniqueName … … 29 30 namespace InitTweak { 30 31 namespace { 31 class HasDesignations : public Visitor{32 class HasDesignations : public WithShortCircuiting { 32 33 public: 33 34 bool hasDesignations = false; 34 virtual void visit( Designation * des ) { 35 if ( ! des->get_designators().empty() ) hasDesignations = true; 36 else Visitor::visit( des ); 35 36 void previsit( BaseSyntaxNode * ) { 37 // short circuit if we already know there are designations 38 if ( hasDesignations ) visit_children = false; 39 } 40 41 void previsit( Designation * des ) { 42 // short circuit if we already know there are designations 43 if ( hasDesignations ) visit_children = false; 44 else if ( ! des->get_designators().empty() ) { 45 hasDesignations = true; 46 visit_children = false; 47 } 37 48 } 38 49 }; … … 86 97 87 98 bool isDesignated( Initializer * init ) { 88 HasDesignationsfinder;99 PassVisitor<HasDesignations> finder; 89 100 maybeAccept( init, finder ); 90 return finder. hasDesignations;101 return finder.pass.hasDesignations; 91 102 } 92 103
Note: See TracChangeset
for help on using the changeset viewer.