Changeset 0b8bf27
- 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
- Files:
-
- 4 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 \ -
src/Makefile.in
rf23de79d r0b8bf27 167 167 am__objects_1 = AST/Attribute.$(OBJEXT) AST/Convert.$(OBJEXT) \ 168 168 AST/Decl.$(OBJEXT) AST/DeclReplacer.$(OBJEXT) \ 169 AST/Expr.$(OBJEXT) AST/Init.$(OBJEXT) \ 170 AST/LinkageSpec.$(OBJEXT) AST/Node.$(OBJEXT) \ 171 AST/Pass.$(OBJEXT) AST/Print.$(OBJEXT) AST/Stmt.$(OBJEXT) \ 172 AST/Type.$(OBJEXT) AST/TypeSubstitution.$(OBJEXT) 169 AST/Expr.$(OBJEXT) AST/GenericSubstitution.$(OBJEXT) \ 170 AST/Init.$(OBJEXT) AST/LinkageSpec.$(OBJEXT) \ 171 AST/Node.$(OBJEXT) AST/Pass.$(OBJEXT) AST/Print.$(OBJEXT) \ 172 AST/Stmt.$(OBJEXT) AST/Type.$(OBJEXT) \ 173 AST/TypeSubstitution.$(OBJEXT) 173 174 am__objects_2 = CodeGen/CodeGenerator.$(OBJEXT) \ 174 175 CodeGen/FixMain.$(OBJEXT) CodeGen/GenType.$(OBJEXT) \ … … 574 575 AST/DeclReplacer.cpp \ 575 576 AST/Expr.cpp \ 577 AST/GenericSubstitution.cpp \ 576 578 AST/Init.cpp \ 577 579 AST/LinkageSpec.cpp \ … … 739 741 AST/$(DEPDIR)/$(am__dirstamp) 740 742 AST/Expr.$(OBJEXT): AST/$(am__dirstamp) AST/$(DEPDIR)/$(am__dirstamp) 743 AST/GenericSubstitution.$(OBJEXT): AST/$(am__dirstamp) \ 744 AST/$(DEPDIR)/$(am__dirstamp) 741 745 AST/Init.$(OBJEXT): AST/$(am__dirstamp) AST/$(DEPDIR)/$(am__dirstamp) 742 746 AST/LinkageSpec.$(OBJEXT): AST/$(am__dirstamp) \ … … 1173 1177 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/DeclReplacer.Po@am__quote@ 1174 1178 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Expr.Po@am__quote@ 1179 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/GenericSubstitution.Po@am__quote@ 1175 1180 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/Init.Po@am__quote@ 1176 1181 @AMDEP_TRUE@@am__include@ @am__quote@AST/$(DEPDIR)/LinkageSpec.Po@am__quote@
Note: See TracChangeset
for help on using the changeset viewer.