Changeset 5d88a0a
- Timestamp:
- May 31, 2017, 4:33:21 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:
- 7b15d7a
- Parents:
- 13932f14
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/PassVisitor.h
r13932f14 r5d88a0a 6 6 //Deep magic (a.k.a template meta programming) to make the templated visitor work 7 7 //Basically the goal is to make 2 previsit_impl 8 // 1 - 8 // 1 - Use when a pass implements a valid previsit. This uses overloading which means the any overload of 9 // 'pass.previsit( node )' that compiles will be used for that node for that type 10 // This requires that this option only compile for passes that actually define an appropriate visit. 11 // SFINAE will make sure the compilation errors in this function don't halt the build. 12 // See http://en.cppreference.com/w/cpp/language/sfinae for details on SFINAE 13 // 2 - Since the first implementation might not be specilizable, the second implementation exists and does nothing. 14 // This is needed only to eliminate the need for passes to specify any kind of handlers. 15 // The second implementation only works because it has a lower priority. This is due to the bogus last parameter. 16 // The second implementation takes a long while the first takes an int. Since the caller always passes an literal 0 17 // the first implementation takes priority in regards to overloading. 9 18 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 10 19 template<typename pass_type, typename node_type> … … 30 39 31 40 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 32 //Templated visitor type 33 41 // Templated visitor type 42 // To use declare a PassVisitor< YOUR VISITOR TYPE > 43 // The visitor type should specify the previsit/postvisit for types that are desired. 34 44 //------------------------------------------------------------------------------------------------------------------------------------------------------------------------- 35 45 template< typename pass_type >
Note: See TracChangeset
for help on using the changeset viewer.