Changeset a3f5208a


Ignore:
Timestamp:
Nov 3, 2020, 8:50:30 PM (12 months ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
arm-eh, jacob/cs343-translation, master, new-ast-unique-expr
Children:
7d651a6, c28ea4e, e1d6c8d
Parents:
a2f2fda (diff), 4406887 (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' of plg.uwaterloo.ca:software/cfa/cfa-cc

Files:
13 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/concurrency/io/setup.cfa

    ra2f2fda ra3f5208a  
    276276                        }
    277277                } else {
    278                         unpark( &thrd );
     278                        post( this.thrd.sem );
    279279                }
    280280
  • src/AST/Convert.cpp

    ra2f2fda ra3f5208a  
    2525#include "AST/Init.hpp"
    2626#include "AST/Stmt.hpp"
     27#include "AST/TranslationUnit.hpp"
    2728#include "AST/TypeSubstitution.hpp"
    2829
     
    14041405};
    14051406
    1406 std::list< Declaration * > convert( const std::list< ast::ptr< ast::Decl > > && translationUnit ) {
     1407std::list< Declaration * > convert( const ast::TranslationUnit && translationUnit ) {
    14071408        ConverterNewToOld c;
    14081409        std::list< Declaration * > decls;
    1409         for(auto d : translationUnit) {
     1410        for(auto d : translationUnit.decls) {
    14101411                decls.emplace_back( c.decl( d ) );
    14111412        }
     
    28032804#undef GET_ACCEPT_1
    28042805
    2805 std::list< ast::ptr< ast::Decl > > convert( const std::list< Declaration * > && translationUnit ) {
     2806ast::TranslationUnit convert( const std::list< Declaration * > && translationUnit ) {
    28062807        ConverterOldToNew c;
    2807         std::list< ast::ptr< ast::Decl > > decls;
     2808        ast::TranslationUnit unit;
    28082809        for(auto d : translationUnit) {
    28092810                d->accept( c );
    2810                 decls.emplace_back( c.decl() );
     2811                unit.decls.emplace_back( c.decl() );
    28112812        }
    28122813        deleteAll(translationUnit);
    2813         return decls;
     2814        return unit;
    28142815}
  • src/AST/Convert.hpp

    ra2f2fda ra3f5208a  
    1818#include <list>
    1919
    20 #include "AST/Node.hpp"
    21 
    2220class Declaration;
    2321namespace ast {
    24         class Decl;
     22        class TranslationUnit;
    2523};
    2624
    27 std::list< Declaration * > convert( const std::list< ast::ptr< ast::Decl > > && translationUnit );
    28 std::list< ast::ptr< ast::Decl > > convert( const std::list< Declaration * > && translationUnit );
     25std::list< Declaration * > convert( const ast::TranslationUnit && translationUnit );
     26ast::TranslationUnit convert( const std::list< Declaration * > && translationUnit );
  • src/AST/Fwd.hpp

    ra2f2fda ra3f5208a  
    137137typedef unsigned int UniqueId;
    138138
     139class TranslationUnit;
     140// TODO: Get from the TranslationUnit:
    139141extern Type * sizeType;
    140142extern FunctionDecl * dereferenceOperator;
  • src/AST/Pass.hpp

    ra2f2fda ra3f5208a  
    103103        /// Construct and run a pass on a translation unit.
    104104        template< typename... Args >
    105         static void run( std::list< ptr<Decl> > & decls, Args &&... args ) {
     105        static void run( TranslationUnit & decls, Args &&... args ) {
    106106                Pass<core_t> visitor( std::forward<Args>( args )... );
    107107                accept_all( decls, visitor );
     
    119119        // Versions of the above for older compilers.
    120120        template< typename... Args >
    121         static void run( std::list< ptr<Decl> > & decls ) {
     121        static void run( TranslationUnit & decls ) {
    122122                Pass<core_t> visitor;
    123123                accept_all( decls, visitor );
     
    303303void accept_all( std::list< ast::ptr<ast::Decl> > &, ast::Pass<core_t> & visitor );
    304304
     305template<typename core_t>
     306void accept_all( ast::TranslationUnit &, ast::Pass<core_t> & visitor );
     307
    305308//-------------------------------------------------------------------------------------------------
    306309// PASS ACCESSORIES
  • src/AST/Pass.impl.hpp

    ra2f2fda ra3f5208a  
    2020#include <unordered_map>
    2121
     22#include "AST/TranslationUnit.hpp"
    2223#include "AST/TypeSubstitution.hpp"
    2324
     
    430431        pass_visitor_stats.depth--;
    431432        if ( !errors.isEmpty() ) { throw errors; }
     433}
     434
     435template< typename core_t >
     436inline void ast::accept_all( ast::TranslationUnit & unit, ast::Pass< core_t > & visitor ) {
     437        return ast::accept_all( unit.decls, visitor );
    432438}
    433439
  • src/AST/Pass.proto.hpp

    ra2f2fda ra3f5208a  
    2222template<typename core_t>
    2323class Pass;
     24
     25class TranslationUnit;
    2426
    2527struct PureVisitor;
  • src/InitTweak/FixGlobalInit.cc

    ra2f2fda ra3f5208a  
    109109        }
    110110
    111         void fixGlobalInit(std::list<ast::ptr<ast::Decl>> & translationUnit, bool inLibrary) {
     111        void fixGlobalInit(ast::TranslationUnit & translationUnit, bool inLibrary) {
    112112                ast::Pass<GlobalFixer_new> fixer;
    113113                accept_all(translationUnit, fixer);
     
    119119                                ast::Storage::Static, ast::Linkage::C, {new ast::Attribute("constructor", std::move(ctorParams))});
    120120
    121                         translationUnit.emplace_back( initFunction );
     121                        translationUnit.decls.emplace_back( initFunction );
    122122                } // if
    123123
     
    128128                                ast::Storage::Static, ast::Linkage::C, {new ast::Attribute("destructor", std::move(dtorParams))});
    129129
    130                         translationUnit.emplace_back(destroyFunction);
     130                        translationUnit.decls.emplace_back(destroyFunction);
    131131                } // if
    132132        }
  • src/InitTweak/FixGlobalInit.h

    ra2f2fda ra3f5208a  
    2929        /// function is for library code.
    3030        void fixGlobalInit( std::list< Declaration * > & translationUnit, bool inLibrary );
    31         void fixGlobalInit( std::list< ast::ptr<ast::Decl> > & translationUnit, bool inLibrary );
     31        void fixGlobalInit( ast::TranslationUnit & translationUnit, bool inLibrary );
    3232} // namespace
    3333
  • src/InitTweak/FixInit.h

    ra2f2fda ra3f5208a  
    1919#include <string>  // for string
    2020
    21 #include <AST/Fwd.hpp>
    22 
    2321class Declaration;
     22namespace ast {
     23        class TranslationUnit;
     24}
    2425
    2526namespace InitTweak {
     
    2728        void fix( std::list< Declaration * > & translationUnit, bool inLibrary );
    2829
    29         void fix( std::list<ast::ptr<ast::Decl>> & translationUnit, bool inLibrary);
     30        void fix( ast::TranslationUnit & translationUnit, bool inLibrary);
    3031} // namespace
    3132
  • src/InitTweak/FixInitNew.cpp

    ra2f2fda ra3f5208a  
    179179        /// expand each object declaration to use its constructor after it is declared.
    180180        struct FixInit : public ast::WithStmtsToAdd<> {
    181                 static void fixInitializers( std::list< ast::ptr<ast::Decl> > &translationUnit );
     181                static void fixInitializers( ast::TranslationUnit &translationUnit );
    182182
    183183                const ast::DeclWithType * postvisit( const ast::ObjectDecl *objDecl );
     
    225225} // namespace
    226226
    227 void fix( std::list< ast::ptr<ast::Decl> > & translationUnit, bool inLibrary ) {
     227void fix( ast::TranslationUnit & translationUnit, bool inLibrary ) {
    228228        ast::Pass<SelfAssignChecker>::run( translationUnit );
    229229
     
    308308        }
    309309
    310         void FixInit::fixInitializers( std::list< ast::ptr<ast::Decl> > & translationUnit ) {
     310        void FixInit::fixInitializers( ast::TranslationUnit & translationUnit ) {
    311311                ast::Pass<FixInit> fixer;
    312312
     
    314314                // can't use DeclMutator, because sometimes need to insert IfStmt, etc.
    315315                SemanticErrorException errors;
    316                 for ( auto i = translationUnit.begin(); i != translationUnit.end(); ++i ) {
     316                for ( auto i = translationUnit.decls.begin(); i != translationUnit.decls.end(); ++i ) {
    317317                        try {
    318318                                // maybeAccept( *i, fixer ); translationUnit should never contain null
    319319                                *i = (*i)->accept(fixer);
    320                                 translationUnit.splice( i, fixer.core.staticDtorDecls );
     320                                translationUnit.decls.splice( i, fixer.core.staticDtorDecls );
    321321                        } catch( SemanticErrorException &e ) {
    322322                                errors.append( e );
  • src/ResolvExpr/Resolver.cc

    ra2f2fda ra3f5208a  
    12741274        // size_t Resolver_new::traceId = Stats::Heap::new_stacktrace_id("Resolver");
    12751275
    1276         void resolve( std::list< ast::ptr< ast::Decl > >& translationUnit ) {
     1276        void resolve( ast::TranslationUnit& translationUnit ) {
    12771277                ast::Pass< Resolver_new >::run( translationUnit );
    12781278        }
  • src/ResolvExpr/Resolver.h

    ra2f2fda ra3f5208a  
    3535        class StmtExpr;
    3636        class SymbolTable;
     37        class TranslationUnit;
    3738        class Type;
    3839        class TypeEnvironment;
     
    5556
    5657        /// Checks types and binds syntactic constructs to typed representations
    57         void resolve( std::list< ast::ptr<ast::Decl> >& translationUnit );
     58        void resolve( ast::TranslationUnit& translationUnit );
    5859        /// Searches expr and returns the first DeletedExpr found, otherwise nullptr
    5960        const ast::DeletedExpr * findDeletedExpr( const ast::Expr * expr );
     
    6970                const ast::Expr * untyped, const ast::SymbolTable & symtab);
    7071        /// Resolves a constructor init expression
    71         ast::ptr< ast::Init > resolveCtorInit( 
     72        ast::ptr< ast::Init > resolveCtorInit(
    7273                const ast::ConstructorInit * ctorInit, const ast::SymbolTable & symtab );
    7374        /// Resolves a statement expression
    74         ast::ptr< ast::Expr > resolveStmtExpr( 
     75        ast::ptr< ast::Expr > resolveStmtExpr(
    7576                const ast::StmtExpr * stmtExpr, const ast::SymbolTable & symtab );
    7677} // namespace ResolvExpr
Note: See TracChangeset for help on using the changeset viewer.