- Timestamp:
- Jul 14, 2023, 9:32:31 AM (19 months ago)
- Branches:
- master
- Children:
- 402a1e7
- Parents:
- 4acf56d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Util.cpp
r4acf56d rb7c53a9d 102 102 } 103 103 104 /// Check for Floating Nodes: 105 /// Every node should be reachable from a root (the TranslationUnit) via a 106 /// chain of structural references (tracked with ptr). This cannot check all 107 /// of that, it just checks if a given node's field has a strong reference. 108 template<typename node_t, typename field_t> 109 void noFloatingNode( const node_t * node, field_t node_t::*field_ptr ) { 110 const field_t & field = node->*field_ptr; 111 if ( nullptr == field ) return; 112 assertf( field->isManaged(), "Floating node found." ); 113 } 114 104 115 struct InvariantCore { 105 116 // To save on the number of visits: this is a kind of composed core. … … 127 138 } 128 139 140 void previsit( const VariableExpr * node ) { 141 previsit( (const ParseNode *)node ); 142 noFloatingNode( node, &VariableExpr::var ); 143 } 144 129 145 void previsit( const MemberExpr * node ) { 130 146 previsit( (const ParseNode *)node ); 131 147 memberMatchesAggregate( node ); 148 } 149 150 void previsit( const StructInstType * node ) { 151 previsit( (const Node *)node ); 152 noFloatingNode( node, &StructInstType::base ); 153 } 154 155 void previsit( const UnionInstType * node ) { 156 previsit( (const Node *)node ); 157 noFloatingNode( node, &UnionInstType::base ); 158 } 159 160 void previsit( const EnumInstType * node ) { 161 previsit( (const Node *)node ); 162 noFloatingNode( node, &EnumInstType::base ); 163 } 164 165 void previsit( const TypeInstType * node ) { 166 previsit( (const Node *)node ); 167 noFloatingNode( node, &TypeInstType::base ); 132 168 } 133 169
Note: See TracChangeset
for help on using the changeset viewer.