Changeset 22bc276 for src/InitTweak/InitTweak.cc
- Timestamp:
- Sep 21, 2017, 3:23:33 PM (7 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, with_gc
- Children:
- 05807e9, 29bc63e
- Parents:
- e4d6335
- git-author:
- Rob Schluntz <rschlunt@…> (09/21/17 15:19:47)
- git-committer:
- Rob Schluntz <rschlunt@…> (09/21/17 15:23:33)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/InitTweak/InitTweak.cc
re4d6335 r22bc276 1 #include <stddef.h> // for NULL2 1 #include <algorithm> // for find, all_of 3 2 #include <cassert> // for assertf, assert, strict_dynamic_cast … … 184 183 callExpr->get_args().splice( callExpr->get_args().end(), args ); 185 184 186 *out++ = new IfStmt( noLabels, cond, new ExprStmt( noLabels, callExpr ), NULL);185 *out++ = new IfStmt( noLabels, cond, new ExprStmt( noLabels, callExpr ), nullptr ); 187 186 188 187 UntypedExpr * increment = new UntypedExpr( new NameExpr( "++?" ) ); … … 250 249 // To accomplish this, generate switch statement, consuming all of expander's elements 251 250 Statement * InitImpl::buildListInit( UntypedExpr * dst, std::list< Expression * > & indices ) { 252 if ( ! init ) return NULL;251 if ( ! init ) return nullptr; 253 252 CompoundStmt * block = new CompoundStmt( noLabels ); 254 253 build( dst, indices.begin(), indices.end(), init, back_inserter( block->get_kids() ) ); 255 254 if ( block->get_kids().empty() ) { 256 255 delete block; 257 return NULL;256 return nullptr; 258 257 } else { 259 init = NULL; // init was consumed in creating the list init258 init = nullptr; // init was consumed in creating the list init 260 259 return block; 261 260 } 262 261 } 263 262 264 Statement * ExprImpl::buildListInit( __attribute((unused)) UntypedExpr * dst, __attribute((unused)) std::list< Expression * > & indices) {265 return NULL;263 Statement * ExprImpl::buildListInit( UntypedExpr *, std::list< Expression * > & ) { 264 return nullptr; 266 265 } 267 266 … … 270 269 } 271 270 272 bool tryConstruct( ObjectDecl * objDecl ) { 271 bool tryConstruct( DeclarationWithType * dwt ) { 272 ObjectDecl * objDecl = dynamic_cast< ObjectDecl * >( dwt ); 273 if ( ! objDecl ) return false; 273 274 return ! LinkageSpec::isBuiltin( objDecl->get_linkage() ) && 274 (objDecl->get_init() == NULL || 275 ( objDecl->get_init() != NULL && objDecl->get_init()->get_maybeConstructed() )) 276 && ! objDecl->get_storageClasses().is_extern; 275 (objDecl->get_init() == nullptr || 276 ( objDecl->get_init() != nullptr && objDecl->get_init()->get_maybeConstructed() )) 277 && ! objDecl->get_storageClasses().is_extern 278 && ! dynamic_cast< ReferenceType * >( objDecl->type ); 277 279 } 278 280 … … 314 316 collectCtorDtorCalls( stmt, matches ); 315 317 assert( matches.size() <= 1 ); 316 return matches.size() == 1 ? matches.front() : NULL;318 return matches.size() == 1 ? matches.front() : nullptr; 317 319 } 318 320 … … 359 361 ApplicationExpr * isIntrinsicCallExpr( Expression * expr ) { 360 362 ApplicationExpr * appExpr = dynamic_cast< ApplicationExpr * >( expr ); 361 if ( ! appExpr ) return NULL;363 if ( ! appExpr ) return nullptr; 362 364 DeclarationWithType * function = getCalledFunction( appExpr->get_function() ); 363 365 assertf( function, "getCalledFunction returned nullptr: %s", toString( appExpr->get_function() ).c_str() ); 364 366 // check for Intrinsic only - don't want to remove all overridable ctor/dtors because autogenerated ctor/dtor 365 367 // will call all member dtors, and some members may have a user defined dtor. 366 return function->get_linkage() == LinkageSpec::Intrinsic ? appExpr : NULL;368 return function->get_linkage() == LinkageSpec::Intrinsic ? appExpr : nullptr; 367 369 } 368 370 … … 482 484 return refType->get_base(); 483 485 } else { 484 return NULL;486 return nullptr; 485 487 } 486 488 } … … 488 490 Type * isPointerType( Type * type ) { 489 491 if ( getPointerBase( type ) ) return type; 490 else return NULL;492 else return nullptr; 491 493 } 492 494
Note: See TracChangeset
for help on using the changeset viewer.