Changes in / [a6fe3de:bd34fc87]
- Location:
- src
- Files:
-
- 27 edited
-
CodeGen/GenType.cc (modified) (2 diffs)
-
Makefile.in (modified) (6 diffs)
-
ResolvExpr/AdjustExprType.cc (modified) (2 diffs)
-
ResolvExpr/CommonType.cc (modified) (5 diffs)
-
ResolvExpr/ConversionCost.cc (modified) (3 diffs)
-
ResolvExpr/ConversionCost.h (modified) (1 diff)
-
ResolvExpr/PtrsAssignable.cc (modified) (2 diffs)
-
ResolvExpr/PtrsCastable.cc (modified) (2 diffs)
-
ResolvExpr/RenameVars.cc (modified) (1 diff)
-
ResolvExpr/RenameVars.h (modified) (1 diff)
-
ResolvExpr/Resolver.cc (modified) (2 diffs)
-
ResolvExpr/Unify.cc (modified) (2 diffs)
-
SymTab/FixFunction.cc (modified) (1 diff)
-
SymTab/FixFunction.h (modified) (1 diff)
-
SymTab/ImplementationType.cc (modified) (2 diffs)
-
SymTab/Mangler.cc (modified) (1 diff)
-
SymTab/Mangler.h (modified) (1 diff)
-
SymTab/TypeEquality.cc (modified) (2 diffs)
-
SynTree/Mutator.cc (modified) (1 diff)
-
SynTree/Mutator.h (modified) (1 diff)
-
SynTree/SynTree.h (modified) (1 diff)
-
SynTree/Type.h (modified) (1 diff)
-
SynTree/TypeSubstitution.cc (modified) (2 diffs)
-
SynTree/TypeSubstitution.h (modified) (1 diff)
-
SynTree/Visitor.cc (modified) (1 diff)
-
SynTree/Visitor.h (modified) (1 diff)
-
SynTree/module.mk (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/GenType.cc
ra6fe3de rbd34fc87 42 42 virtual void visit( TypeInstType *typeInst ); 43 43 virtual void visit( VarArgsType *varArgsType ); 44 virtual void visit( ZeroType *zeroType );45 virtual void visit( OneType *oneType );46 44 47 45 private: … … 202 200 } 203 201 204 void GenType::visit( ZeroType *zeroType ) {205 // ideally these wouldn't hit codegen at all, but should be safe to make them ints206 typeString = "int " + typeString;207 handleQualifiers( zeroType );208 }209 210 void GenType::visit( OneType *oneType ) {211 // ideally these wouldn't hit codegen at all, but should be safe to make them ints212 typeString = "int " + typeString;213 handleQualifiers( oneType );214 }215 216 202 void GenType::handleQualifiers( Type *type ) { 217 203 if ( type->get_isConst() ) { -
src/Makefile.in
ra6fe3de rbd34fc87 165 165 SynTree/driver_cfa_cpp-AttrType.$(OBJEXT) \ 166 166 SynTree/driver_cfa_cpp-VarArgsType.$(OBJEXT) \ 167 SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT) \168 167 SynTree/driver_cfa_cpp-Constant.$(OBJEXT) \ 169 168 SynTree/driver_cfa_cpp-Expression.$(OBJEXT) \ … … 391 390 SynTree/ReferenceToType.cc SynTree/TupleType.cc \ 392 391 SynTree/TypeofType.cc SynTree/AttrType.cc \ 393 SynTree/VarArgsType.cc SynTree/ ZeroOneType.cc \394 SynTree/ Constant.cc SynTree/Expression.cc SynTree/TupleExpr.cc \392 SynTree/VarArgsType.cc SynTree/Constant.cc \ 393 SynTree/Expression.cc SynTree/TupleExpr.cc \ 395 394 SynTree/CommaExpr.cc SynTree/TypeExpr.cc \ 396 395 SynTree/ApplicationExpr.cc SynTree/AddressExpr.cc \ … … 716 715 SynTree/driver_cfa_cpp-VarArgsType.$(OBJEXT): SynTree/$(am__dirstamp) \ 717 716 SynTree/$(DEPDIR)/$(am__dirstamp) 718 SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT): SynTree/$(am__dirstamp) \719 SynTree/$(DEPDIR)/$(am__dirstamp)720 717 SynTree/driver_cfa_cpp-Constant.$(OBJEXT): SynTree/$(am__dirstamp) \ 721 718 SynTree/$(DEPDIR)/$(am__dirstamp) … … 880 877 -rm -f SynTree/driver_cfa_cpp-Visitor.$(OBJEXT) 881 878 -rm -f SynTree/driver_cfa_cpp-VoidType.$(OBJEXT) 882 -rm -f SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT)883 879 -rm -f Tuples/driver_cfa_cpp-NameMatcher.$(OBJEXT) 884 880 -rm -f Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT) … … 986 982 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Po@am__quote@ 987 983 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-VoidType.Po@am__quote@ 988 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po@am__quote@989 984 @AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Po@am__quote@ 990 985 @AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-TupleAssignment.Po@am__quote@ … … 2069 2064 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2070 2065 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-VarArgsType.obj `if test -f 'SynTree/VarArgsType.cc'; then $(CYGPATH_W) 'SynTree/VarArgsType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/VarArgsType.cc'; fi` 2071 2072 SynTree/driver_cfa_cpp-ZeroOneType.o: SynTree/ZeroOneType.cc2073 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ZeroOneType.o -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo -c -o SynTree/driver_cfa_cpp-ZeroOneType.o `test -f 'SynTree/ZeroOneType.cc' || echo '$(srcdir)/'`SynTree/ZeroOneType.cc2074 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po2075 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='SynTree/ZeroOneType.cc' object='SynTree/driver_cfa_cpp-ZeroOneType.o' libtool=no @AMDEPBACKSLASH@2076 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@2077 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ZeroOneType.o `test -f 'SynTree/ZeroOneType.cc' || echo '$(srcdir)/'`SynTree/ZeroOneType.cc2078 2079 SynTree/driver_cfa_cpp-ZeroOneType.obj: SynTree/ZeroOneType.cc2080 @am__fastdepCXX_TRUE@ $(AM_V_CXX)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -MT SynTree/driver_cfa_cpp-ZeroOneType.obj -MD -MP -MF SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo -c -o SynTree/driver_cfa_cpp-ZeroOneType.obj `if test -f 'SynTree/ZeroOneType.cc'; then $(CYGPATH_W) 'SynTree/ZeroOneType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ZeroOneType.cc'; fi`2081 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po2082 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ $(AM_V_CXX)source='SynTree/ZeroOneType.cc' object='SynTree/driver_cfa_cpp-ZeroOneType.obj' libtool=no @AMDEPBACKSLASH@2083 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@2084 @am__fastdepCXX_FALSE@ $(AM_V_CXX@am__nodep@)$(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(driver_cfa_cpp_CXXFLAGS) $(CXXFLAGS) -c -o SynTree/driver_cfa_cpp-ZeroOneType.obj `if test -f 'SynTree/ZeroOneType.cc'; then $(CYGPATH_W) 'SynTree/ZeroOneType.cc'; else $(CYGPATH_W) '$(srcdir)/SynTree/ZeroOneType.cc'; fi`2085 2066 2086 2067 SynTree/driver_cfa_cpp-Constant.o: SynTree/Constant.cc -
src/ResolvExpr/AdjustExprType.cc
ra6fe3de rbd34fc87 37 37 virtual Type* mutate( TupleType *tupleType ); 38 38 virtual Type* mutate( VarArgsType *varArgsType ); 39 virtual Type* mutate( ZeroType *zeroType );40 virtual Type* mutate( OneType *oneType );41 39 42 40 const TypeEnvironment &env; … … 119 117 return varArgsType; 120 118 } 121 122 Type *AdjustExprType::mutate( ZeroType *zeroType ) {123 return zeroType;124 }125 126 Type *AdjustExprType::mutate( OneType *oneType ) {127 return oneType;128 }129 119 } // namespace ResolvExpr 130 120 -
src/ResolvExpr/CommonType.cc
ra6fe3de rbd34fc87 39 39 virtual void visit( TupleType *tupleType ); 40 40 virtual void visit( VarArgsType *varArgsType ); 41 virtual void visit( ZeroType *zeroType );42 virtual void visit( OneType *oneType );43 41 44 42 template< typename RefType > void handleRefType( RefType *inst, Type *other ); … … 136 134 result = new BasicType( basicType->get_qualifiers() + otherBasic->get_qualifiers(), newType ); 137 135 } // if 138 } else if ( dynamic_cast< EnumInstType * > ( type2 ) || dynamic_cast< ZeroType* >( type2 ) || dynamic_cast< OneType* >( type2 ) ) {139 // use signed int in lieu of the enum /zero/onetype136 } else if ( EnumInstType *enumInstType = dynamic_cast< EnumInstType * > ( type2 ) ) { 137 // use signed int in lieu of the enum type 140 138 BasicType::Kind newType = combinedType[ basicType->get_kind() ][ BasicType::SignedInt ]; 141 if ( ( ( newType == basicType->get_kind() && basicType->get_qualifiers() >= type2->get_qualifiers() ) || widenFirst ) && ( ( newType != basicType->get_kind() && basicType->get_qualifiers() <= type2->get_qualifiers() ) || widenSecond ) ) {142 result = new BasicType( basicType->get_qualifiers() + type2->get_qualifiers(), newType );139 if ( ( ( newType == basicType->get_kind() && basicType->get_qualifiers() >= enumInstType->get_qualifiers() ) || widenFirst ) && ( ( newType != basicType->get_kind() && basicType->get_qualifiers() <= enumInstType->get_qualifiers() ) || widenSecond ) ) { 140 result = new BasicType( basicType->get_qualifiers() + enumInstType->get_qualifiers(), newType ); 143 141 } // if 144 142 } // if … … 173 171 otherPointer->get_base()->get_qualifiers() = tq2; 174 172 } // if 175 } else if ( widenSecond && dynamic_cast< ZeroType* >( type2 ) ) {176 result = pointerType->clone();177 result->get_qualifiers() += type2->get_qualifiers();178 173 } // if 179 174 } … … 195 190 196 191 void CommonType::visit( EnumInstType *enumInstType ) { 197 if ( dynamic_cast< BasicType * >( type2 ) || dynamic_cast< ZeroType* >( type2 ) || dynamic_cast< OneType* >( type2 )) {192 if ( dynamic_cast< BasicType * >( type2 ) ) { 198 193 // reuse BasicType, EnumInstType code by swapping type2 with enumInstType 199 194 Type * temp = type2; … … 235 230 void CommonType::visit( VarArgsType *varArgsType ) { 236 231 } 237 238 void CommonType::visit( ZeroType *zeroType ) {239 if ( widenFirst ) {240 if ( dynamic_cast< BasicType* >( type2 ) || dynamic_cast< PointerType* >( type2 ) || dynamic_cast< EnumInstType* >( type2 ) ) {241 if ( widenSecond || zeroType->get_qualifiers() <= type2->get_qualifiers() ) {242 result = type2->clone();243 result->get_qualifiers() += zeroType->get_qualifiers();244 }245 }246 }247 }248 249 void CommonType::visit( OneType *oneType ) {250 if ( widenFirst ) {251 if ( dynamic_cast< BasicType* >( type2 ) || dynamic_cast< EnumInstType* >( type2 ) ) {252 if ( widenSecond || oneType->get_qualifiers() <= type2->get_qualifiers() ) {253 result = type2->clone();254 result->get_qualifiers() += oneType->get_qualifiers();255 }256 }257 }258 }259 232 } // namespace ResolvExpr 260 233 -
src/ResolvExpr/ConversionCost.cc
ra6fe3de rbd34fc87 160 160 // xxx - not positive this is correct, but appears to allow casting int => enum 161 161 cost = Cost( 1, 0, 0 ); 162 } else if ( dynamic_cast< ZeroType* >( dest ) != nullptr || dynamic_cast< OneType* >( dest ) != nullptr ) { 163 cost = Cost( 1, 0, 0 ); 164 } // if 162 } // if 165 163 } 166 164 … … 177 175 } // if 178 176 } // if 179 } else if ( dynamic_cast< ZeroType* >( dest ) != nullptr || dynamic_cast< OneType* >( dest ) != nullptr ) {180 cost = Cost( 1, 0, 0 );181 177 } // if 182 178 } … … 260 256 } 261 257 } 262 263 void ConversionCost::visit(ZeroType *zeroType) {264 if ( dynamic_cast< ZeroType* >( dest ) ) {265 cost = Cost::zero;266 } else if ( BasicType *destAsBasic = dynamic_cast< BasicType* >( dest ) ) {267 // copied from visit(BasicType*) for signed int, but +1 for safe conversions268 int tableResult = costMatrix[ BasicType::SignedInt ][ destAsBasic->get_kind() ];269 if ( tableResult == -1 ) {270 cost = Cost( 1, 0, 0 );271 } else {272 cost = Cost( 0, 0, tableResult + 1 );273 }274 } else if ( dynamic_cast< PointerType* >( dest ) ) {275 cost = Cost( 0, 0, 1 );276 }277 }278 279 void ConversionCost::visit(OneType *oneType) {280 if ( dynamic_cast< OneType* >( dest ) ) {281 cost = Cost::zero;282 } else if ( BasicType *destAsBasic = dynamic_cast< BasicType* >( dest ) ) {283 // copied from visit(BasicType*) for signed int, but +1 for safe conversions284 int tableResult = costMatrix[ BasicType::SignedInt ][ destAsBasic->get_kind() ];285 if ( tableResult == -1 ) {286 cost = Cost( 1, 0, 0 );287 } else {288 cost = Cost( 0, 0, tableResult + 1 );289 }290 }291 }292 258 } // namespace ResolvExpr 293 259 -
src/ResolvExpr/ConversionCost.h
ra6fe3de rbd34fc87 41 41 virtual void visit(TupleType *tupleType); 42 42 virtual void visit(VarArgsType *varArgsType); 43 virtual void visit(ZeroType *zeroType);44 virtual void visit(OneType *oneType);45 43 protected: 46 44 Type *dest; -
src/ResolvExpr/PtrsAssignable.cc
ra6fe3de rbd34fc87 39 39 virtual void visit( TupleType *tupleType ); 40 40 virtual void visit( VarArgsType *varArgsType ); 41 virtual void visit( ZeroType *zeroType );42 virtual void visit( OneType *oneType );43 41 private: 44 42 Type *dest; … … 143 141 void PtrsAssignable::visit( VarArgsType *varArgsType ) { 144 142 } 145 146 void PtrsAssignable::visit( ZeroType *zeroType ) {147 }148 149 void PtrsAssignable::visit( OneType *oneType ) {150 }151 152 143 } // namespace ResolvExpr 153 144 -
src/ResolvExpr/PtrsCastable.cc
ra6fe3de rbd34fc87 40 40 virtual void visit(TupleType *tupleType); 41 41 virtual void visit(VarArgsType *varArgsType); 42 virtual void visit(ZeroType *zeroType);43 virtual void visit(OneType *oneType);44 42 private: 45 43 Type *dest; … … 146 144 result = objectCast( dest, env, indexer ); 147 145 } 148 149 void PtrsCastable::visit(ZeroType *zeroType) {150 result = objectCast( dest, env, indexer );151 }152 153 void PtrsCastable::visit(OneType *oneType) {154 result = objectCast( dest, env, indexer );155 }156 146 } // namespace ResolvExpr 157 147 -
src/ResolvExpr/RenameVars.cc
ra6fe3de rbd34fc87 110 110 } 111 111 112 void RenameVars::visit( ZeroType *zeroType ) {113 typeBefore( zeroType );114 typeAfter( zeroType );115 }116 117 void RenameVars::visit( OneType *oneType ) {118 typeBefore( oneType );119 typeAfter( oneType );120 }121 122 112 void RenameVars::typeBefore( Type *type ) { 123 113 if ( ! type->get_forall().empty() ) { -
src/ResolvExpr/RenameVars.h
ra6fe3de rbd34fc87 44 44 virtual void visit( TupleType *tupleType ); 45 45 virtual void visit( VarArgsType *varArgsType ); 46 virtual void visit( ZeroType *zeroType );47 virtual void visit( OneType *oneType );48 46 49 47 void typeBefore( Type *type ); -
src/ResolvExpr/Resolver.cc
ra6fe3de rbd34fc87 133 133 } else if ( BasicType *bt = dynamic_cast< BasicType * >( type ) ) { 134 134 return bt->isInteger(); 135 } else if ( dynamic_cast< ZeroType* >( type ) != nullptr || dynamic_cast< OneType* >( type ) != nullptr ) {136 return true;137 135 } else { 138 136 return false; … … 461 459 } 462 460 } else { 463 assert( dynamic_cast< BasicType * >( initContext ) || dynamic_cast< PointerType * >( initContext ) 464 || dynamic_cast< ZeroType * >( initContext ) || dynamic_cast< OneType * >( initContext ) ); 461 assert( dynamic_cast< BasicType * >( initContext ) || dynamic_cast< PointerType * >( initContext ) ); 465 462 // basic types are handled here 466 463 Visitor::visit( listInit ); -
src/ResolvExpr/Unify.cc
ra6fe3de rbd34fc87 60 60 virtual void visit(TupleType *tupleType); 61 61 virtual void visit(VarArgsType *varArgsType); 62 virtual void visit(ZeroType *zeroType);63 virtual void visit(OneType *oneType);64 62 65 63 template< typename RefType > void handleRefType( RefType *inst, Type *other ); … … 590 588 } 591 589 592 void Unify::visit(ZeroType *zeroType) {593 result = dynamic_cast< ZeroType* >( type2 );594 }595 596 void Unify::visit(OneType *oneType) {597 result = dynamic_cast< OneType* >( type2 );598 }599 600 590 } // namespace ResolvExpr 601 591 -
src/SymTab/FixFunction.cc
ra6fe3de rbd34fc87 77 77 return varArgsType; 78 78 } 79 80 Type * FixFunction::mutate(ZeroType *zeroType) {81 return zeroType;82 }83 84 Type * FixFunction::mutate(OneType *oneType) {85 return oneType;86 }87 79 } // namespace SymTab 88 80 -
src/SymTab/FixFunction.h
ra6fe3de rbd34fc87 42 42 virtual Type* mutate(TupleType *tupleType); 43 43 virtual Type* mutate(VarArgsType *varArgsType); 44 virtual Type* mutate(ZeroType *zeroType);45 virtual Type* mutate(OneType *oneType);46 44 47 45 bool isVoid; -
src/SymTab/ImplementationType.cc
ra6fe3de rbd34fc87 41 41 virtual void visit(TupleType *tupleType); 42 42 virtual void visit(VarArgsType *varArgsType); 43 virtual void visit(ZeroType *zeroType);44 virtual void visit(OneType *oneType);45 43 46 44 Type *result; // synthesized … … 122 120 void ImplementationType::visit(VarArgsType *varArgsType) { 123 121 } 124 125 void ImplementationType::visit(ZeroType *zeroType) {126 }127 128 void ImplementationType::visit(OneType *oneType) {129 }130 122 } // namespace SymTab 131 123 -
src/SymTab/Mangler.cc
ra6fe3de rbd34fc87 229 229 printQualifiers( varArgsType ); 230 230 mangleName << "VARGS"; 231 }232 233 void Mangler::visit( ZeroType *zeroType ) {234 mangleName << "Z";235 }236 237 void Mangler::visit( OneType *oneType ) {238 mangleName << "O";239 231 } 240 232 -
src/SymTab/Mangler.h
ra6fe3de rbd34fc87 46 46 virtual void visit( TupleType *tupleType ); 47 47 virtual void visit( VarArgsType *varArgsType ); 48 virtual void visit( ZeroType *zeroType );49 virtual void visit( OneType *oneType );50 48 51 49 std::string get_mangleName() { return mangleName.str(); } -
src/SymTab/TypeEquality.cc
ra6fe3de rbd34fc87 42 42 virtual void visit( TypeInstType *typeInst ); 43 43 virtual void visit( VarArgsType *varArgsType ); 44 virtual void visit( ZeroType *zeroType );45 virtual void visit( OneType *oneType );46 44 47 45 void handleQualifiers( Type * t ); … … 201 199 } 202 200 } 203 204 void TypeEquality::visit( ZeroType *zeroType ) {205 handleQualifiers( zeroType );206 if ( ! dynamic_cast< ZeroType * >( other ) ) {207 result = false;208 }209 }210 211 void TypeEquality::visit( OneType *oneType ) {212 handleQualifiers( oneType );213 if ( ! dynamic_cast< OneType * >( other ) ) {214 result = false;215 }216 }217 201 } // namespace SymTab -
src/SynTree/Mutator.cc
ra6fe3de rbd34fc87 453 453 } 454 454 455 Type *Mutator::mutate( ZeroType *zeroType ) {456 mutateAll( zeroType->get_forall(), *this );457 return zeroType;458 }459 460 Type *Mutator::mutate( OneType *oneType ) {461 mutateAll( oneType->get_forall(), *this );462 return oneType;463 }464 465 455 Initializer *Mutator::mutate( SingleInit *singleInit ) { 466 456 singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) ); -
src/SynTree/Mutator.h
ra6fe3de rbd34fc87 95 95 virtual Type* mutate( AttrType *attrType ); 96 96 virtual Type* mutate( VarArgsType *varArgsType ); 97 virtual Type* mutate( ZeroType *zeroType );98 virtual Type* mutate( OneType *oneType );99 97 100 98 virtual Initializer* mutate( SingleInit *singleInit ); -
src/SynTree/SynTree.h
ra6fe3de rbd34fc87 102 102 class AttrType; 103 103 class VarArgsType; 104 class ZeroType;105 class OneType;106 104 107 105 class Initializer; -
src/SynTree/Type.h
ra6fe3de rbd34fc87 418 418 }; 419 419 420 /// Represents a zero constant421 class ZeroType : public Type {422 public:423 ZeroType();424 ZeroType( Type::Qualifiers tq );425 426 virtual ZeroType *clone() const { return new ZeroType( *this ); }427 virtual void accept( Visitor &v ) { v.visit( this ); }428 virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }429 virtual void print( std::ostream &os, int indent = 0 ) const;430 };431 432 /// Represents a one constant433 class OneType : public Type {434 public:435 OneType();436 OneType( Type::Qualifiers tq );437 438 virtual OneType *clone() const { return new OneType( *this ); }439 virtual void accept( Visitor &v ) { v.visit( this ); }440 virtual Type *acceptMutator( Mutator &m ) { return m.mutate( this ); }441 virtual void print( std::ostream &os, int indent = 0 ) const;442 };443 444 420 inline Type::Qualifiers &Type::Qualifiers::operator+=( const Type::Qualifiers &other ) { 445 421 isConst |= other.isConst; -
src/SynTree/TypeSubstitution.cc
ra6fe3de rbd34fc87 179 179 } 180 180 181 Type * TypeSubstitution::mutate( VoidType * voidType ) {182 return handleType( voidType );181 Type * TypeSubstitution::mutate( VoidType *basicType ) { 182 return handleType( basicType ); 183 183 } 184 184 … … 221 221 Type * TypeSubstitution::mutate( VarArgsType *varArgsType ) { 222 222 return handleType( varArgsType ); 223 }224 225 Type * TypeSubstitution::mutate( ZeroType *zeroType ) {226 return handleType( zeroType );227 }228 229 Type * TypeSubstitution::mutate( OneType *oneType ) {230 return handleType( oneType );231 223 } 232 224 -
src/SynTree/TypeSubstitution.h
ra6fe3de rbd34fc87 76 76 virtual Type* mutate(TupleType *tupleType); 77 77 virtual Type* mutate(VarArgsType *varArgsType); 78 virtual Type* mutate(ZeroType *zeroType);79 virtual Type* mutate(OneType *oneType);80 78 81 79 // TODO: worry about traversing into a forall-qualified function type or type decl with assertions -
src/SynTree/Visitor.cc
ra6fe3de rbd34fc87 383 383 } 384 384 385 void Visitor::visit( ZeroType *zeroType ) {386 acceptAll( zeroType->get_forall(), *this );387 }388 389 void Visitor::visit( OneType *oneType ) {390 acceptAll( oneType->get_forall(), *this );391 }392 393 385 void Visitor::visit( SingleInit *singleInit ) { 394 386 singleInit->get_value()->accept( *this ); -
src/SynTree/Visitor.h
ra6fe3de rbd34fc87 95 95 virtual void visit( AttrType *attrType ); 96 96 virtual void visit( VarArgsType *varArgsType ); 97 virtual void visit( ZeroType *zeroType );98 virtual void visit( OneType *oneType );99 97 100 98 virtual void visit( SingleInit *singleInit ); -
src/SynTree/module.mk
ra6fe3de rbd34fc87 26 26 SynTree/AttrType.cc \ 27 27 SynTree/VarArgsType.cc \ 28 SynTree/ZeroOneType.cc \29 28 SynTree/Constant.cc \ 30 29 SynTree/Expression.cc \
Note:
See TracChangeset
for help on using the changeset viewer.