Changeset 893e106


Ignore:
Timestamp:
May 22, 2019, 5:23:02 PM (5 years ago)
Author:
Aaron Moss <a3moss@…>
Branches:
ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
722c4831
Parents:
76ed81f (diff), ef5ef56 (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:
6 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    r76ed81f r893e106  
    13421342};
    13431343
    1344 std::list< Declaration * > convert( std::list< ast::ptr< ast::Decl > > && translationUnit ) {
     1344std::list< Declaration * > convert( const std::list< ast::ptr< ast::Decl > > && translationUnit ) {
    13451345        ConverterNewToOld c;
    13461346        std::list< Declaration * > decls;
    13471347        for(auto d : translationUnit) {
    13481348                decls.emplace_back( c.decl( d ) );
    1349                 delete d;
    13501349        }
    13511350        return decls;
     
    14361435                        { old->get_funcSpec().val }
    14371436                );
     1437                cache.emplace( old, decl );
    14381438                decl->scopeLevel = old->scopeLevel;
    14391439                decl->mangleName = old->mangleName;
     
    14411441                decl->uniqueId   = old->uniqueId;
    14421442                decl->extension  = old->extension;
    1443                 cache.emplace( old, decl );
    14441443
    14451444                this->node = decl;
     
    14581457                        { old->get_funcSpec().val }
    14591458                };
     1459                cache.emplace( old, decl );
    14601460                decl->scopeLevel = old->scopeLevel;
    14611461                decl->mangleName = old->mangleName;
     
    14631463                decl->uniqueId   = old->uniqueId;
    14641464                decl->extension  = old->extension;
    1465                 cache.emplace( old, decl );
    14661465
    14671466                this->node = decl;
     
    14771476                        { old->linkage.val }
    14781477                );
     1478                cache.emplace( old, decl );
    14791479                decl->parent = GET_ACCEPT_1(parent, AggregateDecl);
    14801480                decl->body   = old->body;
     
    14841484                decl->uniqueId   = old->uniqueId;
    14851485                decl->storage    = { old->storageClasses.val };
    1486                 cache.emplace( old, decl );
    14871486
    14881487                this->node = decl;
     
    14971496                        { old->linkage.val }
    14981497                );
     1498                cache.emplace( old, decl );
    14991499                decl->parent = GET_ACCEPT_1(parent, AggregateDecl);
    15001500                decl->body   = old->body;
     
    15041504                decl->uniqueId   = old->uniqueId;
    15051505                decl->storage    = { old->storageClasses.val };
    1506                 cache.emplace( old, decl );
    15071506
    15081507                this->node = decl;
     
    15171516                        { old->linkage.val }
    15181517                );
     1518                cache.emplace( old, decl );
    15191519                decl->parent = GET_ACCEPT_1(parent, AggregateDecl);
    15201520                decl->body   = old->body;
     
    15241524                decl->uniqueId   = old->uniqueId;
    15251525                decl->storage    = { old->storageClasses.val };
    1526                 cache.emplace( old, decl );
    15271526
    15281527                this->node = decl;
     
    15371536                        { old->linkage.val }
    15381537                );
     1538                cache.emplace( old, decl );
    15391539                decl->parent = GET_ACCEPT_1(parent, AggregateDecl);
    15401540                decl->body   = old->body;
     
    15441544                decl->uniqueId   = old->uniqueId;
    15451545                decl->storage    = { old->storageClasses.val };
    1546                 cache.emplace( old, decl );
    15471546
    15481547                this->node = decl;
     
    15601559                        GET_ACCEPT_1(init, Type)
    15611560                };
     1561                cache.emplace( old, decl );
    15621562                decl->assertions = GET_ACCEPT_V(assertions, DeclWithType);
    15631563                decl->params     = GET_ACCEPT_V(parameters, TypeDecl);
    15641564                decl->extension  = old->extension;
    15651565                decl->uniqueId   = old->uniqueId;
    1566                 cache.emplace( old, decl );
    15671566
    15681567                this->node = decl;
     
    19121911        ast::TypeSubstitution * convertTypeSubstitution(const TypeSubstitution * old) {
    19131912
     1913                if (!old) return nullptr;
     1914
    19141915                ast::TypeSubstitution *rslt = new ast::TypeSubstitution();
    19151916
     
    27032704                d->accept( c );
    27042705                decls.emplace_back( c.decl() );
    2705                 delete d;
    2706         }
     2706        }
     2707        deleteAll(translationUnit);
    27072708        return decls;
    27082709}
  • src/AST/Expr.cpp

    r76ed81f r893e106  
    159159        assert( aggregate->result );
    160160
     161<<<<<<< HEAD
    161162        // #warning Needs GenericSubsitution.cpp building to work correctly
    162163        // result.set_and_mutate( mem->get_type() )->qualifiers |= aggregate->result->qualifiers | CV::Lvalue;  // FIXME temporary patch
     
    168169        // ensure lvalue and appropriate restrictions from aggregate type
    169170        result.get_and_mutate()->qualifiers |= aggregate->result->qualifiers | CV::Lvalue;
     171=======
     172//      assert(!"unimplemented; need TypeSubstitution, genericSubstitution");
     173>>>>>>> ef5ef56042ce2b547da955746d9986e26cf628ca
    170174}
    171175
  • src/AST/Node.hpp

    r76ed81f r893e106  
    121121        template<typename o_node_t>
    122122        ptr_base & operator=( const o_node_t * node ) {
    123                 assign(strict_dynamic_cast<const node_t *>(node));
     123                assign( node ? strict_dynamic_cast<const node_t *>(node) : nullptr );
    124124                return *this;
    125125        }
  • src/AST/Pass.proto.hpp

    r76ed81f r893e106  
    107107                bool     * m_prev;
    108108                bool_ref * m_ref;
     109        };
     110
     111        template<typename pass_t, typename node_t>
     112        struct is_valid_previsit {
     113                using ret_t = decltype( ((pass_t*)nullptr)->previsit( (const node_t *)nullptr ) );
     114
     115                static constexpr bool value = std::is_void< ret_t >::value ||
     116                        std::is_base_of<const node_t, typename std::remove_pointer<ret_t>::type >::value;
    109117        };
    110118
     
    127135        static inline auto previsit( pass_t & pass, const node_t * & node, int ) -> decltype( pass.previsit( node ), void() ) {
    128136                static_assert(
    129                         std::is_base_of<const node_t, typename std::remove_pointer<decltype( pass.previsit( node ) )>::type >::value,
    130                         "Previsit may not change the type of the node. Use postvisit instead."
     137                        is_valid_previsit<pass_t, node_t>::value,
     138                        "Previsit may not change the type of the node. It must return its paremeter or void."
    131139                );
    132                 node = pass.previsit( node );
    133                 assert(node);
     140                if(std::is_void< decltype( pass.previsit(node) ) >::value) {
     141                        pass.previsit( node );
     142                } else {
     143                        node = pass.previsit( node );
     144                        assert(node);
     145                }
    134146        }
    135147
     
    139151        // PostVisit : never mutates the passed pointer but may return a different node
    140152        template<typename pass_t, typename node_t>
    141         static inline auto postvisit( pass_t & pass, const node_t * node, int ) -> decltype( pass.postvisit( node ), (const node_t *)nullptr ) {
     153        static inline auto postvisit( pass_t & pass, const node_t * node, int ) ->
     154                decltype( pass.postvisit( node ), node->accept( *(Visitor*)nullptr ) )
     155        {
    142156                return pass.postvisit( node );
    143157        }
  • src/Common/utility.h

    r76ed81f r893e106  
    7474
    7575template< typename Container >
    76 void deleteAll( Container &container ) {
    77         for ( typename Container::iterator i = container.begin(); i != container.end(); ++i ) {
    78                 delete *i;
     76void deleteAll( const Container &container ) {
     77        for ( const auto &i : container ) {
     78                delete i;
    7979        } // for
    8080}
  • src/include/cassert

    r76ed81f r893e106  
    4444
    4545template<typename T, typename U>
    46 static inline T strict_dynamic_cast( const U & src ) {
     46static inline __attribute__((nonnull)) T strict_dynamic_cast( const U & src ) {
     47        assert(src);
    4748        T ret = dynamic_cast<T>(src);
    4849        assertf(ret, "%s", toString(src).c_str());
Note: See TracChangeset for help on using the changeset viewer.