Changeset c0d00b6 for src/InitTweak/InitTweak.cc
- Timestamp:
- Nov 25, 2017, 3:22:18 PM (6 years ago)
- 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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/InitTweak.cc
r9d06142 rc0d00b6 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: 101 virtual ~ExpanderImpl() = default; 100 102 virtual std::list< Expression * > next( std::list< Expression * > & indices ) = 0; 101 103 virtual Statement * buildListInit( UntypedExpr * callExpr, std::list< Expression * > & indices ) = 0; … … 105 107 public: 106 108 InitImpl( Initializer * init ) : init( init ) {} 109 virtual ~InitImpl() = default; 107 110 108 111 virtual std::list< Expression * > next( __attribute((unused)) std::list< Expression * > & indices ) { … … 121 124 public: 122 125 ExprImpl( Expression * expr ) : arg( expr ) {} 123 124 ~ExprImpl() { delete arg; } 126 virtual ~ExprImpl() { delete arg; } 125 127 126 128 virtual std::list< Expression * > next( std::list< Expression * > & indices ) { … … 523 525 } 524 526 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 525 546 class ConstExprChecker : public Visitor { 526 547 public:
Note: See TracChangeset
for help on using the changeset viewer.