- File:
-
- 1 edited
-
src/Common/CodeLocationTools.cpp (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Common/CodeLocationTools.cpp
r4ec9513 r3b0bc16 9 9 // Author : Andrew Beach 10 10 // Created On : Fri Dec 4 15:42:00 2020 11 // Last Modified By : Andrew Beach12 // Last Modified On : Mon Mar 14 15:14:00202213 // Update Count : 411 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Feb 1 09:14:39 2022 13 // Update Count : 3 14 14 // 15 15 … … 112 112 macro(ForStmt, Stmt) \ 113 113 macro(SwitchStmt, Stmt) \ 114 macro(Case Clause, CaseClause) \114 macro(CaseStmt, Stmt) \ 115 115 macro(BranchStmt, Stmt) \ 116 116 macro(ReturnStmt, Stmt) \ 117 117 macro(ThrowStmt, Stmt) \ 118 118 macro(TryStmt, Stmt) \ 119 macro(Catch Clause, CatchClause) \120 macro(Finally Clause, FinallyClause) \119 macro(CatchStmt, Stmt) \ 120 macro(FinallyStmt, Stmt) \ 121 121 macro(SuspendStmt, Stmt) \ 122 122 macro(WaitForStmt, Stmt) \ … … 147 147 macro(CommaExpr, Expr) \ 148 148 macro(TypeExpr, Expr) \ 149 macro(DimensionExpr, Expr) \150 149 macro(AsmExpr, Expr) \ 151 150 macro(ImplicitCopyCtorExpr, Expr) \ … … 240 239 }; 241 240 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 263 241 } // namespace 264 242 … … 300 278 ast::Pass<FillCore>::run( unit ); 301 279 } 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.