Changeset b726084 for src/ResolvExpr


Ignore:
Timestamp:
Nov 9, 2016, 2:51:42 PM (8 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:
30b65d8, d073e3c
Parents:
141b786 (diff), 84118d8 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' into tuples

Conflicts:

src/ControlStruct/LabelTypeChecker.cc
src/InitTweak/FixInit.cc
src/ResolvExpr/Resolver.cc
src/Tuples/TupleAssignment.cc
src/Tuples/TupleAssignment.h

Location:
src/ResolvExpr
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • TabularUnified src/ResolvExpr/AlternativeFinder.h

    r141b786 rb726084  
    9595        Expression *resolveInVoidContext( Expression *expr, const SymTab::Indexer &indexer, TypeEnvironment &env );
    9696
    97         void resolveObject( const SymTab::Indexer & indexer, ObjectDecl * objectDecl );
    98 
    9997        template< typename InputIterator, typename OutputIterator >
    10098        void findMinCost( InputIterator begin, InputIterator end, OutputIterator out ) {
  • TabularUnified src/ResolvExpr/AlternativePrinter.h

    r141b786 rb726084  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // AlternativePrinter.h -- 
     7// AlternativePrinter.h --
    88//
    99// Author           : Richard C. Bilson
     
    2323
    2424namespace ResolvExpr {
    25         class AlternativePrinter : public SymTab::Indexer {
     25        class AlternativePrinter final : public SymTab::Indexer {
    2626          public:
    2727                AlternativePrinter( std::ostream &os );
    28                 virtual void visit( ExprStmt *exprStmt );
     28
     29                using SymTab::Indexer::visit;
     30                virtual void visit( ExprStmt *exprStmt ) override;
    2931          private:
    3032                std::ostream &os;
  • TabularUnified src/ResolvExpr/Resolver.cc

    r141b786 rb726084  
    3333
    3434namespace ResolvExpr {
    35         class Resolver : public SymTab::Indexer {
     35        class Resolver final : public SymTab::Indexer {
    3636          public:
    3737                Resolver() : SymTab::Indexer( false ) {}
    38                 Resolver( const SymTab::Indexer & indexer ) : SymTab::Indexer( indexer ) {}
    39 
    40                 virtual void visit( FunctionDecl *functionDecl );
    41                 virtual void visit( ObjectDecl *objectDecl );
    42                 virtual void visit( TypeDecl *typeDecl );
    43                 virtual void visit( EnumDecl * enumDecl );
    44 
    45                 virtual void visit( ArrayType * at );
    46                 virtual void visit( PointerType * at );
    47 
    48                 virtual void visit( ExprStmt *exprStmt );
    49                 virtual void visit( AsmExpr *asmExpr );
    50                 virtual void visit( AsmStmt *asmStmt );
    51                 virtual void visit( IfStmt *ifStmt );
    52                 virtual void visit( WhileStmt *whileStmt );
    53                 virtual void visit( ForStmt *forStmt );
    54                 virtual void visit( SwitchStmt *switchStmt );
    55                 virtual void visit( CaseStmt *caseStmt );
    56                 virtual void visit( BranchStmt *branchStmt );
    57                 virtual void visit( ReturnStmt *returnStmt );
    58 
    59                 virtual void visit( SingleInit *singleInit );
    60                 virtual void visit( ListInit *listInit );
    61                 virtual void visit( ConstructorInit *ctorInit );
     38
     39                using SymTab::Indexer::visit;
     40                virtual void visit( FunctionDecl *functionDecl ) override;
     41                virtual void visit( ObjectDecl *functionDecl ) override;
     42                virtual void visit( TypeDecl *typeDecl ) override;
     43                virtual void visit( EnumDecl * enumDecl ) override;
     44
     45                virtual void visit( ArrayType * at ) override;
     46                virtual void visit( PointerType * at ) override;
     47
     48                virtual void visit( ExprStmt *exprStmt ) override;
     49                virtual void visit( AsmExpr *asmExpr ) override;
     50                virtual void visit( AsmStmt *asmStmt ) override;
     51                virtual void visit( IfStmt *ifStmt ) override;
     52                virtual void visit( WhileStmt *whileStmt ) override;
     53                virtual void visit( ForStmt *forStmt ) override;
     54                virtual void visit( SwitchStmt *switchStmt ) override;
     55                virtual void visit( CaseStmt *caseStmt ) override;
     56                virtual void visit( BranchStmt *branchStmt ) override;
     57                virtual void visit( ReturnStmt *returnStmt ) override;
     58
     59                virtual void visit( SingleInit *singleInit ) override;
     60                virtual void visit( ListInit *listInit ) override;
     61                virtual void visit( ConstructorInit *ctorInit ) override;
    6262          private:
    6363        typedef std::list< Initializer * >::iterator InitIterator;
     
    6969          void resolveSingleAggrInit( Declaration *, InitIterator &, InitIterator & );
    7070          void fallbackInit( ConstructorInit * ctorInit );
     71
    7172                Type * functionReturn = nullptr;
    7273                Type *initContext = nullptr;
     
    533534        }
    534535
    535         void resolveObject( const SymTab::Indexer & indexer, ObjectDecl * objectDecl ) {
    536                 Resolver resolver( indexer );
    537                 objectDecl->accept( resolver );
    538         }
    539 
    540536        void Resolver::visit( ConstructorInit *ctorInit ) {
    541537                // xxx - fallback init has been removed => remove fallbackInit function and remove complexity from FixInit and remove C-init from ConstructorInit
  • TabularUnified src/ResolvExpr/TypeMap.h

    r141b786 rb726084  
    3838                typedef typename std::map< std::string, Value* > ValueMap;
    3939                typedef typename ValueMap::iterator ValueMapIterator;
    40                
     40
    4141                Value *voidValue;                                     ///< Value for void type
    4242                Value *basicValue[BasicType::NUMBER_OF_BASIC_TYPES];  ///< Values for basic types
     
    5454                        /// One scope of map rollbacks
    5555                        typedef std::vector< std::pair< ValueMapIterator, Value* > > MapScope;
    56                        
     56
    5757                        PointerScope pointers;  ///< Value pointers to roll back to their previous state
    5858                        MapScope mapNodes;      ///< Value map iterators to roll back to their previous state
     
    6868
    6969                std::vector< Rollback > scopes;  ///< Scope rollback information
    70                
     70
    7171                struct Lookup : public Visitor {
    7272                        Lookup( TypeMap<Value> &typeMap ) : typeMap( typeMap ), found( 0 ), toInsert( 0 ) {}
     
    8787                                return found;
    8888                        }
    89                        
     89
    9090                        void findAndReplace( Value *&loc ) {
    9191                                found = loc;
     
    109109                                }
    110110                        }
    111                        
     111
    112112                        virtual void visit( VoidType *voidType ) {
    113113                                findAndReplace( typeMap.voidValue );
    114114                        }
    115                        
     115
    116116                        virtual void visit( BasicType *basicType ) {
    117117                                findAndReplace( typeMap.basicValue[basicType->get_kind()] );
    118118                        }
    119                        
     119
    120120                        virtual void visit( PointerType *pointerType ) {
    121121                                // NOTE This is one of the places where the apporoximation of the resolver is (deliberately) poor;
     
    129129                                }
    130130                        }
    131                        
     131
    132132                        virtual void visit( ArrayType *arrayType ) {
    133133                                if ( dynamic_cast< FunctionType* >( arrayType->get_base() ) ) {
     
    137137                                }
    138138                        }
    139                        
     139
    140140                        virtual void visit( FunctionType *functionType ) {
    141141                                findAndReplace( typeMap.functionPointerValue );
    142142                        }
    143                        
     143
    144144                        virtual void visit( StructInstType *structType ) {
    145145                                findAndReplace( typeMap.structValue, structType->get_name() );
    146146                        }
    147                        
     147
    148148                        virtual void visit( UnionInstType *unionType ) {
    149149                                findAndReplace( typeMap.unionValue, unionType->get_name() );
    150150                        }
    151                        
     151
    152152                        virtual void visit( EnumInstType *enumType ) {
    153153                                findAndReplace( typeMap.enumValue, enumType->get_name() );
     
    157157                        Value *found;             ///< Value found (NULL if none yet)
    158158                        Value *toInsert;          ///< Value to insert (NULL if a lookup)
    159                 };  // class Lookup
    160                 friend class Lookup;
    161                
     159                };  // struct Lookup
     160                friend struct Lookup;
     161
    162162        public:
    163163                /// Starts a new scope
     
    180180                        scopes.pop_back();
    181181                }
    182                
     182
    183183                TypeMap() : voidValue( 0 ), pointerValue( 0 ), voidPointerValue( 0 ), functionPointerValue( 0 ), structValue(), unionValue(), enumValue(), scopes() {
    184184                        beginScope();
     
    199199                        return searcher.find( key );
    200200                }
    201                
     201
    202202        }; // class TypeMap
    203203
  • TabularUnified src/ResolvExpr/Unify.cc

    r141b786 rb726084  
    7373                const OpenVarSet &openVars;
    7474                WidenMode widenMode;
    75                 Type *commonType;
    7675                const SymTab::Indexer &indexer;
    7776        };
Note: See TracChangeset for help on using the changeset viewer.