Changeset 6943f051 for src


Ignore:
Timestamp:
Mar 18, 2016, 6:09:23 PM (8 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
Children:
4cc4286
Parents:
f5ef08c
Message:

fix implicit type assertion ordering - assignment must come first

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/OperatorTable.cc

    rf5ef08c r6943f051  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // OperatorTable.cc -- 
     7// OperatorTable.cc --
    88//
    99// Author           : Richard C. Bilson
     
    2222                        {       "?[?]",         "",             "_operator_index",                              OT_INDEX                        },
    2323                        {       "?{}",          "",             "_constructor",                                 OT_CTOR                         },
    24                         {       "^?{}",         "",             "_destructor",                                  OT_DTOR                         }, // ~?{}, -?{}, !?{}, $?{}, ??{}, ^?{}, ?destroy, ?delete
     24                        {       "^?{}",         "",             "_destructor",                                  OT_DTOR                         },
    2525                        {       "?()",          "",             "_operator_call",                               OT_CALL                         },
    2626                        {       "?++",          "++",   "_operator_postincr",                   OT_POSTFIXASSIGN        },
  • src/GenPoly/CopyParams.cc

    rf5ef08c r6943f051  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // CopyParams.cc -- 
     7// CopyParams.cc --
    88//
    99// Author           : Richard C. Bilson
    1010// Created On       : Mon May 18 07:44:20 2015
    11 // Last Modified By : Peter A. Buhr
     11// Last Modified By : Rob Schluntz
    1212// Last Modified On : Tue May 19 07:33:31 2015
    1313// Update Count     : 1
     
    2929          public:
    3030                CopyParams();
    31  
     31
    3232                virtual void visit( FunctionDecl *funcDecl );
    3333                virtual void visit( AddressExpr *addrExpr );
     
    5050                if ( funcDecl->get_statements() ) {
    5151                        funcDecl->get_statements()->accept( *this );
    52        
     52
    5353                        if ( ! modVars.empty() ) {
    5454                                std::map< std::string, DeclarationWithType* > assignOps;
     
    5757                                        if ( (*tyVar)->get_kind() == TypeDecl::Any ) {
    5858                                                assert( !(*tyVar)->get_assertions().empty() );
     59                                                assert( (*tyVar)->get_assertions().front()->get_name() == "?=?" );
    5960                                                assignOps[ (*tyVar)->get_name() ] = (*tyVar)->get_assertions().front();
    6061                                        } // if
  • src/Parser/TypeData.cc

    rf5ef08c r6943f051  
    436436        for ( std::list< TypeDecl* >::iterator i = outputList.begin(); i != outputList.end(); ++i ) {
    437437                if ( (*i)->get_kind() == TypeDecl::Any ) {
    438                         // add assertion parameters to `type' tyvars
     438                        // add assertion parameters to `type' tyvars in reverse order
     439                        // add dtor:  void ^?{}(T *)
     440                        FunctionType *dtorType = new FunctionType( Type::Qualifiers(), false );
     441                        dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0 ) );
     442                        (*i)->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, dtorType, 0, false, false ) );
     443                        // add copy ctor:  void ?{}(T *, T)
     444                        FunctionType *copyCtorType = new FunctionType( Type::Qualifiers(), false );
     445                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0 ) );
     446                        copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), 0 ) );
     447                        (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, copyCtorType, 0, false, false ) );
     448
     449                        // add default ctor:  void ?{}(T *)
     450                        FunctionType *ctorType = new FunctionType( Type::Qualifiers(), false );
     451                        ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0 ) );
     452                        (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, ctorType, 0, false, false ) );
     453
    439454                        // add assignment operator:  T * ?=?(T *, T)
    440455                        FunctionType *assignType = new FunctionType( Type::Qualifiers(), false );
     
    443458                        assignType->get_returnVals().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), 0 ) );
    444459                        (*i)->get_assertions().push_front( new FunctionDecl( "?=?", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, assignType, 0, false, false ) );
    445 
    446                         // add default ctor:  void ?{}(T *)
    447                         FunctionType *ctorType = new FunctionType( Type::Qualifiers(), false );
    448                         ctorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0 ) );
    449                         (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, ctorType, 0, false, false ) );
    450 
    451                         // add copy ctor:  void ?{}(T *, T)
    452                         FunctionType *copyCtorType = new FunctionType( Type::Qualifiers(), false );
    453                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0 ) );
    454                         copyCtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ), 0 ) );
    455                         (*i)->get_assertions().push_front( new FunctionDecl( "?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, copyCtorType, 0, false, false ) );
    456 
    457                         // add dtor:  void ^?{}(T *)
    458                         FunctionType *dtorType = new FunctionType( Type::Qualifiers(), false );
    459                         dtorType->get_parameters().push_back( new ObjectDecl( "", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, 0, new PointerType( Type::Qualifiers(), new TypeInstType( Type::Qualifiers(), (*i)->get_name(), *i ) ), 0 ) );
    460                         (*i)->get_assertions().push_front( new FunctionDecl( "^?{}", DeclarationNode::NoStorageClass, LinkageSpec::Cforall, dtorType, 0, false, false ) );
    461460                } // if
    462461        } // for
Note: See TracChangeset for help on using the changeset viewer.