- File:
-
- 1 edited
-
src/Common/CodeLocationTools.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/CodeLocationTools.cpp
r3b0bc16 r4ec9513 9 9 // Author : Andrew Beach 10 10 // Created On : Fri Dec 4 15:42:00 2020 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Tue Feb 1 09:14:39202213 // Update Count : 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Mar 14 15:14:00 2022 13 // Update Count : 4 14 14 // 15 15 … … 112 112 macro(ForStmt, Stmt) \ 113 113 macro(SwitchStmt, Stmt) \ 114 macro(Case Stmt, Stmt) \114 macro(CaseClause, CaseClause) \ 115 115 macro(BranchStmt, Stmt) \ 116 116 macro(ReturnStmt, Stmt) \ 117 117 macro(ThrowStmt, Stmt) \ 118 118 macro(TryStmt, Stmt) \ 119 macro(Catch Stmt, Stmt) \120 macro(Finally Stmt, Stmt) \119 macro(CatchClause, CatchClause) \ 120 macro(FinallyClause, FinallyClause) \ 121 121 macro(SuspendStmt, Stmt) \ 122 122 macro(WaitForStmt, Stmt) \ … … 147 147 macro(CommaExpr, Expr) \ 148 148 macro(TypeExpr, Expr) \ 149 macro(DimensionExpr, Expr) \ 149 150 macro(AsmExpr, Expr) \ 150 151 macro(ImplicitCopyCtorExpr, Expr) \ … … 239 240 }; 240 241 242 class LocalFillCore : public ast::WithGuards { 243 CodeLocation const * parent; 244 public: 245 LocalFillCore( CodeLocation const & location ) : parent( &location ) { 246 assert( location.isSet() ); 247 } 248 249 template<typename node_t> 250 auto previsit( node_t const * node ) 251 -> typename std::enable_if<has_code_location<node_t>::value, node_t const *>::type { 252 if ( node->location.isSet() ) { 253 GuardValue( parent ) = &node->location; 254 return node; 255 } else { 256 node_t * mut = ast::mutate( node ); 257 mut->location = *parent; 258 return mut; 259 } 260 } 261 }; 262 241 263 } // namespace 242 264 … … 278 300 ast::Pass<FillCore>::run( unit ); 279 301 } 302 303 ast::Node const * localFillCodeLocations( 304 CodeLocation const & location , ast::Node const * node ) { 305 ast::Pass<LocalFillCore> visitor( location ); 306 return node->accept( visitor ); 307 }
Note:
See TracChangeset
for help on using the changeset viewer.