Changeset e491159


Ignore:
Timestamp:
Aug 31, 2016, 11:20:03 AM (8 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, 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:
1f75e2d
Parents:
bda58ad
Message:

Moved ScopedMap? to Common folder

Location:
src
Files:
1 added
1 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • src/Common/utility.h

    rbda58ad re491159  
    1717#define _UTILITY_H
    1818
     19#include <cctype>
    1920#include <iostream>
     21#include <iterator>
     22#include <list>
     23#include <memory>
    2024#include <sstream>
    21 #include <iterator>
    2225#include <string>
    23 #include <cctype>
    24 #include <list>
    2526
    2627template< typename T >
     
    246247}
    247248
     249template< typename ThisType >
     250class RefCountSingleton {
     251  public:
     252        static std::shared_ptr<ThisType> get() {
     253                if( global_instance.expired() ) {
     254                        std::shared_ptr<ThisType> new_instance = std::make_shared<ThisType>();
     255                        global_instance = new_instance;
     256                        return std::move(new_instance);
     257                }
     258                return global_instance.lock();
     259        }
     260  private:
     261        static std::weak_ptr<ThisType> global_instance;
     262};
     263
    248264#endif // _UTILITY_H
    249265
  • src/GenPoly/Box.cc

    rbda58ad re491159  
    2929#include "PolyMutator.h"
    3030#include "FindFunction.h"
    31 #include "ScopedMap.h"
    3231#include "ScopedSet.h"
    3332#include "ScrubTyVars.h"
     
    5150#include "SymTab/Mangler.h"
    5251
     52#include "Common/ScopedMap.h"
    5353#include "Common/SemanticError.h"
    5454#include "Common/UniqueName.h"
  • src/GenPoly/InstantiateGeneric.cc

    rbda58ad re491159  
    2323#include "DeclMutator.h"
    2424#include "GenPoly.h"
    25 #include "ScopedMap.h"
    2625#include "ScopedSet.h"
    2726
     
    3231#include "SynTree/Type.h"
    3332
     33#include "Common/ScopedMap.h"
    3434#include "Common/UniqueName.h"
    3535#include "Common/utility.h"
     
    8484                std::list< Type* > params;  ///< Instantiation parameters
    8585        };
    86        
     86
    8787        /// Maps a key and a TypeList to the some value, accounting for scope
    8888        template< typename Key, typename Value >
     
    145145                return gt;
    146146        }
    147        
     147
    148148        /// Mutator pass that replaces concrete instantiations of generic types with actual struct declarations, scoped appropriately
    149149        class GenericInstantiator : public DeclMutator {
     
    193193                        TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param );
    194194                        assert(paramType && "Aggregate parameters should be type expressions");
    195                        
     195
    196196                        switch ( (*baseParam)->get_kind() ) {
    197197                        case TypeDecl::Any: {
     
    242242                inst->get_parameters().clear();
    243243        }
    244        
     244
    245245        void GenericInstantiator::stripDtypeParams( AggregateDecl *base, std::list< TypeDecl* >& baseParams, const std::list< TypeExpr* >& typeSubs ) {
    246246                substituteMembers( base->get_members(), baseParams, typeSubs );
     
    248248                deleteAll( baseParams );
    249249                baseParams.clear();
    250                
     250
    251251                dtypeStatics.insert( base );
    252252        }
     
    266266                        return inst;
    267267                }
    268                
     268
    269269                // check if type can be concretely instantiated; put substitutions into typeSubs
    270270                assert( inst->get_baseParameters() && "Base struct has parameters" );
     
    276276                        stripInstParams( inst );
    277277                        break;
    278                
     278
    279279                case genericType::concrete: {
    280280                        // make concrete instantiation of generic type
     
    328328                        stripInstParams( inst );
    329329                        break;
    330                        
     330
    331331                case genericType::concrete:
    332332                {
  • src/SymTab/Validate.cc

    rbda58ad re491159  
    4040#include <list>
    4141#include <iterator>
     42#include "Common/ScopedMap.h"
    4243#include "Common/utility.h"
    4344#include "Common/UniqueName.h"
     
    4950#include "SynTree/Statement.h"
    5051#include "SynTree/TypeSubstitution.h"
    51 #include "GenPoly/ScopedMap.h"
    5252#include "Indexer.h"
    5353#include "FixFunction.h"
     
    164164
    165165                typedef std::unique_ptr<TypedefDecl> TypedefDeclPtr;
    166                 typedef GenPoly::ScopedMap< std::string, std::pair< TypedefDeclPtr, int > > TypedefMap;
     166                typedef ScopedMap< std::string, std::pair< TypedefDeclPtr, int > > TypedefMap;
    167167                typedef std::map< std::string, TypeDecl * > TypeDeclMap;
    168168                TypedefMap typedefNames;
Note: See TracChangeset for help on using the changeset viewer.