Changeset 4b8b2a4 for src/InitTweak


Ignore:
Timestamp:
Oct 3, 2022, 1:46:49 PM (2 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
ADT, ast-experimental, master
Children:
890f67a
Parents:
c02cef1
Message:

Make unset locations earier to find with a search for 'CodeLocation?()'.

Location:
src/InitTweak
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    rc02cef1 r4b8b2a4  
    750750                        if ( StructInstType * inst = dynamic_cast< StructInstType * >( t ) ) {
    751751                                // initizer for empty struct must be empty
    752                                 if ( inst->baseStruct->members.empty() ) return new ListInit({});
     752                                if ( inst->baseStruct->members.empty() ) return new ListInit(CodeLocation());
    753753                        } else if ( UnionInstType * inst = dynamic_cast< UnionInstType * >( t ) ) {
    754754                                // initizer for empty union must be empty
    755                                 if ( inst->baseUnion->members.empty() ) return new ListInit({});
     755                                if ( inst->baseUnion->members.empty() ) return new ListInit(CodeLocation());
    756756                        }
    757757
  • src/InitTweak/InitTweak.cc

    rc02cef1 r4b8b2a4  
    881881                static ast::ptr<ast::FunctionDecl> assign = nullptr;
    882882                if (!assign) {
    883                         auto td = new ast::TypeDecl({}, "T", {}, nullptr, ast::TypeDecl::Dtype, true);
    884                         assign = new ast::FunctionDecl({}, "?=?", {},
    885                         { new ast::ObjectDecl({}, "_dst", new ast::ReferenceType(new ast::TypeInstType("T", td))),
    886                           new ast::ObjectDecl({}, "_src", new ast::TypeInstType("T", td))},
    887                         { new ast::ObjectDecl({}, "_ret", new ast::TypeInstType("T", td))}, nullptr, {}, ast::Linkage::Intrinsic);
     883                        auto td = new ast::TypeDecl(CodeLocation(), "T", {}, nullptr, ast::TypeDecl::Dtype, true);
     884                        assign = new ast::FunctionDecl(CodeLocation(), "?=?", {},
     885                        { new ast::ObjectDecl(CodeLocation(), "_dst", new ast::ReferenceType(new ast::TypeInstType("T", td))),
     886                          new ast::ObjectDecl(CodeLocation(), "_src", new ast::TypeInstType("T", td))},
     887                        { new ast::ObjectDecl(CodeLocation(), "_ret", new ast::TypeInstType("T", td))}, nullptr, {}, ast::Linkage::Intrinsic);
    888888                }
    889889                if (dst->result.as<ast::ReferenceType>()) {
Note: See TracChangeset for help on using the changeset viewer.