Changeset 9c23f31 for src/SymTab
- Timestamp:
- Sep 24, 2016, 12:19:33 PM (9 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:
- 3b5e3aa
- Parents:
- 2298f728 (diff), 7ae930a (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/SymTab
- Files:
-
- 7 edited
-
FixFunction.cc (modified) (1 diff)
-
FixFunction.h (modified) (1 diff)
-
ImplementationType.cc (modified) (2 diffs)
-
Mangler.cc (modified) (1 diff)
-
Mangler.h (modified) (1 diff)
-
TypeEquality.cc (modified) (2 diffs)
-
Validate.cc (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/FixFunction.cc
r2298f728 r9c23f31 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
r2298f728 r9c23f31 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
r2298f728 r9c23f31 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
r2298f728 r9c23f31 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
r2298f728 r9c23f31 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
r2298f728 r9c23f31 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/SymTab/Validate.cc
r2298f728 r9c23f31 60 60 #include "ResolvExpr/typeops.h" 61 61 #include <algorithm> 62 #include "InitTweak/InitTweak.h" 62 63 63 64 #define debugPrint( x ) if ( doDebug ) { std::cout << x; } … … 171 172 }; 172 173 173 class VerifyCtorDtor : public Visitor {174 class VerifyCtorDtorAssign : public Visitor { 174 175 public: 175 /// ensure that constructors and destructorshave at least one176 /// parameter, the first of which must be a pointer, and no176 /// ensure that constructors, destructors, and assignment have at least one 177 /// parameter, the first of which must be a pointer, and that ctor/dtors have no 177 178 /// return values. 178 179 static void verify( std::list< Declaration * > &translationUnit ); … … 202 203 compoundliteral.mutateDeclarationList( translationUnit ); 203 204 acceptAll( translationUnit, pass3 ); 204 VerifyCtorDtor ::verify( translationUnit );205 VerifyCtorDtorAssign::verify( translationUnit ); 205 206 } 206 207 … … 687 688 } 688 689 689 void VerifyCtorDtor ::verify( std::list< Declaration * > & translationUnit ) {690 VerifyCtorDtor verifier;690 void VerifyCtorDtorAssign::verify( std::list< Declaration * > & translationUnit ) { 691 VerifyCtorDtorAssign verifier; 691 692 acceptAll( translationUnit, verifier ); 692 693 } 693 694 694 void VerifyCtorDtor ::visit( FunctionDecl * funcDecl ) {695 void VerifyCtorDtorAssign::visit( FunctionDecl * funcDecl ) { 695 696 FunctionType * funcType = funcDecl->get_functionType(); 696 697 std::list< DeclarationWithType * > &returnVals = funcType->get_returnVals(); 697 698 std::list< DeclarationWithType * > ¶ms = funcType->get_parameters(); 698 699 699 if ( funcDecl->get_name() == "?{}" || funcDecl->get_name() == "^?{}") {700 if ( InitTweak::isCtorDtorAssign( funcDecl->get_name() ) ) { 700 701 if ( params.size() == 0 ) { 701 throw SemanticError( "Constructors and destructors require at least one parameter ", funcDecl );702 throw SemanticError( "Constructors, destructors, and assignment functions require at least one parameter ", funcDecl ); 702 703 } 703 704 if ( ! dynamic_cast< PointerType * >( params.front()->get_type() ) ) { 704 throw SemanticError( "First parameter of a constructor or destructormust be a pointer ", funcDecl );705 throw SemanticError( "First parameter of a constructor, destructor, or assignment function must be a pointer ", funcDecl ); 705 706 } 706 if ( returnVals.size() != 0 ) {707 if ( InitTweak::isCtorDtor( funcDecl->get_name() ) && returnVals.size() != 0 ) { 707 708 throw SemanticError( "Constructors and destructors cannot have explicit return values ", funcDecl ); 708 709 }
Note:
See TracChangeset
for help on using the changeset viewer.