Changeset 89e6ffc
- Timestamp:
- Sep 19, 2016, 5:23:41 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- a6fe3de
- Parents:
- fc4a0fa
- Location:
- src
- Files:
-
- 27 edited
Legend:
- Unmodified
- Added
- Removed
-
src/CodeGen/GenType.cc
rfc4a0fa r89e6ffc 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 ); 44 46 45 47 private: … … 200 202 } 201 203 204 void GenType::visit( ZeroType *zeroType ) { 205 // ideally these wouldn't hit codegen at all, but should be safe to make them ints 206 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 ints 212 typeString = "int " + typeString; 213 handleQualifiers( oneType ); 214 } 215 202 216 void GenType::handleQualifiers( Type *type ) { 203 217 if ( type->get_isConst() ) { -
src/Makefile.in
rfc4a0fa r89e6ffc 165 165 SynTree/driver_cfa_cpp-AttrType.$(OBJEXT) \ 166 166 SynTree/driver_cfa_cpp-VarArgsType.$(OBJEXT) \ 167 SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT) \ 167 168 SynTree/driver_cfa_cpp-Constant.$(OBJEXT) \ 168 169 SynTree/driver_cfa_cpp-Expression.$(OBJEXT) \ … … 390 391 SynTree/ReferenceToType.cc SynTree/TupleType.cc \ 391 392 SynTree/TypeofType.cc SynTree/AttrType.cc \ 392 SynTree/VarArgsType.cc SynTree/ Constant.cc \393 SynTree/ Expression.cc SynTree/TupleExpr.cc \393 SynTree/VarArgsType.cc SynTree/ZeroOneType.cc \ 394 SynTree/Constant.cc SynTree/Expression.cc SynTree/TupleExpr.cc \ 394 395 SynTree/CommaExpr.cc SynTree/TypeExpr.cc \ 395 396 SynTree/ApplicationExpr.cc SynTree/AddressExpr.cc \ … … 715 716 SynTree/driver_cfa_cpp-VarArgsType.$(OBJEXT): SynTree/$(am__dirstamp) \ 716 717 SynTree/$(DEPDIR)/$(am__dirstamp) 718 SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT): SynTree/$(am__dirstamp) \ 719 SynTree/$(DEPDIR)/$(am__dirstamp) 717 720 SynTree/driver_cfa_cpp-Constant.$(OBJEXT): SynTree/$(am__dirstamp) \ 718 721 SynTree/$(DEPDIR)/$(am__dirstamp) … … 877 880 -rm -f SynTree/driver_cfa_cpp-Visitor.$(OBJEXT) 878 881 -rm -f SynTree/driver_cfa_cpp-VoidType.$(OBJEXT) 882 -rm -f SynTree/driver_cfa_cpp-ZeroOneType.$(OBJEXT) 879 883 -rm -f Tuples/driver_cfa_cpp-NameMatcher.$(OBJEXT) 880 884 -rm -f Tuples/driver_cfa_cpp-TupleAssignment.$(OBJEXT) … … 982 986 @AMDEP_TRUE@@am__include@ @am__quote@SynTree/$(DEPDIR)/driver_cfa_cpp-Visitor.Po@am__quote@ 983 987 @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@ 984 989 @AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-NameMatcher.Po@am__quote@ 985 990 @AMDEP_TRUE@@am__include@ @am__quote@Tuples/$(DEPDIR)/driver_cfa_cpp-TupleAssignment.Po@am__quote@ … … 2064 2069 @AMDEP_TRUE@@am__fastdepCXX_FALSE@ DEPDIR=$(DEPDIR) $(CXXDEPMODE) $(depcomp) @AMDEPBACKSLASH@ 2065 2070 @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.cc 2073 @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.cc 2074 @am__fastdepCXX_TRUE@ $(AM_V_at)$(am__mv) SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Tpo SynTree/$(DEPDIR)/driver_cfa_cpp-ZeroOneType.Po 2075 @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.cc 2078 2079 SynTree/driver_cfa_cpp-ZeroOneType.obj: SynTree/ZeroOneType.cc 2080 @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.Po 2082 @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` 2066 2085 2067 2086 SynTree/driver_cfa_cpp-Constant.o: SynTree/Constant.cc -
src/ResolvExpr/AdjustExprType.cc
rfc4a0fa r89e6ffc 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 ); 39 41 40 42 const TypeEnvironment &env; … … 117 119 return varArgsType; 118 120 } 121 122 Type *AdjustExprType::mutate( ZeroType *zeroType ) { 123 return zeroType; 124 } 125 126 Type *AdjustExprType::mutate( OneType *oneType ) { 127 return oneType; 128 } 119 129 } // namespace ResolvExpr 120 130 -
src/ResolvExpr/CommonType.cc
rfc4a0fa r89e6ffc 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 ); 41 43 42 44 template< typename RefType > void handleRefType( RefType *inst, Type *other ); … … 134 136 result = new BasicType( basicType->get_qualifiers() + otherBasic->get_qualifiers(), newType ); 135 137 } // if 136 } else if ( EnumInstType *enumInstType = dynamic_cast< EnumInstType * >( type2 ) ) {137 // use signed int in lieu of the enum type138 } else if ( dynamic_cast< EnumInstType * > ( type2 ) || dynamic_cast< ZeroType* >( type2 ) || dynamic_cast< OneType* >( type2 ) ) { 139 // use signed int in lieu of the enum/zero/one type 138 140 BasicType::Kind newType = combinedType[ basicType->get_kind() ][ BasicType::SignedInt ]; 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 );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 ); 141 143 } // if 142 144 } // if … … 171 173 otherPointer->get_base()->get_qualifiers() = tq2; 172 174 } // if 175 } else if ( widenSecond && dynamic_cast< ZeroType* >( type2 ) ) { 176 result = pointerType->clone(); 177 result->get_qualifiers() += type2->get_qualifiers(); 173 178 } // if 174 179 } … … 190 195 191 196 void CommonType::visit( EnumInstType *enumInstType ) { 192 if ( dynamic_cast< BasicType * >( type2 ) ) {197 if ( dynamic_cast< BasicType * >( type2 ) || dynamic_cast< ZeroType* >( type2 ) || dynamic_cast< OneType* >( type2 ) ) { 193 198 // reuse BasicType, EnumInstType code by swapping type2 with enumInstType 194 199 Type * temp = type2; … … 230 235 void CommonType::visit( VarArgsType *varArgsType ) { 231 236 } 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 } 232 259 } // namespace ResolvExpr 233 260 -
src/ResolvExpr/ConversionCost.cc
rfc4a0fa r89e6ffc 160 160 // xxx - not positive this is correct, but appears to allow casting int => enum 161 161 cost = Cost( 1, 0, 0 ); 162 } // if 162 } else if ( dynamic_cast< ZeroType* >( dest ) != nullptr || dynamic_cast< OneType* >( dest ) != nullptr ) { 163 cost = Cost( 1, 0, 0 ); 164 } // if 163 165 } 164 166 … … 175 177 } // if 176 178 } // if 179 } else if ( dynamic_cast< ZeroType* >( dest ) != nullptr || dynamic_cast< OneType* >( dest ) != nullptr ) { 180 cost = Cost( 1, 0, 0 ); 177 181 } // if 178 182 } … … 256 260 } 257 261 } 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 conversions 268 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 conversions 284 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 } 258 292 } // namespace ResolvExpr 259 293 -
src/ResolvExpr/ConversionCost.h
rfc4a0fa r89e6ffc 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); 43 45 protected: 44 46 Type *dest; -
src/ResolvExpr/PtrsAssignable.cc
rfc4a0fa r89e6ffc 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 ); 41 43 private: 42 44 Type *dest; … … 141 143 void PtrsAssignable::visit( VarArgsType *varArgsType ) { 142 144 } 145 146 void PtrsAssignable::visit( ZeroType *zeroType ) { 147 } 148 149 void PtrsAssignable::visit( OneType *oneType ) { 150 } 151 143 152 } // namespace ResolvExpr 144 153 -
src/ResolvExpr/PtrsCastable.cc
rfc4a0fa r89e6ffc 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); 42 44 private: 43 45 Type *dest; … … 144 146 result = objectCast( dest, env, indexer ); 145 147 } 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 } 146 156 } // namespace ResolvExpr 147 157 -
src/ResolvExpr/RenameVars.cc
rfc4a0fa r89e6ffc 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 112 122 void RenameVars::typeBefore( Type *type ) { 113 123 if ( ! type->get_forall().empty() ) { -
src/ResolvExpr/RenameVars.h
rfc4a0fa r89e6ffc 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 ); 46 48 47 49 void typeBefore( Type *type ); -
src/ResolvExpr/Resolver.cc
rfc4a0fa r89e6ffc 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; 135 137 } else { 136 138 return false; … … 459 461 } 460 462 } else { 461 assert( dynamic_cast< BasicType * >( initContext ) || dynamic_cast< PointerType * >( initContext ) ); 463 assert( dynamic_cast< BasicType * >( initContext ) || dynamic_cast< PointerType * >( initContext ) 464 || dynamic_cast< ZeroType * >( initContext ) || dynamic_cast< OneType * >( initContext ) ); 462 465 // basic types are handled here 463 466 Visitor::visit( listInit ); -
src/ResolvExpr/Unify.cc
rfc4a0fa r89e6ffc 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); 62 64 63 65 template< typename RefType > void handleRefType( RefType *inst, Type *other ); … … 588 590 } 589 591 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 590 600 } // namespace ResolvExpr 591 601 -
src/SymTab/FixFunction.cc
rfc4a0fa r89e6ffc 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 } 79 87 } // namespace SymTab 80 88 -
src/SymTab/FixFunction.h
rfc4a0fa r89e6ffc 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); 44 46 45 47 bool isVoid; -
src/SymTab/ImplementationType.cc
rfc4a0fa r89e6ffc 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); 43 45 44 46 Type *result; // synthesized … … 120 122 void ImplementationType::visit(VarArgsType *varArgsType) { 121 123 } 124 125 void ImplementationType::visit(ZeroType *zeroType) { 126 } 127 128 void ImplementationType::visit(OneType *oneType) { 129 } 122 130 } // namespace SymTab 123 131 -
src/SymTab/Mangler.cc
rfc4a0fa r89e6ffc 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"; 231 239 } 232 240 -
src/SymTab/Mangler.h
rfc4a0fa r89e6ffc 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 ); 48 50 49 51 std::string get_mangleName() { return mangleName.str(); } -
src/SymTab/TypeEquality.cc
rfc4a0fa r89e6ffc 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 ); 44 46 45 47 void handleQualifiers( Type * t ); … … 199 201 } 200 202 } 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 } 201 217 } // namespace SymTab -
src/SynTree/Mutator.cc
rfc4a0fa r89e6ffc 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 455 465 Initializer *Mutator::mutate( SingleInit *singleInit ) { 456 466 singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) ); -
src/SynTree/Mutator.h
rfc4a0fa r89e6ffc 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 ); 97 99 98 100 virtual Initializer* mutate( SingleInit *singleInit ); -
src/SynTree/SynTree.h
rfc4a0fa r89e6ffc 102 102 class AttrType; 103 103 class VarArgsType; 104 class ZeroType; 105 class OneType; 104 106 105 107 class Initializer; -
src/SynTree/Type.h
rfc4a0fa r89e6ffc 418 418 }; 419 419 420 /// Represents a zero constant 421 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 constant 433 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 420 444 inline Type::Qualifiers &Type::Qualifiers::operator+=( const Type::Qualifiers &other ) { 421 445 isConst |= other.isConst; -
src/SynTree/TypeSubstitution.cc
rfc4a0fa r89e6ffc 179 179 } 180 180 181 Type * TypeSubstitution::mutate( VoidType * basicType ) {182 return handleType( basicType );181 Type * TypeSubstitution::mutate( VoidType *voidType ) { 182 return handleType( voidType ); 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 ); 223 231 } 224 232 -
src/SynTree/TypeSubstitution.h
rfc4a0fa r89e6ffc 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); 78 80 79 81 // TODO: worry about traversing into a forall-qualified function type or type decl with assertions -
src/SynTree/Visitor.cc
rfc4a0fa r89e6ffc 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 385 393 void Visitor::visit( SingleInit *singleInit ) { 386 394 singleInit->get_value()->accept( *this ); -
src/SynTree/Visitor.h
rfc4a0fa r89e6ffc 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 ); 97 99 98 100 virtual void visit( SingleInit *singleInit ); -
src/SynTree/module.mk
rfc4a0fa r89e6ffc 26 26 SynTree/AttrType.cc \ 27 27 SynTree/VarArgsType.cc \ 28 SynTree/ZeroOneType.cc \ 28 29 SynTree/Constant.cc \ 29 30 SynTree/Expression.cc \
Note: See TracChangeset
for help on using the changeset viewer.