Changeset 0661678


Ignore:
Timestamp:
May 19, 2017, 2:33:38 PM (4 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
d298e03
Parents:
8905f56
Message:

fix unreachable code warnings

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    r8905f56 r0661678  
    896896                        Parent::visit( compoundStmt );
    897897
    898                         // add destructors for the current scope that we're exiting
     898                        // add destructors for the current scope that we're exiting, unless the last statement is a return, which
     899                        // causes unreachable code warnings
    899900                        std::list< Statement * > & statements = compoundStmt->get_kids();
    900                         insertDtors( reverseDeclOrder.front().begin(), reverseDeclOrder.front().end(), back_inserter( statements ) );
     901                        if ( ! statements.empty() && ! dynamic_cast< ReturnStmt * >( statements.back() ) ) {
     902                                insertDtors( reverseDeclOrder.front().begin(), reverseDeclOrder.front().end(), back_inserter( statements ) );
     903                        }
    901904                        reverseDeclOrder.pop_front();
    902905                }
Note: See TracChangeset for help on using the changeset viewer.