- Timestamp:
- Jun 17, 2019, 3:37:00 PM (6 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 54b3fde, 6e55240
- Parents:
- 89faa82 (diff), aba20d2 (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. - Location:
- src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r89faa82 r800bae1 576 576 if ( srcInferred.mode == ast::Expr::InferUnion::Params ) { 577 577 const ast::InferredParams &srcParams = srcInferred.inferParams(); 578 for (auto srcParam : srcParams) {579 tgtInferParams[srcParam.first] =ParamEntry(578 for (auto & srcParam : srcParams) { 579 auto res = tgtInferParams.emplace(srcParam.first, ParamEntry( 580 580 srcParam.second.decl, 581 581 get<Declaration>().accept1(srcParam.second.declptr), … … 583 583 get<Type>().accept1(srcParam.second.formalType), 584 584 get<Expression>().accept1(srcParam.second.expr) 585 ); 585 )); 586 assert(res.second); 586 587 } 587 588 } else if ( srcInferred.mode == ast::Expr::InferUnion::Slots ) { … … 1982 1983 if ( !oldInferParams.empty() ) { 1983 1984 ast::InferredParams &tgt = newInferred.inferParams(); 1984 for (auto old : oldInferParams) {1985 for (auto & old : oldInferParams) { 1985 1986 tgt[old.first] = ast::ParamEntry( 1986 1987 old.second.decl, -
src/Common/Stats/Heap.cc
r89faa82 r800bae1 21 21 #include <iostream> 22 22 23 #if defined( NO_STATISTICS ) || defined( TCMALLOC ) 24 #define NO_HEAP_STATISTICS 23 #if defined(__has_feature) 24 #if __has_feature(address_sanitizer) 25 #define NO_HEAP_STATISTICS 26 # endif 27 #endif 28 29 #if defined( NO_STATISTICS ) || defined( TCMALLOC ) || defined(__SANITIZE_ADDRESS__) 30 #if !defined(NO_HEAP_STATISTICS) 31 #define NO_HEAP_STATISTICS 32 #endif 25 33 #endif 26 34 -
src/ResolvExpr/ResolveAssertions.cc
r89faa82 r800bae1 325 325 entry.second.expr = postmutate( entry.second.expr ); 326 326 // xxx - look at entry.second.inferParams? 327 expr->inferParams[ entry.first ] = entry.second; 327 auto res = expr->inferParams.emplace( entry.first, entry.second ); 328 assert(res.second); 328 329 } 329 330 } -
src/SynTree/ApplicationExpr.cc
r89faa82 r800bae1 28 28 #include "Type.h" // for Type, PointerType, FunctionType 29 29 30 ParamEntry::ParamEntry( UniqueId decl, Declaration * declptr, Type * actualType, Type * formalType, Expression* expr ) 31 : decl( decl ), declptr( declptr ), actualType( actualType ), formalType( formalType ), expr( expr ) { 32 } 33 30 34 ParamEntry::ParamEntry( const ParamEntry &other ) : 31 decl( other.decl ), declptr( maybeClone( other.declptr ) ), actualType( maybeClone( other.actualType ) ), formalType( maybeClone( other.formalType ) ), expr( maybeClone( other.expr ) )/*, inferParams( new InferredParams( *other.inferParams ) )*/ { 32 } 33 34 ParamEntry &ParamEntry::operator=( const ParamEntry &other ) { 35 if ( &other == this ) return *this; 36 const_cast<UniqueId &>(decl) = other.decl; 37 const_cast<Declaration * &>(declptr) = maybeClone( other.declptr ); 38 // xxx - this looks like a memory leak 39 const_cast<Type * &>(actualType) = maybeClone( other.actualType ); 40 const_cast<Type * &>(formalType) = maybeClone( other.formalType ); 41 expr = maybeClone( other.expr ); 42 // *inferParams = *other.inferParams; 43 return *this; 35 decl( other.decl ), declptr( maybeClone( other.declptr ) ), actualType( maybeClone( other.actualType ) ), formalType( maybeClone( other.formalType ) ), expr( maybeClone( other.expr ) ) { 44 36 } 45 37 … … 52 44 53 45 ParamEntry::ParamEntry( ParamEntry && other ) : 54 decl( other.decl ), declptr( other.declptr ), actualType( other.actualType ), formalType( other.formalType ), expr( other.expr )/*, inferParams( std::move( other.inferParams ) )*/ { 55 const_cast<Declaration * &>(other.declptr) = nullptr; 56 const_cast<Type * &>(other.actualType) = nullptr; 57 const_cast<Type * &>(other.formalType) = nullptr; 58 other.expr = nullptr; 46 decl( other.decl ), declptr( other.declptr ), actualType( other.actualType ), formalType( other.formalType ), expr( other.expr ) { 47 new (&other) ParamEntry(); 59 48 } 60 49 61 50 ParamEntry & ParamEntry::operator=( ParamEntry && other ) { 62 51 if ( &other == this ) return *this; 63 delete declptr; 64 delete actualType; 65 delete formalType; 66 delete expr; 67 const_cast<UniqueId &>(decl) = other.decl; 68 const_cast<Declaration * &>(declptr) = other.declptr; 69 const_cast<Type * &>(actualType) = other.actualType; 70 const_cast<Type * &>(formalType) = other.formalType; 71 expr = other.expr; 72 const_cast<Declaration * &>(other.declptr) = nullptr; 73 const_cast<Type * &>(other.actualType) = nullptr; 74 const_cast<Type * &>(other.formalType) = nullptr; 75 other.expr = nullptr; 76 // inferParams = std::move( other.inferParams ); 52 this->~ParamEntry(); 53 new (this) ParamEntry(other.decl, other.declptr, other.actualType, other.formalType, other.expr); 54 new (&other) ParamEntry(); 55 77 56 return *this; 78 57 } -
src/SynTree/Expression.h
r89faa82 r800bae1 39 39 /// but subject to decay-to-pointer and type parameter renaming 40 40 struct ParamEntry { 41 ParamEntry(): decl( 0 ), declptr(nullptr), actualType( 0 ), formalType( 0 ), expr( 0 )/*, inferParams( new InferredParams )*/ {} 42 ParamEntry( UniqueId decl, Declaration * declptr, Type * actualType, Type * formalType, Expression* expr ) 43 : decl( decl ), declptr( declptr ), actualType( actualType ), formalType( formalType ), expr( expr )/*, inferParams( new InferredParams )*/ { 44 } 41 ParamEntry(): decl( 0 ), declptr( nullptr ), actualType( nullptr ), formalType( nullptr ), expr( nullptr ) {} 42 ParamEntry( UniqueId decl, Declaration * declptr, Type * actualType, Type * formalType, Expression* expr ); 45 43 ParamEntry( const ParamEntry & other ); 46 44 ParamEntry( ParamEntry && other ); 47 45 ~ParamEntry(); 48 ParamEntry & operator=( const ParamEntry & other );49 46 ParamEntry & operator=( ParamEntry && other ); 50 47 … … 54 51 Type * const formalType; 55 52 Expression * expr; 56 // std::unique_ptr< InferredParams > inferParams;57 53 }; 58 54
Note:
See TracChangeset
for help on using the changeset viewer.