Changeset f9a7cf0 for src


Ignore:
Timestamp:
Jun 10, 2019, 1:48:33 PM (5 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
6949c45
Parents:
2d11663 (diff), 6e3e0717 (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
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    r2d11663 rf9a7cf0  
    1010// Created On       : Thu May 09 15::37::05 2019
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Thu May 06 19:51:00 2019
    13 // Update Count     : 10
     12// Last Modified On : Man Jun 10 11:51:00 2019
     13// Update Count     : 11
    1414//
    1515
     
    9292
    9393        Label makeLabel(Statement * labelled, const ast::Label& label) {
     94                // This probably will leak memory, but only until we get rid of the old tree.
     95                if ( nullptr == labelled && label.location.isSet() ) {
     96                        labelled = new NullStmt();
     97                        labelled->location = label.location;
     98                }
    9499                return Label(
    95100                        label.name,
     
    154159                auto&& attr = get<Attribute>().acceptL( node->attributes );
    155160                if ( inCache( node ) ) {
    156                         if(node->name == "tmp") {
    157                                 std::cerr << (void*)node << "(new) in cache " << (void*)this->node << "(old)" << std::endl;
    158                         }
    159161                        return nullptr;
    160162                }
     
    169171                        Type::FuncSpecifiers( node->funcSpec.val )
    170172                );
    171                 if(node->name == "tmp") {
    172                         std::cerr << (void*)node << "(new) created " << (void*)decl << "(old)" << std::endl;
    173                 }
    174173                return declWithTypePostamble( decl, node );
    175174        }
     
    13901389        // Local Utilities:
    13911390
    1392         #define construct(T, key, ...) ({ \
    1393                 void * data = ::operator new(sizeof(T)); \
    1394                 cache.emplace( key, (T*)data ); \
    1395                 new (data) T( __VA_ARGS__ ); \
    1396         })
    1397 
    13981391        template<typename NewT, typename OldT>
    13991392        NewT * getAccept1( OldT old ) {
     
    14091402
    14101403        template<typename NewT, typename OldC>
    1411         std::vector< ast::ptr<NewT> > getAcceptV( OldC& old ) {
     1404        std::vector< ast::ptr<NewT> > getAcceptV( const OldC& old ) {
    14121405                std::vector< ast::ptr<NewT> > ret;
    14131406                ret.reserve( old.size() );
     
    14221415#       define GET_ACCEPT_V(child, type) \
    14231416                getAcceptV< ast::type, decltype( old->child ) >( old->child )
    1424        
     1417
    14251418        template<typename NewT, typename OldC>
    1426         std::deque< ast::ptr<NewT> > getAcceptD( OldC& old ) {
     1419        std::deque< ast::ptr<NewT> > getAcceptD( const OldC& old ) {
    14271420                std::deque< ast::ptr<NewT> > ret;
    14281421                for ( auto a : old ) {
     
    14371430                getAcceptD< ast::type, decltype( old->child ) >( old->child )
    14381431
    1439         ast::Label make_label(Label* old) {
     1432        ast::Label make_label(const Label* old) {
     1433                CodeLocation const & location =
     1434                    ( old->labelled ) ? old->labelled->location : CodeLocation();
    14401435                return ast::Label(
    1441                         old->labelled->location,
     1436                        location,
    14421437                        old->name,
    14431438                        GET_ACCEPT_V(attributes, Attribute)
     
    14701465
    14711466        virtual void visit( ObjectDecl * old ) override final {
    1472                 if( old->name == "tmp" ) {
    1473                         std::cerr << "building parameters for" << (void*)old << std::endl;
    1474                 }
    14751467                auto&& type = GET_ACCEPT_1(type, Type);
    14761468                auto&& init = GET_ACCEPT_1(init, Init);
    14771469                auto&& bfwd = GET_ACCEPT_1(bitfieldWidth, Expr);
    14781470                auto&& attr = GET_ACCEPT_V(attributes, Attribute);
    1479                 if( old->name == "tmp" ) {
    1480                         std::cerr << "checking cache for " << (void*)old << std::endl;
    1481                 }
    14821471                if ( inCache( old ) ) {
    1483                         if( old->name == "tmp" ) {
    1484                                 std::cerr << (void*)old << "(old) in cache " << (void*)this->node << "(new)" << std::endl;
    1485                         }
    14861472                        return;
    14871473                }
     
    14981484                );
    14991485                cache.emplace(old, decl);
    1500                 if( old->name == "tmp" ) {
    1501                         std::cerr << (void*)old << "(old) added to cache with " << (void*)decl << "(new)" << std::endl;
    1502                 }
    15031486                assert(cache.find( old ) != cache.end());
    15041487                decl->scopeLevel = old->scopeLevel;
     
    15091492
    15101493                this->node = decl;
    1511 
    1512                 if( old->name == "tmp" ) {
    1513                         std::cerr << (void*)old << "(old) created " << (void*)this->node << "(new)" << std::endl;
    1514                 }
    15151494        }
    15161495
     
    18271806                        }
    18281807
    1829                         Label label = old->originalTarget;
    18301808                        auto stmt = new ast::BranchStmt(
    18311809                                old->location,
    18321810                                kind,
    1833                                 make_label(&label),
     1811                                make_label(&old->originalTarget),
    18341812                                GET_LABELS_V(old->labels)
    18351813                        );
  • src/AST/Pass.hpp

    r2d11663 rf9a7cf0  
    262262/// Used to restore values/functions/etc. when the Pass finishes visiting this node
    263263class WithGuards {
    264         __pass::at_cleanup_t at_cleanup;
    265 
     264        __pass::at_cleanup_t at_cleanup = [](__pass::cleanup_func_t, void*) {
     265                std::cerr << "No cleanup function was set" << std::endl;
     266                abort();
     267        };
     268
     269        template< typename pass_t>
     270        friend auto __pass::at_cleanup( pass_t & pass, int ) -> decltype( &pass.at_cleanup );
    266271public:
     272
    267273        /// When this node is finished being visited, restore the value of a variable
    268274        template< typename T >
  • src/Parser/parser.yy

    r2d11663 rf9a7cf0  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May 15 21:25:27 2019
    13 // Update Count     : 4296
     12// Last Modified On : Tue May 28 17:06:37 2019
     13// Update Count     : 4354
    1414//
    1515
     
    278278%token OTYPE FTYPE DTYPE TTYPE TRAIT                                    // CFA
    279279%token SIZEOF OFFSETOF
     280// %token SUSPEND RESUME                                                                        // CFA
    280281%token ATTRIBUTE EXTENSION                                                              // GCC
    281282%token IF ELSE SWITCH CASE DEFAULT DO WHILE FOR BREAK CONTINUE GOTO RETURN
     
    482483%precedence '}'
    483484%precedence '('
     485
     486// %precedence RESUME
     487// %precedence '{'
     488// %precedence ')'
    484489
    485490%locations                                                                                              // support location tracking for error messages
     
    599604                        $$ = new ExpressionNode( $5 );
    600605                }
     606        // | RESUME '(' comma_expression ')'
     607        //      { SemanticError( yylloc, "Resume expression is currently unimplemented." ); $$ = nullptr; }
     608        // | RESUME '(' comma_expression ')' compound_statement
     609        //      { SemanticError( yylloc, "Resume expression is currently unimplemented." ); $$ = nullptr; }
    601610        ;
    602611
     
    12631272        | RETURN comma_expression_opt ';'
    12641273                { $$ = new StatementNode( build_return( $2 ) ); }
    1265         | RETURN '{' initializer_list_opt comma_opt '}'
     1274        | RETURN '{' initializer_list_opt comma_opt '}' ';'
    12661275                { SemanticError( yylloc, "Initializer return is currently unimplemented." ); $$ = nullptr; }
     1276        // | SUSPEND ';'
     1277        //      { SemanticError( yylloc, "Suspend expression is currently unimplemented." ); $$ = nullptr; }
     1278        // | SUSPEND compound_statement ';'
     1279        //      { SemanticError( yylloc, "Suspend expression is currently unimplemented." ); $$ = nullptr; }
    12671280        | THROW assignment_expression_opt ';'                           // handles rethrow
    12681281                { $$ = new StatementNode( build_throw( $2 ) ); }
     
    21582171
    21592172bit_subrange_size:
    2160         ':' constant_expression
     2173        ':' assignment_expression
    21612174                { $$ = $2; }
    21622175        ;
  • src/main.cc

    r2d11663 rf9a7cf0  
    1010// Created On       : Fri May 15 23:12:02 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Jun  5 13:48:41 2019
    13 // Update Count     : 600
     12// Last Modified On : Wed Jun  5 20:35:13 2019
     13// Update Count     : 601
    1414//
    1515
     
    162162        backtrace( 6 );                                                                         // skip first 6 stack frames
    163163        signal( SIGABRT, SIG_DFL);                                                      // reset default signal handler
    164                 raise( SIGABRT );                                                                       // reraise SIGABRT
     164        raise( SIGABRT );                                                                       // reraise SIGABRT
    165165} // sigAbortHandler
    166166
Note: See TracChangeset for help on using the changeset viewer.