Changeset ed8a0d2 for src


Ignore:
Timestamp:
May 2, 2017, 7:09:44 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
9042795
Parents:
2055098
Message:

constructor taking an array parameter is now an error

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/SymTab/Validate.cc

    r2055098 red8a0d2  
    240240                ReturnTypeFixer::fix( translationUnit ); // must happen before autogen
    241241                acceptAll( translationUnit, lrt ); // must happen before autogen, because sized flag needs to propagate to generated functions
     242                acceptAll( translationUnit, epc ); // must happen before VerifyCtorDtorAssign, because void return objects should not exist
     243                VerifyCtorDtorAssign::verify( translationUnit );  // must happen before autogen, because autogen examines existing ctor/dtors
    242244                Concurrency::applyKeywords( translationUnit );
    243245                autogenerateRoutines( translationUnit ); // moved up, used to be below compoundLiteral - currently needs EnumAndPointerDecayPass
    244246                Concurrency::implementMutexFuncs( translationUnit );
    245247                Concurrency::implementThreadStarter( translationUnit );
    246                 acceptAll( translationUnit, epc );
    247248                ReturnChecker::checkFunctionReturns( translationUnit );
    248249                compoundliteral.mutateDeclarationList( translationUnit );
    249250                acceptAll( translationUnit, pass3 );
    250                 VerifyCtorDtorAssign::verify( translationUnit );
    251251                ArrayLength::computeLength( translationUnit );
    252252        }
     
    817817                                throw SemanticError( "Constructors, destructors, and assignment functions require at least one parameter ", funcDecl );
    818818                        }
    819                         if ( ! dynamic_cast< PointerType * >( params.front()->get_type() ) ) {
     819                        PointerType * ptrType = dynamic_cast< PointerType * >( params.front()->get_type() );
     820                        if ( ! ptrType || ptrType->is_array() ) {
    820821                                throw SemanticError( "First parameter of a constructor, destructor, or assignment function must be a pointer ", funcDecl );
    821822                        }
  • src/SynTree/PointerType.cc

    r2055098 red8a0d2  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // PointerType.cc -- 
     7// PointerType.cc --
    88//
    99// Author           : Richard C. Bilson
     
    3838void PointerType::print( std::ostream &os, int indent ) const {
    3939        Type::print( os, indent );
    40         os << "pointer to ";
    41         if ( isStatic ) {
    42                 os << "static ";
    43         } // if
    44         if ( isVarLen ) {
    45                 os << "variable length array of ";
    46         } else if ( dimension ) {
    47                 os << "array of ";
    48                 dimension->print( os, indent );
    49         } // if
     40        if ( ! is_array() ) {
     41                os << "pointer to ";
     42        } else {
     43                os << "decayed ";
     44                if ( isStatic ) {
     45                        os << "static ";
     46                } // if
     47                if ( isVarLen ) {
     48                        os << "variable length array of ";
     49                } else if ( dimension ) {
     50                        os << "array of ";
     51                        dimension->print( os, indent );
     52                        os << " ";
     53                } // if
     54        }
    5055        if ( base ) {
    5156                base->print( os, indent );
  • src/SynTree/Type.h

    r2055098 red8a0d2  
    247247        void set_isStatic( bool newValue ) { isStatic = newValue; }
    248248
     249        bool is_array() const { return isStatic || isVarLen || dimension; }
     250
    249251        virtual PointerType *clone() const { return new PointerType( *this ); }
    250252        virtual void accept( Visitor & v ) { v.visit( this ); }
Note: See TracChangeset for help on using the changeset viewer.