Changeset 9c23f31 for src/SymTab


Ignore:
Timestamp:
Sep 24, 2016, 12:19:33 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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.
Message:

fix conflicts

Location:
src/SymTab
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/FixFunction.cc

    r2298f728 r9c23f31  
    7777                return varArgsType;
    7878        }
     79
     80        Type * FixFunction::mutate(ZeroType *zeroType) {
     81                return zeroType;
     82        }
     83
     84        Type * FixFunction::mutate(OneType *oneType) {
     85                return oneType;
     86        }
    7987} // namespace SymTab
    8088
  • src/SymTab/FixFunction.h

    r2298f728 r9c23f31  
    4242                virtual Type* mutate(TupleType *tupleType);
    4343                virtual Type* mutate(VarArgsType *varArgsType);
     44                virtual Type* mutate(ZeroType *zeroType);
     45                virtual Type* mutate(OneType *oneType);
    4446 
    4547                bool isVoid;
  • src/SymTab/ImplementationType.cc

    r2298f728 r9c23f31  
    4141                virtual void visit(TupleType *tupleType);
    4242                virtual void visit(VarArgsType *varArgsType);
     43                virtual void visit(ZeroType *zeroType);
     44                virtual void visit(OneType *oneType);
    4345
    4446                Type *result;                   // synthesized
     
    120122        void ImplementationType::visit(VarArgsType *varArgsType) {
    121123        }
     124
     125        void ImplementationType::visit(ZeroType *zeroType) {
     126        }
     127
     128        void ImplementationType::visit(OneType *oneType) {
     129        }
    122130} // namespace SymTab
    123131
  • src/SymTab/Mangler.cc

    r2298f728 r9c23f31  
    229229                printQualifiers( varArgsType );
    230230                mangleName << "VARGS";
     231        }
     232
     233        void Mangler::visit( ZeroType *zeroType ) {
     234                mangleName << "Z";
     235        }
     236
     237        void Mangler::visit( OneType *oneType ) {
     238                mangleName << "O";
    231239        }
    232240
  • src/SymTab/Mangler.h

    r2298f728 r9c23f31  
    4646                virtual void visit( TupleType *tupleType );
    4747                virtual void visit( VarArgsType *varArgsType );
     48                virtual void visit( ZeroType *zeroType );
     49                virtual void visit( OneType *oneType );
    4850 
    4951                std::string get_mangleName() { return mangleName.str(); }
  • src/SymTab/TypeEquality.cc

    r2298f728 r9c23f31  
    4242                virtual void visit( TypeInstType *typeInst );
    4343                virtual void visit( VarArgsType *varArgsType );
     44                virtual void visit( ZeroType *zeroType );
     45                virtual void visit( OneType *oneType );
    4446
    4547                void handleQualifiers( Type * t );
     
    199201                }
    200202        }
     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        }
    201217} // namespace SymTab
  • src/SymTab/Validate.cc

    r2298f728 r9c23f31  
    6060#include "ResolvExpr/typeops.h"
    6161#include <algorithm>
     62#include "InitTweak/InitTweak.h"
    6263
    6364#define debugPrint( x ) if ( doDebug ) { std::cout << x; }
     
    171172        };
    172173
    173         class VerifyCtorDtor : public Visitor {
     174        class VerifyCtorDtorAssign : public Visitor {
    174175        public:
    175                 /// ensure that constructors and destructors have at least one
    176                 /// parameter, the first of which must be a pointer, and no
     176                /// 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
    177178                /// return values.
    178179                static void verify( std::list< Declaration * > &translationUnit );
     
    202203                compoundliteral.mutateDeclarationList( translationUnit );
    203204                acceptAll( translationUnit, pass3 );
    204                 VerifyCtorDtor::verify( translationUnit );
     205                VerifyCtorDtorAssign::verify( translationUnit );
    205206        }
    206207
     
    687688        }
    688689
    689         void VerifyCtorDtor::verify( std::list< Declaration * > & translationUnit ) {
    690                 VerifyCtorDtor verifier;
     690        void VerifyCtorDtorAssign::verify( std::list< Declaration * > & translationUnit ) {
     691                VerifyCtorDtorAssign verifier;
    691692                acceptAll( translationUnit, verifier );
    692693        }
    693694
    694         void VerifyCtorDtor::visit( FunctionDecl * funcDecl ) {
     695        void VerifyCtorDtorAssign::visit( FunctionDecl * funcDecl ) {
    695696                FunctionType * funcType = funcDecl->get_functionType();
    696697                std::list< DeclarationWithType * > &returnVals = funcType->get_returnVals();
    697698                std::list< DeclarationWithType * > &params = funcType->get_parameters();
    698699
    699                 if ( funcDecl->get_name() == "?{}" || funcDecl->get_name() == "^?{}" ) {
     700                if ( InitTweak::isCtorDtorAssign( funcDecl->get_name() ) ) {
    700701                        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 );
    702703                        }
    703704                        if ( ! dynamic_cast< PointerType * >( params.front()->get_type() ) ) {
    704                                 throw SemanticError( "First parameter of a constructor or destructor must be a pointer ", funcDecl );
     705                                throw SemanticError( "First parameter of a constructor, destructor, or assignment function must be a pointer ", funcDecl );
    705706                        }
    706                         if ( returnVals.size() != 0 ) {
     707                        if ( InitTweak::isCtorDtor( funcDecl->get_name() ) && returnVals.size() != 0 ) {
    707708                                throw SemanticError( "Constructors and destructors cannot have explicit return values ", funcDecl );
    708709                        }
Note: See TracChangeset for help on using the changeset viewer.