Changeset c28ea4e for src/AST/Pass.hpp
- Timestamp:
- Nov 4, 2020, 2:56:30 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- eeb5023
- Parents:
- 4b30e8cc (diff), a3f5208a (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Pass.hpp
r4b30e8cc rc28ea4e 103 103 /// Construct and run a pass on a translation unit. 104 104 template< typename... Args > 105 static void run( std::list< ptr<Decl> >& decls, Args &&... args ) {105 static void run( TranslationUnit & decls, Args &&... args ) { 106 106 Pass<core_t> visitor( std::forward<Args>( args )... ); 107 107 accept_all( decls, visitor ); … … 119 119 // Versions of the above for older compilers. 120 120 template< typename... Args > 121 static void run( std::list< ptr<Decl> >& decls ) {121 static void run( TranslationUnit & decls ) { 122 122 Pass<core_t> visitor; 123 123 accept_all( decls, visitor ); … … 228 228 template<typename core_type> 229 229 friend void accept_all( std::list< ptr<Decl> > & decls, Pass<core_type>& visitor ); 230 231 bool isInFunction() const { 232 return inFunction; 233 } 234 230 235 private: 231 236 … … 235 240 const ast::Stmt * call_accept( const ast::Stmt * ); 236 241 const ast::Expr * call_accept( const ast::Expr * ); 242 243 // requests WithStmtsToAdd directly add to this statement, as if it is a compound. 244 245 const ast::Stmt * call_accept_as_compound(const ast::Stmt *); 237 246 238 247 template< typename node_t > … … 257 266 template<typename node_t, typename parent_t, typename child_t> 258 267 void maybe_accept(const node_t * &, child_t parent_t::* child); 268 269 template<typename node_t, typename parent_t, typename child_t> 270 void maybe_accept_as_compound(const node_t * &, child_t parent_t::* child); 259 271 260 272 private: … … 284 296 private: 285 297 bool inFunction = false; 298 bool atFunctionTop = false; 286 299 }; 287 300 … … 289 302 template<typename core_t> 290 303 void accept_all( std::list< ast::ptr<ast::Decl> > &, ast::Pass<core_t> & visitor ); 304 305 template<typename core_t> 306 void accept_all( ast::TranslationUnit &, ast::Pass<core_t> & visitor ); 291 307 292 308 //------------------------------------------------------------------------------------------------- … … 371 387 struct WithVisitorRef { 372 388 Pass<core_t> * const visitor = nullptr; 389 390 bool isInFunction() const { 391 return visitor->isInFunction(); 392 } 373 393 }; 374 394
Note:
See TracChangeset
for help on using the changeset viewer.