Changeset d3652df


Ignore:
Timestamp:
Oct 8, 2023, 10:31:26 AM (7 months ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
4817662
Parents:
be8ee65
Message:

Took the new EraseWith? pass out of the box pass. It might be able to go even earlier or folded into an existing pass. C code generation now will not generate WithStmt? nodes.

Location:
src
Files:
2 added
4 edited

Legend:

Unmodified
Added
Removed
  • src/CodeGen/CodeGenerator.cc

    rbe8ee65 rd3652df  
    11571157
    11581158        void CodeGenerator::postvisit( WithStmt * with ) {
    1159                 if ( ! options.genC ) {
    1160                         output << "with ( ";
    1161                         genCommaList( with->exprs.begin(), with->exprs.end() );
    1162                         output << " ) ";
    1163                 }
     1159                assertf( ! options.genC, "WithStmts should not reach code generation." );
     1160
     1161                output << "with ( ";
     1162                genCommaList( with->exprs.begin(), with->exprs.end() );
     1163                output << " ) ";
    11641164                with->stmt->accept( *visitor );
    11651165        }
  • src/GenPoly/BoxNew.cpp

    rbe8ee65 rd3652df  
    17261726
    17271727// --------------------------------------------------------------------------
    1728 // TODO: This is kind of a blind test. I believe all withExprs are handled
    1729 // in the resolver and we could clear them out after that.
    1730 struct RemoveWithExprs final {
    1731         ast::FunctionDecl const * postvisit( ast::FunctionDecl const * decl ) {
    1732                 if ( decl->withExprs.empty() ) return decl;
    1733                 auto mutDecl = mutate( decl );
    1734                 mutDecl->withExprs.clear();
    1735                 return mutDecl;
    1736         }
    1737 };
    1738 
    1739 // --------------------------------------------------------------------------
    17401728/// Inserts code to access polymorphic layout inforation.
    17411729/// * Replaces member and size/alignment/offsetof expressions on polymorphic
     
    25112499        ast::Pass<DeclAdapter>::run( translationUnit );
    25122500        ast::Pass<RewireAdapters>::run( translationUnit );
    2513         ast::Pass<RemoveWithExprs>::run( translationUnit );
    25142501        ast::Pass<PolyGenericCalculator>::run( translationUnit );
    25152502        ast::Pass<Eraser>::run( translationUnit );
  • src/ResolvExpr/module.mk

    rbe8ee65 rd3652df  
    7272        ResolvExpr/AlternativePrinter.h \
    7373        ResolvExpr/CandidatePrinter.cpp \
    74         ResolvExpr/CandidatePrinter.hpp
     74        ResolvExpr/CandidatePrinter.hpp \
     75        ResolvExpr/EraseWith.cpp \
     76        ResolvExpr/EraseWith.hpp
    7577
    7678SRCDEMANGLE += $(SRC_RESOLVEXPR)
  • src/main.cc

    rbe8ee65 rd3652df  
    6262#include "Parser/RunParser.hpp"             // for buildList, dumpParseTree,...
    6363#include "ResolvExpr/CandidatePrinter.hpp"  // for printCandidates
     64#include "ResolvExpr/EraseWith.hpp"         // for eraseWith
    6465#include "ResolvExpr/Resolver.h"            // for resolve
    6566#include "SynTree/LinkageSpec.h"            // for Spec, Cforall, Intrinsic
     
    396397
    397398                PASS( "Fix Init", InitTweak::fix, transUnit, buildingLibrary() );
     399                PASS( "Erase With", ResolvExpr::eraseWith, transUnit );
    398400
    399401                // fix ObjectDecl - replaces ConstructorInit nodes
Note: See TracChangeset for help on using the changeset viewer.