Changeset 207b496


Ignore:
Timestamp:
Apr 10, 2018, 3:16:31 PM (6 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, with_gc
Children:
ba89e9b7
Parents:
5002738
Message:

Update FixIntrinsicArgs? conditions (not quite correct)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/GenPoly/Lvalue.cc

    r5002738 r207b496  
    206206                                                )
    207207                                                // TODO: it's likely that the second condition should be ... && ! isIntrinsicReference( arg ), but this requires investigation.
    208                                                 if ( function->get_linkage() != LinkageSpec::Intrinsic && isIntrinsicReference( arg ) ) {
    209                                                         // if argument is dereference or array subscript, the result isn't REALLY a reference, but non-intrinsic functions expect a reference: take address
    210                                                         PRINT(
    211                                                                 std::cerr << "===is intrinsic arg in non-intrinsic call - adding address" << std::endl;
    212                                                         )
    213                                                         arg = new AddressExpr( arg );
    214                                                 } else if ( function->get_linkage() == LinkageSpec::Intrinsic && arg->result->referenceDepth() != 0 ) {
     208                                                // if ( function->get_linkage() != LinkageSpec::Intrinsic && isIntrinsicReference( arg ) ) {
     209                                                //      // if argument is dereference or array subscript, the result isn't REALLY a reference, but non-intrinsic functions expect a reference: take address
     210                                                //      // PRINT(
     211                                                //              std::cerr << "===is intrinsic arg in non-intrinsic call - adding address" << std::endl;
     212                                                //      // )
     213                                                //      arg = new AddressExpr( arg );
     214                                                // } else
     215                                                // if ( function->get_linkage() == LinkageSpec::Intrinsic && arg->result->referenceDepth() != 0 ) {
     216                                                if ( function->get_linkage() == LinkageSpec::Intrinsic && InitTweak::getPointerBase( arg->result ) ) {
     217
     218                                                        // needed for definition of prelude functions, etc.
     219
    215220                                                        // argument is a 'real' reference, but function expects a C lvalue: add a dereference to the reference-typed argument
    216221                                                        PRINT(
     
    221226                                                        PointerType * ptrType = new PointerType( Type::Qualifiers(), baseType->clone() );
    222227                                                        delete arg->result;
    223                                                         arg->set_result( ptrType );
     228                                                        arg->result = ptrType;
    224229                                                        arg = mkDeref( arg );
    225                                                         assertf( arg->result->referenceDepth() == 0, "Reference types should have been eliminated from intrinsic function calls, but weren't: %s", toCString( arg->result ) );
     230                                                        // assertf( arg->result->referenceDepth() == 0, "Reference types should have been eliminated from intrinsic function calls, but weren't: %s", toCString( arg->result ) );
    226231                                                }
    227232                                        }
Note: See TracChangeset for help on using the changeset viewer.