Changeset e491159
- Timestamp:
- Aug 31, 2016, 11:20:03 AM (8 years ago)
- 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
- Location:
- src
- Files:
-
- 1 added
- 1 deleted
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Common/utility.h
rbda58ad re491159 17 17 #define _UTILITY_H 18 18 19 #include <cctype> 19 20 #include <iostream> 21 #include <iterator> 22 #include <list> 23 #include <memory> 20 24 #include <sstream> 21 #include <iterator>22 25 #include <string> 23 #include <cctype>24 #include <list>25 26 26 27 template< typename T > … … 246 247 } 247 248 249 template< typename ThisType > 250 class 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 248 264 #endif // _UTILITY_H 249 265 -
src/GenPoly/Box.cc
rbda58ad re491159 29 29 #include "PolyMutator.h" 30 30 #include "FindFunction.h" 31 #include "ScopedMap.h"32 31 #include "ScopedSet.h" 33 32 #include "ScrubTyVars.h" … … 51 50 #include "SymTab/Mangler.h" 52 51 52 #include "Common/ScopedMap.h" 53 53 #include "Common/SemanticError.h" 54 54 #include "Common/UniqueName.h" -
src/GenPoly/InstantiateGeneric.cc
rbda58ad re491159 23 23 #include "DeclMutator.h" 24 24 #include "GenPoly.h" 25 #include "ScopedMap.h"26 25 #include "ScopedSet.h" 27 26 … … 32 31 #include "SynTree/Type.h" 33 32 33 #include "Common/ScopedMap.h" 34 34 #include "Common/UniqueName.h" 35 35 #include "Common/utility.h" … … 84 84 std::list< Type* > params; ///< Instantiation parameters 85 85 }; 86 86 87 87 /// Maps a key and a TypeList to the some value, accounting for scope 88 88 template< typename Key, typename Value > … … 145 145 return gt; 146 146 } 147 147 148 148 /// Mutator pass that replaces concrete instantiations of generic types with actual struct declarations, scoped appropriately 149 149 class GenericInstantiator : public DeclMutator { … … 193 193 TypeExpr *paramType = dynamic_cast< TypeExpr* >( *param ); 194 194 assert(paramType && "Aggregate parameters should be type expressions"); 195 195 196 196 switch ( (*baseParam)->get_kind() ) { 197 197 case TypeDecl::Any: { … … 242 242 inst->get_parameters().clear(); 243 243 } 244 244 245 245 void GenericInstantiator::stripDtypeParams( AggregateDecl *base, std::list< TypeDecl* >& baseParams, const std::list< TypeExpr* >& typeSubs ) { 246 246 substituteMembers( base->get_members(), baseParams, typeSubs ); … … 248 248 deleteAll( baseParams ); 249 249 baseParams.clear(); 250 250 251 251 dtypeStatics.insert( base ); 252 252 } … … 266 266 return inst; 267 267 } 268 268 269 269 // check if type can be concretely instantiated; put substitutions into typeSubs 270 270 assert( inst->get_baseParameters() && "Base struct has parameters" ); … … 276 276 stripInstParams( inst ); 277 277 break; 278 278 279 279 case genericType::concrete: { 280 280 // make concrete instantiation of generic type … … 328 328 stripInstParams( inst ); 329 329 break; 330 330 331 331 case genericType::concrete: 332 332 { -
src/SymTab/Validate.cc
rbda58ad re491159 40 40 #include <list> 41 41 #include <iterator> 42 #include "Common/ScopedMap.h" 42 43 #include "Common/utility.h" 43 44 #include "Common/UniqueName.h" … … 49 50 #include "SynTree/Statement.h" 50 51 #include "SynTree/TypeSubstitution.h" 51 #include "GenPoly/ScopedMap.h"52 52 #include "Indexer.h" 53 53 #include "FixFunction.h" … … 164 164 165 165 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; 167 167 typedef std::map< std::string, TypeDecl * > TypeDeclMap; 168 168 TypedefMap typedefNames;
Note: See TracChangeset
for help on using the changeset viewer.