- Timestamp:
- Oct 27, 2020, 4:14:48 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 1be1e5a, b35ab2d
- Parents:
- 5d2db68
- Location:
- src
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/AST/Pass.hpp ¶
r5d2db68 r53d55b6 65 65 // corresponding postvisit/postmutate teminates. 66 66 // | WithVisitorRef - provides an pointer to the templated visitor wrapper 67 // | WithIsInFuncion - provides a way to access the inFunction68 67 // | WithSymbolTable - provides symbol table functionality 69 68 // | WithForallSubstitutor - maintains links between TypeInstType and TypeDecl under mutation … … 89 88 if(visitor) { 90 89 *const_cast<type **>( visitor ) = this; 91 }92 93 // After the pass is constructed, check if it wants to track the inFunction field94 const bool * const * infunc_ptr = __pass::infunc_ptr(core, 0);95 if(infunc_ptr) {96 *const_cast<const bool **>( infunc_ptr ) = &this->inFunction;97 90 } 98 91 } … … 235 228 template<typename core_type> 236 229 friend void accept_all( std::list< ptr<Decl> > & decls, Pass<core_type>& visitor ); 230 231 bool isInFunction() const { 232 return inFunction; 233 } 234 237 235 private: 238 236 … … 385 383 struct WithVisitorRef { 386 384 Pass<core_t> * const visitor = nullptr; 387 }; 388 389 /// Used to track whether or not we are in a function. 390 class WithIsInFuncion { 391 const bool * const infunc_ptr = nullptr; 392 393 template<typename core_t> 394 friend class Pass; 395 public: 396 bool isInFunction() { 397 assert( infunc_ptr ); 398 return *infunc_ptr; 385 386 bool isInFunction() const { 387 return visitor->isInFunction(); 399 388 } 400 389 }; -
TabularUnified src/AST/Pass.proto.hpp ¶
r5d2db68 r53d55b6 244 244 FIELD_PTR( at_cleanup, __pass::at_cleanup_t ) 245 245 FIELD_PTR( visitor, ast::Pass<core_t> * const ) 246 FIELD_PTR( infunc_ptr, const bool * const )247 246 248 247 // Remove the macro to make sure we don't clash -
TabularUnified src/Common/PassVisitor.h ¶
r5d2db68 r53d55b6 354 354 virtual TypeSubstitution * mutate( TypeSubstitution * sub ) final; 355 355 356 bool isInFunction() const { 357 return inFunction; 358 } 359 356 360 private: 357 361 bool inFunction = false; … … 526 530 public: 527 531 PassVisitor<pass_type> * const visitor = nullptr; 532 533 bool isInFunction() const { 534 return visitor->inFunction; 535 } 528 536 }; 529 537
Note: See TracChangeset
for help on using the changeset viewer.