Changeset 6fc5c14


Ignore:
Timestamp:
Oct 19, 2017, 11:15:35 AM (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:
ab4bff5
Parents:
447c356
git-author:
Rob Schluntz <rschlunt@…> (10/17/17 10:26:33)
git-committer:
Rob Schluntz <rschlunt@…> (10/19/17 11:15:35)
Message:

Skip non-constructable types during autogen

Location:
src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/InitTweak.cc

    r447c356 r6fc5c14  
    353353                        assert( expr );
    354354                        if ( VariableExpr * varExpr = dynamic_cast< VariableExpr * >( expr ) ) {
    355                                 return varExpr->get_var();
     355                                return varExpr->var;
    356356                        } else if ( MemberExpr * memberExpr = dynamic_cast< MemberExpr * >( expr ) ) {
    357                                 return memberExpr->get_member();
     357                                return memberExpr->member;
    358358                        } else if ( CastExpr * castExpr = dynamic_cast< CastExpr * >( expr ) ) {
    359                                 return getCalledFunction( castExpr->get_arg() );
     359                                return getCalledFunction( castExpr->arg );
    360360                        } else if ( UntypedExpr * untypedExpr = dynamic_cast< UntypedExpr * >( expr ) ) {
    361361                                return handleDerefCalledFunction( untypedExpr );
     
    363363                                return handleDerefCalledFunction( appExpr );
    364364                        } else if ( AddressExpr * addrExpr = dynamic_cast< AddressExpr * >( expr ) ) {
    365                                 return getCalledFunction( addrExpr->get_arg() );
     365                                return getCalledFunction( addrExpr->arg );
     366                        } else if ( CommaExpr * commaExpr = dynamic_cast< CommaExpr * >( expr ) ) {
     367                                return getCalledFunction( commaExpr->arg2 );
    366368                        }
    367369                        return nullptr;
  • src/SymTab/Autogen.cc

    r447c356 r6fc5c14  
    379379                                // don't make a function whose parameter is an unnamed bitfield
    380380                                continue;
     381                        } else if ( ! InitTweak::isConstructable( field->get_type() ) ) {
     382                                continue;
    381383                        }
    382384                        memCtorType->parameters.push_back( new ObjectDecl( field->name, Type::StorageClasses(), LinkageSpec::Cforall, 0, field->get_type()->clone(), 0 ) );
     
    407409                                }
    408410
    409                                 if ( type->get_const() && func->get_name() == "?=?" ) {
     411                                if ( type->get_const() && CodeGen::isAssignment( func->name ) ) {
    410412                                        // don't assign const members, but do construct/destruct
     413                                        continue;
     414                                } else if ( CodeGen::isCtorDtor( func->name ) && ! InitTweak::isConstructable( type ) ) {
     415                                        // don't construct non-constructable types
    411416                                        continue;
    412417                                }
     
    441446                                if ( isUnnamedBitfield( dynamic_cast< ObjectDecl * > ( field ) ) ) {
    442447                                        // don't make a function whose parameter is an unnamed bitfield
     448                                        continue;
     449                                } else if ( ! InitTweak::isConstructable( field->get_type() ) ) {
     450                                        // don't construct non-constructable types
    443451                                        continue;
    444452                                } else if ( parameter != params.end() ) {
  • src/SymTab/Indexer.cc

    r447c356 r6fc5c14  
    407407                makeWritable();
    408408
    409                 const std::string &name = decl->get_name();
     409                const std::string &name = decl->name;
    410410                std::string mangleName;
    411                 if ( LinkageSpec::isOverridable( decl->get_linkage() ) ) {
     411                if ( LinkageSpec::isOverridable( decl->linkage ) ) {
    412412                        // mangle the name without including the appropriate suffix, so overridable routines are placed into the
    413413                        // same "bucket" as their user defined versions.
     
    418418
    419419                // this ensures that no two declarations with the same unmangled name at the same scope both have C linkage
    420                 if ( ! LinkageSpec::isMangled( decl->get_linkage() ) ) {
     420                if ( ! LinkageSpec::isMangled( decl->linkage ) ) {
    421421                        // NOTE this is broken in Richard's original code in such a way that it never triggers (it
    422422                        // doesn't check decls that have the same manglename, and all C-linkage decls are defined to
Note: See TracChangeset for help on using the changeset viewer.