Changes in / [893e106:76ed81f]


Ignore:
Location:
src
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    r893e106 r76ed81f  
    13421342};
    13431343
    1344 std::list< Declaration * > convert( const std::list< ast::ptr< ast::Decl > > && translationUnit ) {
     1344std::list< Declaration * > convert( 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;
    13491350        }
    13501351        return decls;
     
    14351436                        { old->get_funcSpec().val }
    14361437                );
    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 );
    14431444
    14441445                this->node = decl;
     
    14571458                        { old->get_funcSpec().val }
    14581459                };
    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 );
    14651466
    14661467                this->node = decl;
     
    14761477                        { old->linkage.val }
    14771478                );
    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 );
    14861487
    14871488                this->node = decl;
     
    14961497                        { old->linkage.val }
    14971498                );
    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 );
    15061507
    15071508                this->node = decl;
     
    15161517                        { old->linkage.val }
    15171518                );
    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 );
    15261527
    15271528                this->node = decl;
     
    15361537                        { old->linkage.val }
    15371538                );
    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 );
    15461547
    15471548                this->node = decl;
     
    15591560                        GET_ACCEPT_1(init, Type)
    15601561                };
    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 );
    15661567
    15671568                this->node = decl;
     
    19111912        ast::TypeSubstitution * convertTypeSubstitution(const TypeSubstitution * old) {
    19121913
    1913                 if (!old) return nullptr;
    1914 
    19151914                ast::TypeSubstitution *rslt = new ast::TypeSubstitution();
    19161915
     
    27042703                d->accept( c );
    27052704                decls.emplace_back( c.decl() );
    2706         }
    2707         deleteAll(translationUnit);
     2705                delete d;
     2706        }
    27082707        return decls;
    27092708}
  • src/AST/Expr.cpp

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

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

    r893e106 r76ed81f  
    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;
    117109        };
    118110
     
    135127        static inline auto previsit( pass_t & pass, const node_t * & node, int ) -> decltype( pass.previsit( node ), void() ) {
    136128                static_assert(
    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."
     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."
    139131                );
    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                 }
     132                node = pass.previsit( node );
     133                assert(node);
    146134        }
    147135
     
    151139        // PostVisit : never mutates the passed pointer but may return a different node
    152140        template<typename pass_t, typename node_t>
    153         static inline auto postvisit( pass_t & pass, const node_t * node, int ) ->
    154                 decltype( pass.postvisit( node ), node->accept( *(Visitor*)nullptr ) )
    155         {
     141        static inline auto postvisit( pass_t & pass, const node_t * node, int ) -> decltype( pass.postvisit( node ), (const node_t *)nullptr ) {
    156142                return pass.postvisit( node );
    157143        }
  • src/Common/utility.h

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

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