Changeset b82d140 for src/AST


Ignore:
Timestamp:
Nov 10, 2020, 12:44:44 PM (5 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
080b0a1, 883c4d9, f33eab7
Parents:
82a2fed (diff), cdacb73 (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

Location:
src/AST
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    r82a2fed rb82d140  
    27642764                        old->location,
    27652765                        GET_ACCEPT_1(value, Expr),
    2766                         (old->get_maybeConstructed()) ? ast::MaybeConstruct : ast::DoConstruct
     2766                        (old->get_maybeConstructed()) ? ast::MaybeConstruct : ast::NoConstruct
    27672767                );
    27682768        }
     
    27732773                        GET_ACCEPT_V(initializers, Init),
    27742774                        GET_ACCEPT_V(designations, Designation),
    2775                         (old->get_maybeConstructed()) ? ast::MaybeConstruct : ast::DoConstruct
     2775                        (old->get_maybeConstructed()) ? ast::MaybeConstruct : ast::NoConstruct
    27762776                );
    27772777        }
  • src/AST/Decl.hpp

    r82a2fed rb82d140  
    7979        ptr<Expr> asmName;
    8080        bool isDeleted = false;
     81        bool isTypeFixed = false;
    8182
    8283        DeclWithType( const CodeLocation& loc, const std::string& name, Storage::Classes storage,
  • src/AST/Init.hpp

    r82a2fed rb82d140  
    5050
    5151/// Flag for whether to construct from initialzier
    52 enum ConstructFlag { DoConstruct, MaybeConstruct };
     52enum ConstructFlag { NoConstruct, MaybeConstruct };
    5353
    5454/// Object initializer base class
     
    7171        ptr<Expr> value;
    7272
    73         SingleInit( const CodeLocation & loc, const Expr * val, ConstructFlag mc = DoConstruct )
     73        SingleInit( const CodeLocation & loc, const Expr * val, ConstructFlag mc = NoConstruct )
    7474        : Init( loc, mc ), value( val ) {}
    7575
     
    9090
    9191        ListInit( const CodeLocation & loc, std::vector<ptr<Init>> && is,
    92                 std::vector<ptr<Designation>> && ds = {}, ConstructFlag mc = DoConstruct );
     92                std::vector<ptr<Designation>> && ds = {}, ConstructFlag mc = NoConstruct );
    9393
    9494        using iterator = std::vector<ptr<Init>>::iterator;
     
    118118        ConstructorInit(
    119119                const CodeLocation & loc, const Stmt * ctor, const Stmt * dtor, const Init * init )
    120         : Init( loc, DoConstruct ), ctor( ctor ), dtor( dtor ), init( init ) {}
     120        : Init( loc, MaybeConstruct ), ctor( ctor ), dtor( dtor ), init( init ) {}
    121121
    122122        const Init * accept( Visitor & v ) const override { return v.visit( this ); }
  • src/AST/Pass.impl.hpp

    r82a2fed rb82d140  
    423423                }
    424424                catch( SemanticErrorException &e ) {
    425                         errors.append( e );
     425                        if (__pass::onError (visitor.core, *i, 0))
     426                                errors.append( e );
    426427                }
    427428
     
    683684                // Do not enter (or leave) a new scope if atFunctionTop. Remember to save the result.
    684685                auto guard1 = makeFuncGuard( [this, enterScope = !this->atFunctionTop]() {
    685                         if ( enterScope ) __pass::symtab::enter(core, 0);
     686                        if ( enterScope ) {
     687                                __pass::symtab::enter(core, 0);
     688                                __pass::scope::enter(core, 0);
     689                        }
    686690                }, [this, leaveScope = !this->atFunctionTop]() {
    687                         if ( leaveScope ) __pass::symtab::leave(core, 0);
     691                        if ( leaveScope ) {
     692                                __pass::symtab::leave(core, 0);
     693                                __pass::scope::leave(core, 0);
     694                        }
    688695                });
    689696                ValueGuard< bool > guard2( atFunctionTop );
  • src/AST/Pass.proto.hpp

    r82a2fed rb82d140  
    266266        static void endTrace(core_t &, long) {}
    267267
     268        // Allows visitor to handle an error on top-level declarations, and possibly suppress the error.
     269        // If onError() returns false, the error will be ignored. By default, it returns true.
     270
     271        template< typename core_t >
     272        static bool onError (core_t &, ptr<Decl> &, long) { return true; }
     273
     274        template< typename core_t >
     275        static auto onError (core_t & core, ptr<Decl> & decl, int) -> decltype(core.onError(decl)) {
     276                return core.onError(decl);
     277        }
     278
    268279        // Another feature of the templated visitor is that it calls beginScope()/endScope() for compound statement.
    269280        // All passes which have such functions are assumed desire this behaviour
  • src/AST/Type.cpp

    r82a2fed rb82d140  
    211211        for ( const Type * ty : types ) {
    212212                members.emplace_back( new ObjectDecl{
    213                         CodeLocation{}, "", ty, new ListInit( CodeLocation{}, {}, {}, MaybeConstruct ),
     213                        CodeLocation{}, "", ty, new ListInit( CodeLocation{}, {}, {}, NoConstruct ),
    214214                        Storage::Classes{}, Linkage::Cforall } );
    215215        }
Note: See TracChangeset for help on using the changeset viewer.