Changes in src/InitTweak/InitTweak.cc [3351cc0:f5c3b6c]
- File:
-
- 1 edited
-
src/InitTweak/InitTweak.cc (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/InitTweak.cc
r3351cc0 rf5c3b6c 12 12 #include "Parser/LinkageSpec.h" // for Spec, isBuiltin, Intrinsic 13 13 #include "ResolvExpr/typeops.h" // for typesCompatibleIgnoreQualifiers 14 #include "SymTab/Autogen.h" 14 15 #include "SymTab/Indexer.h" // for Indexer 15 16 #include "SynTree/Attribute.h" // for Attribute … … 98 99 class InitExpander::ExpanderImpl { 99 100 public: 100 virtual ~ExpanderImpl() = default;101 101 virtual std::list< Expression * > next( std::list< Expression * > & indices ) = 0; 102 102 virtual Statement * buildListInit( UntypedExpr * callExpr, std::list< Expression * > & indices ) = 0; … … 106 106 public: 107 107 InitImpl( Initializer * init ) : init( init ) {} 108 virtual ~InitImpl() = default;109 108 110 109 virtual std::list< Expression * > next( __attribute((unused)) std::list< Expression * > & indices ) { … … 123 122 public: 124 123 ExprImpl( Expression * expr ) : arg( expr ) {} 125 virtual ~ExprImpl() { delete arg; } 124 125 ~ExprImpl() { delete arg; } 126 126 127 127 virtual std::list< Expression * > next( std::list< Expression * > & indices ) { … … 524 524 } 525 525 526 ApplicationExpr * createBitwiseAssignment( Expression * dst, Expression * src ) { 527 static FunctionDecl * assign = nullptr; 528 if ( ! assign ) { 529 // temporary? Generate a fake assignment operator to represent bitwise assignments. 530 // This operator could easily exist as a real function, but it's tricky because nothing should resolve to this function. 531 TypeDecl * td = new TypeDecl( "T", noStorageClasses, nullptr, TypeDecl::Dtype, true ); 532 assign = new FunctionDecl( "?=?", noStorageClasses, LinkageSpec::Intrinsic, SymTab::genAssignType( new TypeInstType( noQualifiers, td->name, td ) ), nullptr ); 533 } 534 if ( dynamic_cast< ReferenceType * >( dst->result ) ) { 535 dst = new AddressExpr( dst ); 536 } else { 537 dst = new CastExpr( dst, new ReferenceType( noQualifiers, dst->result->clone() ) ); 538 } 539 if ( dynamic_cast< ReferenceType * >( src->result ) ) { 540 src = new CastExpr( src, new ReferenceType( noQualifiers, src->result->stripReferences()->clone() ) ); 541 } 542 return new ApplicationExpr( VariableExpr::functionPointer( assign ), { dst, src } ); 543 } 544 526 545 class ConstExprChecker : public Visitor { 527 546 public:
Note:
See TracChangeset
for help on using the changeset viewer.