Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/InitTweak.cc

    r29bc63e re3e16bc  
     1#include <stddef.h>                // for NULL
    12#include <algorithm>               // for find, all_of
    23#include <cassert>                 // for assertf, assert, strict_dynamic_cast
     
    2223#include "SynTree/Type.h"          // for FunctionType, ArrayType, PointerType
    2324#include "SynTree/Visitor.h"       // for Visitor, maybeAccept
    24 #include "Tuples/Tuples.h"         // for Tuples::isTtype
    2525
    2626class UntypedValofExpr;
     
    184184                        callExpr->get_args().splice( callExpr->get_args().end(), args );
    185185
    186                         *out++ = new IfStmt( noLabels, cond, new ExprStmt( noLabels, callExpr ), nullptr );
     186                        *out++ = new IfStmt( noLabels, cond, new ExprStmt( noLabels, callExpr ), NULL );
    187187
    188188                        UntypedExpr * increment = new UntypedExpr( new NameExpr( "++?" ) );
     
    250250        // To accomplish this, generate switch statement, consuming all of expander's elements
    251251        Statement * InitImpl::buildListInit( UntypedExpr * dst, std::list< Expression * > & indices ) {
    252                 if ( ! init ) return nullptr;
     252                if ( ! init ) return NULL;
    253253                CompoundStmt * block = new CompoundStmt( noLabels );
    254254                build( dst, indices.begin(), indices.end(), init, back_inserter( block->get_kids() ) );
    255255                if ( block->get_kids().empty() ) {
    256256                        delete block;
    257                         return nullptr;
     257                        return NULL;
    258258                } else {
    259                         init = nullptr; // init was consumed in creating the list init
     259                        init = NULL; // init was consumed in creating the list init
    260260                        return block;
    261261                }
    262262        }
    263263
    264         Statement * ExprImpl::buildListInit( UntypedExpr *, std::list< Expression * > & ) {
    265                 return nullptr;
     264        Statement * ExprImpl::buildListInit( __attribute((unused)) UntypedExpr * dst, __attribute((unused)) std::list< Expression * > & indices ) {
     265                return NULL;
    266266        }
    267267
     
    270270        }
    271271
    272         bool tryConstruct( DeclarationWithType * dwt ) {
    273                 ObjectDecl * objDecl = dynamic_cast< ObjectDecl * >( dwt );
    274                 if ( ! objDecl ) return false;
     272        bool tryConstruct( ObjectDecl * objDecl ) {
    275273                return ! LinkageSpec::isBuiltin( objDecl->get_linkage() ) &&
    276                         (objDecl->get_init() == nullptr ||
    277                                 ( objDecl->get_init() != nullptr && objDecl->get_init()->get_maybeConstructed() ))
    278                         && ! objDecl->get_storageClasses().is_extern
    279                         && isConstructable( objDecl->type );
    280         }
    281 
    282         bool isConstructable( Type * type ) {
    283                 return ! dynamic_cast< VarArgsType * >( type ) && ! dynamic_cast< ReferenceType * >( type ) && ! dynamic_cast< FunctionType * >( type ) && ! Tuples::isTtype( type );
     274                        (objDecl->get_init() == NULL ||
     275                                ( objDecl->get_init() != NULL && objDecl->get_init()->get_maybeConstructed() ))
     276                        && ! objDecl->get_storageClasses().is_extern;
    284277        }
    285278
     
    321314                collectCtorDtorCalls( stmt, matches );
    322315                assert( matches.size() <= 1 );
    323                 return matches.size() == 1 ? matches.front() : nullptr;
     316                return matches.size() == 1 ? matches.front() : NULL;
    324317        }
    325318
     
    366359        ApplicationExpr * isIntrinsicCallExpr( Expression * expr ) {
    367360                ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr );
    368                 if ( ! appExpr ) return nullptr;
     361                if ( ! appExpr ) return NULL;
    369362                DeclarationWithType * function = getCalledFunction( appExpr->get_function() );
    370363                assertf( function, "getCalledFunction returned nullptr: %s", toString( appExpr->get_function() ).c_str() );
    371364                // check for Intrinsic only - don't want to remove all overridable ctor/dtors because autogenerated ctor/dtor
    372365                // will call all member dtors, and some members may have a user defined dtor.
    373                 return function->get_linkage() == LinkageSpec::Intrinsic ? appExpr : nullptr;
     366                return function->get_linkage() == LinkageSpec::Intrinsic ? appExpr : NULL;
    374367        }
    375368
     
    489482                        return refType->get_base();
    490483                } else {
    491                         return nullptr;
     484                        return NULL;
    492485                }
    493486        }
     
    495488        Type * isPointerType( Type * type ) {
    496489                if ( getPointerBase( type ) ) return type;
    497                 else return nullptr;
     490                else return NULL;
    498491        }
    499492
Note: See TracChangeset for help on using the changeset viewer.