Changeset 148ba7d


Ignore:
Timestamp:
Oct 25, 2021, 2:29:16 PM (5 weeks ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
master
Children:
c600df1
Parents:
a36eb2d
Message:

Added a return value to WithGuards::GuardValue? so you can save the old value and set a new one in one statement.

Location:
src
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Pass.hpp

    ra36eb2d r148ba7d  
    348348
    349349        /// When this node is finished being visited, restore the value of a variable
     350        /// You may assign to the return value to set the new value in the same statement.
    350351        template< typename T >
    351         void GuardValue( T& val ) {
     352        T& GuardValue( T& val ) {
    352353                at_cleanup( [ val ]( void * newVal ) {
    353354                        * static_cast< T * >( newVal ) = val;
    354355                }, static_cast< void * >( & val ) );
     356                return val;
    355357        }
    356358
  • src/InitTweak/GenInit.cc

    ra36eb2d r148ba7d  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Andrew Beach
    12 // Last Modified On : Mon Oct 25 11:10:00 2021
    13 // Update Count     : 185
     12// Last Modified On : Mon Oct 25 13:53:00 2021
     13// Update Count     : 186
    1414//
    1515#include "GenInit.h"
     
    316316        void HoistArrayDimension_NoResolve_New::previsit(
    317317                        const ast::ObjectDecl * decl ) {
    318                 GuardValue( storageClasses );
    319                 storageClasses = decl->storage;
     318                GuardValue( storageClasses ) = decl->storage;
    320319        }
    321320
     
    377376
    378377        void ReturnFixer_New::previsit( const ast::FunctionDecl * decl ) {
    379                 GuardValue( funcDecl );
    380                 funcDecl = decl;
     378                GuardValue( funcDecl ) = decl;
    381379        }
    382380
Note: See TracChangeset for help on using the changeset viewer.