Changes in src/InitTweak/InitTweak.cc [29bc63e:e3e16bc]
- File:
-
- 1 edited
-
src/InitTweak/InitTweak.cc (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/InitTweak.cc
r29bc63e re3e16bc 1 #include <stddef.h> // for NULL 1 2 #include <algorithm> // for find, all_of 2 3 #include <cassert> // for assertf, assert, strict_dynamic_cast … … 22 23 #include "SynTree/Type.h" // for FunctionType, ArrayType, PointerType 23 24 #include "SynTree/Visitor.h" // for Visitor, maybeAccept 24 #include "Tuples/Tuples.h" // for Tuples::isTtype25 25 26 26 class UntypedValofExpr; … … 184 184 callExpr->get_args().splice( callExpr->get_args().end(), args ); 185 185 186 *out++ = new IfStmt( noLabels, cond, new ExprStmt( noLabels, callExpr ), nullptr);186 *out++ = new IfStmt( noLabels, cond, new ExprStmt( noLabels, callExpr ), NULL ); 187 187 188 188 UntypedExpr * increment = new UntypedExpr( new NameExpr( "++?" ) ); … … 250 250 // To accomplish this, generate switch statement, consuming all of expander's elements 251 251 Statement * InitImpl::buildListInit( UntypedExpr * dst, std::list< Expression * > & indices ) { 252 if ( ! init ) return nullptr;252 if ( ! init ) return NULL; 253 253 CompoundStmt * block = new CompoundStmt( noLabels ); 254 254 build( dst, indices.begin(), indices.end(), init, back_inserter( block->get_kids() ) ); 255 255 if ( block->get_kids().empty() ) { 256 256 delete block; 257 return nullptr;257 return NULL; 258 258 } else { 259 init = nullptr; // init was consumed in creating the list init259 init = NULL; // init was consumed in creating the list init 260 260 return block; 261 261 } 262 262 } 263 263 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; 266 266 } 267 267 … … 270 270 } 271 271 272 bool tryConstruct( DeclarationWithType * dwt ) { 273 ObjectDecl * objDecl = dynamic_cast< ObjectDecl * >( dwt ); 274 if ( ! objDecl ) return false; 272 bool tryConstruct( ObjectDecl * objDecl ) { 275 273 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; 284 277 } 285 278 … … 321 314 collectCtorDtorCalls( stmt, matches ); 322 315 assert( matches.size() <= 1 ); 323 return matches.size() == 1 ? matches.front() : nullptr;316 return matches.size() == 1 ? matches.front() : NULL; 324 317 } 325 318 … … 366 359 ApplicationExpr * isIntrinsicCallExpr( Expression * expr ) { 367 360 ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr ); 368 if ( ! appExpr ) return nullptr;361 if ( ! appExpr ) return NULL; 369 362 DeclarationWithType * function = getCalledFunction( appExpr->get_function() ); 370 363 assertf( function, "getCalledFunction returned nullptr: %s", toString( appExpr->get_function() ).c_str() ); 371 364 // check for Intrinsic only - don't want to remove all overridable ctor/dtors because autogenerated ctor/dtor 372 365 // 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; 374 367 } 375 368 … … 489 482 return refType->get_base(); 490 483 } else { 491 return nullptr;484 return NULL; 492 485 } 493 486 } … … 495 488 Type * isPointerType( Type * type ) { 496 489 if ( getPointerBase( type ) ) return type; 497 else return nullptr;490 else return NULL; 498 491 } 499 492
Note:
See TracChangeset
for help on using the changeset viewer.