Changeset 7dc09294 for src/Common
- Timestamp:
- Sep 13, 2017, 7:27:12 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:
- 982832e
- Parents:
- ada0eb06 (diff), 4639b0d (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/Common
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/PassVisitor.h
rada0eb06 r7dc09294 145 145 virtual Declaration* mutate( EnumDecl *aggregateDecl ) override final; 146 146 virtual Declaration* mutate( TraitDecl *aggregateDecl ) override final; 147 virtual TypeDecl* mutate( TypeDecl *typeDecl ) override final;147 virtual Declaration* mutate( TypeDecl *typeDecl ) override final; 148 148 virtual Declaration* mutate( TypedefDecl *typeDecl ) override final; 149 149 virtual AsmDecl* mutate( AsmDecl *asmDecl ) override final; -
src/Common/PassVisitor.impl.h
rada0eb06 r7dc09294 976 976 977 977 template< typename pass_type > 978 TypeDecl* PassVisitor< pass_type >::mutate( TypeDecl * node ) {979 MUTATE_BODY( TypeDecl, node );978 Declaration * PassVisitor< pass_type >::mutate( TypeDecl * node ) { 979 MUTATE_BODY( Declaration, node ); 980 980 } 981 981 -
src/Common/utility.h
rada0eb06 r7dc09294 370 370 } 371 371 372 // ----------------------------------------------------------------------------- 373 // Helper struct and function to support 374 // for ( val : lazy_map( container1, f ) ) {} 375 // syntax to have a for each that iterates a container, mapping each element by applying f 376 template< typename T, typename Func > 377 struct lambda_iterate_t { 378 const T & ref; 379 std::function<Func> f; 380 381 struct iterator { 382 typedef decltype(begin(ref)) Iter; 383 Iter it; 384 std::function<Func> f; 385 iterator( Iter it, std::function<Func> f ) : it(it), f(f) {} 386 iterator & operator++() { 387 ++it; return *this; 388 } 389 bool operator!=( const iterator &other ) const { return it != other.it; } 390 auto operator*() const -> decltype(f(*it)) { return f(*it); } 391 }; 392 393 lambda_iterate_t( const T & ref, std::function<Func> f ) : ref(ref), f(f) {} 394 395 auto begin() const -> decltype(iterator(std::begin(ref), f)) { return iterator(std::begin(ref), f); } 396 auto end() const -> decltype(iterator(std::end(ref), f)) { return iterator(std::end(ref), f); } 397 }; 398 399 template< typename... Args > 400 lambda_iterate_t<Args...> lazy_map( const Args &... args ) { 401 return lambda_iterate_t<Args...>( args...); 402 } 403 404 405 372 406 // Local Variables: // 373 407 // tab-width: 4 //
Note:
See TracChangeset
for help on using the changeset viewer.