- Timestamp:
- May 23, 2019, 10:39:17 AM (6 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:
- a2e758e
- Parents:
- f23de79d
- Location:
- src/AST
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/GenericSubstitution.cpp
rf23de79d r0b8bf27 23 23 #include "Pass.hpp" 24 24 #include "Type.hpp" 25 #include "TypeSubstitution. cpp"25 #include "TypeSubstitution.hpp" 26 26 27 27 namespace ast { … … 32 32 33 33 void previsit( const Type * ty ) { 34 assertf( false, "Attempted generic substitution for non-aggregate type: %s", 34 assertf( false, "Attempted generic substitution for non-aggregate type: %s", 35 35 toString( ty ).c_str() ); 36 36 } -
src/AST/Pass.proto.hpp
rf23de79d r0b8bf27 115 115 static constexpr bool value = std::is_void< ret_t >::value || 116 116 std::is_base_of<const node_t, typename std::remove_pointer<ret_t>::type >::value; 117 }; 118 119 template<bool is_void> 120 struct __assign; 121 122 template<> 123 struct __assign<true> { 124 template<typename pass_t, typename node_t> 125 static inline void result( pass_t & pass, const node_t * & node ) { 126 pass.previsit( node ); 127 } 128 }; 129 130 template<> 131 struct __assign<false> { 132 template<typename pass_t, typename node_t> 133 static inline void result( pass_t & pass, const node_t * & node ) { 134 node = pass.previsit( node ); 135 assertf(node, "Previsit must not return NULL"); 136 } 117 137 }; 118 138 … … 138 158 "Previsit may not change the type of the node. It must return its paremeter or void." 139 159 ); 140 if(std::is_void< decltype( pass.previsit(node) ) >::value) { 141 pass.previsit( node );142 } else {143 node = pass.previsit( node );144 assert(node);145 }160 161 __assign< 162 std::is_void< 163 decltype( pass.previsit( node ) ) 164 >::value 165 >::result( pass, node ); 146 166 } 147 167 -
src/AST/module.mk
rf23de79d r0b8bf27 21 21 AST/DeclReplacer.cpp \ 22 22 AST/Expr.cpp \ 23 AST/GenericSubstitution.cpp \ 23 24 AST/Init.cpp \ 24 25 AST/LinkageSpec.cpp \
Note: See TracChangeset
for help on using the changeset viewer.