- Timestamp:
- May 23, 2019, 4:22:58 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- a16e246, f1ec88a
- Parents:
- 20a5977 (diff), effe5b0 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/AST
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.cpp
r20a5977 raf1e8f56 72 72 // --- EnumDecl 73 73 74 bool EnumDecl::valueOf( Decl* enumerator, long long& value ) const {74 bool EnumDecl::valueOf( const Decl * enumerator, long long& value ) const { 75 75 if ( enumValues.empty() ) { 76 76 long long crntVal = 0; 77 for ( const Decl * member : members ) {77 for ( const Decl * member : members ) { 78 78 const ObjectDecl* field = strict_dynamic_cast< const ObjectDecl* >( member ); 79 79 if ( field->init ) { -
src/AST/Decl.hpp
r20a5977 raf1e8f56 287 287 288 288 /// gets the integer value for this enumerator, returning true iff value found 289 bool valueOf( Decl* enumerator, long long& value ) const;289 bool valueOf( const Decl * enumerator, long long& value ) const; 290 290 291 291 const Decl * accept( Visitor & v ) const override { return v.visit( this ); } -
src/AST/Pass.proto.hpp
r20a5977 raf1e8f56 109 109 }; 110 110 111 /// "Short hand" to check if this is a valid previsit function 112 /// Mostly used to make the static_assert look (and print) prettier 111 113 template<typename pass_t, typename node_t> 112 114 struct is_valid_previsit { … … 117 119 }; 118 120 121 /// Used by previsit implementation 122 /// We need to reassign the result to 'node', unless the function 123 /// returns void, then we just leave 'node' unchanged 119 124 template<bool is_void> 120 125 struct __assign; … … 134 139 node = pass.previsit( node ); 135 140 assertf(node, "Previsit must not return NULL"); 141 } 142 }; 143 144 /// Used by postvisit implementation 145 /// We need to return the result unless the function 146 /// returns void, then we just return the original node 147 template<bool is_void> 148 struct __return; 149 150 template<> 151 struct __return<true> { 152 template<typename pass_t, typename node_t> 153 static inline const node_t * result( pass_t & pass, const node_t * & node ) { 154 pass.postvisit( node ); 155 return node; 156 } 157 }; 158 159 template<> 160 struct __return<false> { 161 template<typename pass_t, typename node_t> 162 static inline auto result( pass_t & pass, const node_t * & node ) { 163 return pass.postvisit( node ); 136 164 } 137 165 }; … … 174 202 decltype( pass.postvisit( node ), node->accept( *(Visitor*)nullptr ) ) 175 203 { 176 return pass.postvisit( node ); 204 return __return< 205 std::is_void< 206 decltype( pass.postvisit( node ) ) 207 >::value 208 >::result( pass, node ); 177 209 } 178 210
Note: See TracChangeset
for help on using the changeset viewer.