Changeset bff227f for src/InitTweak


Ignore:
Timestamp:
Jul 21, 2017, 3:57:11 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
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:
9191a8e
Parents:
53a8e68
Message:

Refactor operator predicates into OperatorTable?.cc

Location:
src/InitTweak
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • src/InitTweak/FixInit.cc

    r53a8e68 rbff227f  
    2626#include "FixGlobalInit.h"
    2727#include "CodeGen/GenType.h"  // for warning/error messages
     28#include "CodeGen/OperatorTable.h"
    2829#include "Common/PassVisitor.h"
    2930#include "GenPoly/DeclMutator.h"
     
    363364                                        FunctionType * ftype = dynamic_cast< FunctionType * >( GenPoly::getFunctionType( funcDecl->get_type() ) );
    364365                                        assert( ftype );
    365                                         if ( isConstructor( funcDecl->get_name() ) && ftype->get_parameters().size() == 2 ) {
     366                                        if ( CodeGen::isConstructor( funcDecl->get_name() ) && ftype->get_parameters().size() == 2 ) {
    366367                                                Type * t1 = getPointerBase( ftype->get_parameters().front()->get_type() );
    367368                                                Type * t2 = ftype->get_parameters().back()->get_type();
     
    372373                                                        return appExpr;
    373374                                                } // if
    374                                         } else if ( isDestructor( funcDecl->get_name() ) ) {
     375                                        } else if ( CodeGen::isDestructor( funcDecl->get_name() ) ) {
    375376                                                // correctness: never copy construct arguments to a destructor
    376377                                                return appExpr;
     
    975976                        if ( ! funcDecl ) return false;
    976977                        if ( ! funcDecl->get_statements() ) return false;
    977                         return isCtorDtor( funcDecl->get_name() ) && ! LinkageSpec::isOverridable( funcDecl->get_linkage() );
     978                        return CodeGen::isCtorDtor( funcDecl->get_name() ) && ! LinkageSpec::isOverridable( funcDecl->get_linkage() );
    978979                }
    979980
     
    992993
    993994                        function = funcDecl;
    994                         isCtor = isConstructor( function->get_name() );
     995                        isCtor = CodeGen::isConstructor( function->get_name() );
    995996                        if ( checkWarnings( function ) ) {
    996997                                FunctionType * type = function->get_functionType();
  • src/InitTweak/GenInit.cc

    r53a8e68 rbff227f  
    2121
    2222#include "Common/PassVisitor.h"
     23#include "CodeGen/OperatorTable.h"
    2324
    2425#include "GenPoly/DeclMutator.h"
     
    235236        void CtorDtor::handleDWT( DeclarationWithType * dwt ) {
    236237                // if this function is a user-defined constructor or destructor, mark down the type as "managed"
    237                 if ( ! LinkageSpec::isOverridable( dwt->get_linkage() ) && isCtorDtor( dwt->get_name() ) ) {
     238                if ( ! LinkageSpec::isOverridable( dwt->get_linkage() ) && CodeGen::isCtorDtor( dwt->get_name() ) ) {
    238239                        std::list< DeclarationWithType * > & params = GenPoly::getFunctionType( dwt->get_type() )->get_parameters();
    239240                        assert( ! params.empty() );
  • src/InitTweak/InitTweak.h

    r53a8e68 rbff227f  
    2626// helper functions for initialization
    2727namespace InitTweak {
    28         bool isConstructor( const std::string & );
    29         bool isDestructor( const std::string & );
    30         bool isAssignment( const std::string & );
    31         bool isCtorDtor( const std::string & );
    32         bool isCtorDtorAssign( const std::string & );
    33 
    3428        FunctionDecl * isAssignment( Declaration * decl );
    3529        FunctionDecl * isDestructor( Declaration * decl );
Note: See TracChangeset for help on using the changeset viewer.