Ignore:
Timestamp:
Jul 31, 2017, 5:30:11 PM (4 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, cleanup-dtors, deferred_resn, demangler, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, resolv-new, with_gc
Children:
641c3d0
Parents:
61e2761
Message:

convert to implicit check for != 0

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/InitializerNode.cc

    r61e2761 r1131392  
    1010// Created On       : Sat May 16 13:20:24 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sat Oct  1 23:09:51 2016
    13 // Update Count     : 21
     12// Last Modified On : Fri Jul 28 23:27:20 2017
     13// Update Count     : 26
    1414//
    1515
     
    2222#include "SynTree/Initializer.h"
    2323
    24 InitializerNode::InitializerNode( ExpressionNode *_expr, bool aggrp, ExpressionNode *des )
    25                 : expr( _expr ), aggregate( aggrp ), designator( des ), kids( 0 ), maybeConstructed( true ) {
     24InitializerNode::InitializerNode( ExpressionNode * _expr, bool aggrp, ExpressionNode * des )
     25                : expr( _expr ), aggregate( aggrp ), designator( des ), kids( nullptr ), maybeConstructed( true ) {
    2626        if ( aggrp )
    2727                kids = dynamic_cast< InitializerNode * >( get_next() );
    2828
    29         if ( kids != 0 )
    30                 set_last( 0 );
    31 }
     29        if ( kids )
     30                set_last( nullptr );
     31} // InitializerNode::InitializerNode
    3232
    33 InitializerNode::InitializerNode( InitializerNode *init, bool aggrp, ExpressionNode *des )
    34                 : expr( 0 ), aggregate( aggrp ), designator( des ), kids( 0 ), maybeConstructed( true ) {
    35         if ( init != 0 )
     33InitializerNode::InitializerNode( InitializerNode * init, bool aggrp, ExpressionNode * des )
     34                : expr( nullptr ), aggregate( aggrp ), designator( des ), kids( nullptr ), maybeConstructed( true ) {
     35        if ( init )
    3636                set_last( init );
    3737
     
    3939                kids = dynamic_cast< InitializerNode * >( get_next() );
    4040
    41         if ( kids != 0 )
    42                 set_next( 0 );
    43 }
     41        if ( kids )
     42                set_next( nullptr );
     43} // InitializerNode::InitializerNode
    4444
    4545InitializerNode::~InitializerNode() {
     
    4747        delete designator;
    4848        delete kids;
    49 }
     49} // InitializerNode::~InitializerNode
    5050
    5151void InitializerNode::print( std::ostream &os, int indent ) const {
    5252        os << std::string( indent, ' ' ) << "Initializer expression" << std::endl;
    53 }
     53} // InitializerNode::print
    5454
    5555void InitializerNode::printOneLine( std::ostream &os ) const {
    5656        if ( ! aggregate ) {
    57                 if ( designator != 0 ) {
     57                if ( designator ) {
    5858                        os << "designated by: (";
    5959                        ExpressionNode *curdes = designator;
    60                         while ( curdes != 0) {
     60                        while ( curdes != nullptr) {
    6161                                curdes->printOneLine(os);
    6262                                curdes = (ExpressionNode *)(curdes->get_next());
     
    6565                        os << ")";
    6666                } // if
    67                 if ( expr ) expr->printOneLine(os);
     67                if ( expr ) expr->printOneLine( os );
    6868        } else {  // It's an aggregate
    6969                os << "[--";
    70                 if ( next_init() != 0 )
    71                         next_init()->printOneLine(os);
     70                if ( next_init() != nullptr )
     71                        next_init()->printOneLine( os );
    7272                if (aggregate) os << "--]";
    7373        } // if
     
    7676        if ( (moreInit = dynamic_cast< InitializerNode * >( get_next() ) ) ) {
    7777                moreInit->printOneLine( os );
    78         }
    79 }
     78        } // if
     79} // InitializerNode::printOneLine
    8080
    81 Initializer *InitializerNode::build() const {
     81Initializer * InitializerNode::build() const {
    8282        if ( aggregate ) {
    8383                // steal designators from children
     
    9393                return new ListInit( initlist, designlist, maybeConstructed );
    9494        } else {
    95                 if ( get_expression() != 0) {
     95                if ( get_expression() ) {
    9696                        return new SingleInit( maybeBuild< Expression >( get_expression() ), maybeConstructed );
    97                 }
     97                } // if
    9898        } // if
    99         return 0;
    100 }
     99        return nullptr;
     100} // InitializerNode::build
    101101
    102102// Local Variables: //
Note: See TracChangeset for help on using the changeset viewer.