Changeset c600df1
- Timestamp:
- Oct 26, 2021, 1:32:59 PM (3 years ago)
- Branches:
- ADT, ast-experimental, enum, forall-pointer-decay, master, pthread-emulation, qualifiedEnum
- Children:
- 15885de9, 1ed9cb63
- Parents:
- 148ba7d
- Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Pass.hpp
r148ba7d rc600df1 396 396 }; 397 397 398 /// Used to get a pointer to the wrapping TranslationUnit. 399 struct WithConstTranslationUnit { 400 const TranslationUnit * translationUnit = nullptr; 401 402 const TranslationUnit & transUnit() const { 403 assertf( translationUnit, "WithConstTranslationUnit not set-up." ); 404 return *translationUnit; 405 } 406 }; 407 398 408 } 399 409 -
src/AST/Pass.impl.hpp
r148ba7d rc600df1 420 420 template< typename core_t > 421 421 inline void ast::accept_all( ast::TranslationUnit & unit, ast::Pass< core_t > & visitor ) { 422 return ast::accept_all( unit.decls, visitor ); 422 if ( auto ptr = __pass::translation_unit::get_cptr( visitor.core, 0 ) ) { 423 ValueGuard<const TranslationUnit *> guard( *ptr ); 424 *ptr = &unit; 425 return ast::accept_all( unit.decls, visitor ); 426 } else { 427 return ast::accept_all( unit.decls, visitor ); 428 } 423 429 } 424 430 -
src/AST/Pass.proto.hpp
r148ba7d rc600df1 426 426 } // namespace forall 427 427 428 // For passes that need access to the global context. Sreaches `translationUnit` 429 namespace translation_unit { 430 template<typename core_t> 431 static inline auto get_cptr( core_t & core, int ) 432 -> decltype( &core.translationUnit ) { 433 return &core.translationUnit; 434 } 435 436 template<typename core_t> 437 static inline const TranslationUnit ** get_cptr( core_t &, long ) { 438 return nullptr; 439 } 440 } 441 428 442 template<typename core_t> 429 443 static inline auto get_result( core_t & core, char ) -> decltype( core.result() ) { -
src/AST/TranslationUnit.hpp
r148ba7d rc600df1 26 26 std::list< ptr< Decl > > decls; 27 27 28 struct Global s{28 struct Global { 29 29 std::map< UniqueId, Decl * > idMap; 30 30 31 const Type *sizeType;31 ptr<Type> sizeType; 32 32 const FunctionDecl * dereference; 33 33 const StructDecl * dtorStruct; -
src/InitTweak/GenInit.cc
r148ba7d rc600df1 300 300 struct HoistArrayDimension_NoResolve_New final : 301 301 public ast::WithDeclsToAdd<>, public ast::WithShortCircuiting, 302 public ast::WithGuards, 302 public ast::WithGuards, public ast::WithConstTranslationUnit, 303 303 public ast::WithVisitorRef<HoistArrayDimension_NoResolve_New> { 304 304 void previsit( const ast::ObjectDecl * decl ); … … 342 342 } 343 343 344 ast::ptr<ast::Type> dimType = ast::sizeType;344 ast::ptr<ast::Type> dimType = transUnit().global.sizeType; 345 345 assert( dimType ); 346 346 add_qualifiers( dimType, ast::CV::Qualifiers( ast::CV::Const ) );
Note: See TracChangeset
for help on using the changeset viewer.