Changeset 207c7e1d for src/InitTweak


Ignore:
Timestamp:
Jan 23, 2017, 11:42:09 AM (8 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:
092528b
Parents:
bd98b58
Message:

disable autogeneration of ctor/dtor/assign when a member's corresponding operation is missing

Location:
src/InitTweak
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/InitTweak.cc

    rbd98b58 r207c7e1d  
    547547        }
    548548
     549        FunctionDecl * isAssignment( Declaration * decl ) {
     550                return isCopyFunction( decl, "?=?" );
     551        }
     552        FunctionDecl * isDestructor( Declaration * decl ) {
     553                if ( isDestructor( decl->get_name() ) ) {
     554                        return dynamic_cast< FunctionDecl * >( decl );
     555                }
     556                return nullptr;
     557        }
     558        FunctionDecl * isDefaultConstructor( Declaration * decl ) {
     559                if ( isConstructor( decl->get_name() ) ) {
     560                        if ( FunctionDecl * func = dynamic_cast< FunctionDecl * >( decl ) ) {
     561                                if ( func->get_functionType()->get_parameters().size() == 1 ) {
     562                                        return func;
     563                                }
     564                        }
     565                }
     566                return nullptr;
     567        }
    549568        FunctionDecl * isCopyConstructor( Declaration * decl ) {
    550569                return isCopyFunction( decl, "?{}" );
  • src/InitTweak/InitTweak.h

    rbd98b58 r207c7e1d  
    3232        bool isCtorDtorAssign( const std::string & );
    3333
     34        FunctionDecl * isAssignment( Declaration * decl );
     35        FunctionDecl * isDestructor( Declaration * decl );
     36        FunctionDecl * isDefaultConstructor( Declaration * decl );
    3437        FunctionDecl * isCopyConstructor( Declaration * decl );
    3538        FunctionDecl * isCopyFunction( Declaration * decl, const std::string & fname );
Note: See TracChangeset for help on using the changeset viewer.