Ignore:
Timestamp:
Nov 25, 2017, 3:22:18 PM (6 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
c6e2c18
Parents:
9d06142 (diff), 3de176d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into cleanup-dtors

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/InitTweak.cc

    r9d06142 rc0d00b6  
    1212#include "Parser/LinkageSpec.h"    // for Spec, isBuiltin, Intrinsic
    1313#include "ResolvExpr/typeops.h"    // for typesCompatibleIgnoreQualifiers
     14#include "SymTab/Autogen.h"
    1415#include "SymTab/Indexer.h"        // for Indexer
    1516#include "SynTree/Attribute.h"     // for Attribute
     
    9899        class InitExpander::ExpanderImpl {
    99100        public:
     101                virtual ~ExpanderImpl() = default;
    100102                virtual std::list< Expression * > next( std::list< Expression * > & indices ) = 0;
    101103                virtual Statement * buildListInit( UntypedExpr * callExpr, std::list< Expression * > & indices ) = 0;
     
    105107        public:
    106108                InitImpl( Initializer * init ) : init( init ) {}
     109                virtual ~InitImpl() = default;
    107110
    108111                virtual std::list< Expression * > next( __attribute((unused)) std::list< Expression * > & indices ) {
     
    121124        public:
    122125                ExprImpl( Expression * expr ) : arg( expr ) {}
    123 
    124                 ~ExprImpl() { delete arg; }
     126                virtual ~ExprImpl() { delete arg; }
    125127
    126128                virtual std::list< Expression * > next( std::list< Expression * > & indices ) {
     
    523525        }
    524526
     527        ApplicationExpr * createBitwiseAssignment( Expression * dst, Expression * src ) {
     528                static FunctionDecl * assign = nullptr;
     529                if ( ! assign ) {
     530                        // temporary? Generate a fake assignment operator to represent bitwise assignments.
     531                        // This operator could easily exist as a real function, but it's tricky because nothing should resolve to this function.
     532                        TypeDecl * td = new TypeDecl( "T", noStorageClasses, nullptr, TypeDecl::Dtype, true );
     533                        assign = new FunctionDecl( "?=?", noStorageClasses, LinkageSpec::Intrinsic, SymTab::genAssignType( new TypeInstType( noQualifiers, td->name, td ) ), nullptr );
     534                }
     535                if ( dynamic_cast< ReferenceType * >( dst->result ) ) {
     536                        dst = new AddressExpr( dst );
     537                } else {
     538                        dst = new CastExpr( dst, new ReferenceType( noQualifiers, dst->result->clone() ) );
     539                }
     540                if ( dynamic_cast< ReferenceType * >( src->result ) ) {
     541                        src = new CastExpr( src, new ReferenceType( noQualifiers, src->result->stripReferences()->clone() ) );
     542                }
     543                return new ApplicationExpr( VariableExpr::functionPointer( assign ), { dst, src } );
     544        }
     545
    525546        class ConstExprChecker : public Visitor {
    526547        public:
Note: See TracChangeset for help on using the changeset viewer.