Changeset 33b7d49 for src/Common
- Timestamp:
- Mar 15, 2022, 10:14:05 AM (4 years ago)
- Branches:
- ADT, ast-experimental, enum, master, pthread-emulation, qualifiedEnum
- Children:
- 48a91e2
- Parents:
- d824715
- Location:
- src/Common
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/CodeLocationTools.cpp
rd824715 r33b7d49 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 … … 239 239 }; 240 240 241 class LocalFillCore : public ast::WithGuards { 242 CodeLocation const * parent; 243 public: 244 LocalFillCore( CodeLocation const & location ) : parent( &location ) { 245 assert( location.isSet() ); 246 } 247 248 template<typename node_t> 249 auto previsit( node_t const * node ) 250 -> typename std::enable_if<has_code_location<node_t>::value, node_t const *>::type { 251 if ( node->location.isSet() ) { 252 GuardValue( parent ) = &node->location; 253 return node; 254 } else { 255 node_t * mut = ast::mutate( node ); 256 mut->location = *parent; 257 return mut; 258 } 259 } 260 }; 261 241 262 } // namespace 242 263 … … 278 299 ast::Pass<FillCore>::run( unit ); 279 300 } 301 302 ast::Node const * localFillCodeLocations( 303 CodeLocation const & location , ast::Node const * node ) { 304 ast::Pass<LocalFillCore> visitor( location ); 305 return node->accept( visitor ); 306 } -
src/Common/CodeLocationTools.hpp
rd824715 r33b7d49 10 10 // Created On : Fri Dec 4 15:35:00 2020 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Dec 9 9:53:00 202013 // Update Count : 112 // Last Modified On : Mon Mar 14 15:14:00 2022 13 // Update Count : 2 14 14 // 15 15 16 16 #pragma once 17 17 18 class CodeLocation; 18 19 namespace ast { 20 class Node; 19 21 class TranslationUnit; 20 22 } … … 28 30 // Assign a nearby code-location to any unset code locations in the forest. 29 31 void forceFillCodeLocations( ast::TranslationUnit & unit ); 32 33 // Fill in code-locations with a parent code location, 34 // using the provided CodeLocation as the base. 35 ast::Node const * 36 localFillCodeLocations( CodeLocation const &, ast::Node const * );
Note:
See TracChangeset
for help on using the changeset viewer.