Changeset 3f681b1
- Timestamp:
- May 11, 2022, 11:33:21 AM (3 years ago)
- Branches:
- ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
- Children:
- 7675f58
- Parents:
- e6bb667
- Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified src/AST/Label.hpp ¶
re6bb667 r3f681b1 34 34 std::vector< ptr<Attribute> > attributes; 35 35 36 Label( CodeLocationloc, const std::string& name = "",36 Label( const CodeLocation& loc, const std::string& name = "", 37 37 std::vector<ptr<Attribute>> && attrs = std::vector<ptr<Attribute>>{} ) 38 38 : location( loc ), name( name ), attributes( attrs ) {} -
TabularUnified src/AST/Node.hpp ¶
re6bb667 r3f681b1 51 51 bool isManaged() const { return strong_count > 0; } 52 52 bool isReferenced() const { return weak_count > 0; } 53 bool isStable() const { 54 return (1 == strong_count || (1 < strong_count && 0 == weak_count)); 55 } 53 56 54 57 private: -
TabularUnified src/AST/Pass.proto.hpp ¶
re6bb667 r3f681b1 131 131 template< typename node_t > 132 132 struct result1 { 133 bool differs ;134 const node_t * value ;133 bool differs = false; 134 const node_t * value = nullptr; 135 135 136 136 template< typename object_t, typename super_t, typename field_t > … … 151 151 }; 152 152 153 bool differs ;153 bool differs = false; 154 154 container_t< delta > values; 155 155 … … 167 167 template< template<class...> class container_t, typename node_t > 168 168 struct resultN { 169 bool differs ;169 bool differs = false; 170 170 container_t<ptr<node_t>> values; 171 171 -
TabularUnified src/AST/Util.cpp ¶
re6bb667 r3f681b1 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // Util. hpp -- General utilities for working with the AST.7 // Util.cpp -- General utilities for working with the AST. 8 8 // 9 9 // Author : Andrew Beach 10 10 // Created On : Wed Jan 19 9:46:00 2022 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Mar 11 18:07:00 202213 // Update Count : 112 // Last Modified On : Wed May 4 15:50:00 2022 13 // Update Count : 2 14 14 // 15 15 … … 46 46 47 47 /// Check that every note that can has a set CodeLocation. 48 struct SetCodeLocationsCore { 49 void previsit( const ParseNode * node ) { 50 assert( node->location.isSet() ); 48 void isCodeLocationSet( const ParseNode * node ) { 49 assert( node->location.isSet() ); 50 } 51 52 /// Make sure the reference counts are in a valid combination. 53 void isStable( const Node * node ) { 54 assert( node->isStable() ); 55 } 56 57 /// Check that a FunctionDecl is synchronized with it's FunctionType. 58 void functionDeclMatchesType( const FunctionDecl * decl ) { 59 // The type is a cache of sorts, if it is missing that is only a 60 // problem if isTypeFixed is set. 61 if ( decl->isTypeFixed ) { 62 assert( decl->type ); 63 } else if ( !decl->type ) { 64 return; 51 65 } 52 }; 66 67 const FunctionType * type = decl->type; 68 69 // Check that `type->forall` corresponds with `decl->type_params`. 70 assert( type->forall.size() == decl->type_params.size() ); 71 // Check that `type->assertions` corresponds with `decl->assertions`. 72 assert( type->assertions.size() == decl->assertions.size() ); 73 // Check that `type->params` corresponds with `decl->params`. 74 assert( type->params.size() == decl->params.size() ); 75 // Check that `type->returns` corresponds with `decl->returns`. 76 assert( type->returns.size() == decl->returns.size() ); 77 } 53 78 54 79 struct InvariantCore { … … 56 81 // None of the passes should make changes so ordering doesn't matter. 57 82 NoStrongCyclesCore no_strong_cycles; 58 SetCodeLocationsCore set_code_locations;59 83 60 84 void previsit( const Node * node ) { 61 85 no_strong_cycles.previsit( node ); 86 isStable( node ); 62 87 } 63 88 64 89 void previsit( const ParseNode * node ) { 65 no_strong_cycles.previsit( node ); 66 set_code_locations.previsit( node ); 90 previsit( (const Node *)node ); 91 isCodeLocationSet( node ); 92 } 93 94 void previsit( const FunctionDecl * node ) { 95 previsit( (const ParseNode *)node ); 96 functionDeclMatchesType( node ); 67 97 } 68 98 -
TabularUnified src/ControlStruct/MultiLevelExit.cpp ¶
re6bb667 r3f681b1 18 18 #include "AST/Pass.hpp" 19 19 #include "AST/Stmt.hpp" 20 #include "Common/CodeLocationTools.hpp" 20 21 #include "LabelGeneratorNew.hpp" 21 22 … … 618 619 Pass<MultiLevelExitCore> visitor( labelTable ); 619 620 const CompoundStmt * ret = stmt->accept( visitor ); 620 return ret; 621 // There are some unset code locations slipping in, possibly by Labels. 622 const Node * node = localFillCodeLocations( ret->location, ret ); 623 return strict_dynamic_cast<const CompoundStmt *>( node ); 621 624 } 622 625 } // namespace ControlStruct
Note: See TracChangeset
for help on using the changeset viewer.