Changeset 90152a4 for src/ResolvExpr/AdjustExprType.cc
- Timestamp:
- Aug 27, 2018, 4:40:34 PM (7 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- b7c89aa
- Parents:
- f9feab8 (diff), 305581d (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. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/ResolvExpr/AdjustExprType.cc
rf9feab8 r90152a4 24 24 class AdjustExprType : public WithShortCircuiting { 25 25 public: 26 AdjustExprType( const TypeEnvironment & env, const SymTab::Indexer &indexer );26 AdjustExprType( const TypeEnvironment & env, const SymTab::Indexer & indexer ); 27 27 void premutate( VoidType * ) { visit_children = false; } 28 28 void premutate( BasicType * ) { visit_children = false; } … … 45 45 46 46 private: 47 const TypeEnvironment & env;48 const SymTab::Indexer & indexer;47 const TypeEnvironment & env; 48 const SymTab::Indexer & indexer; 49 49 }; 50 50 … … 55 55 } 56 56 57 void adjustExprType( Type *& type ) { 58 TypeEnvironment env; 59 SymTab::Indexer indexer; 60 adjustExprType( type, env, indexer ); 61 } 62 57 63 AdjustExprType::AdjustExprType( const TypeEnvironment &env, const SymTab::Indexer &indexer ) 58 64 : env( env ), indexer( indexer ) { … … 60 66 61 67 Type * AdjustExprType::postmutate( ArrayType * arrayType ) { 62 PointerType *pointerType = new PointerType ( arrayType->get_qualifiers(), arrayType->base );68 PointerType *pointerType = new PointerType{ arrayType->get_qualifiers(), arrayType->base }; 63 69 arrayType->base = nullptr; 64 70 delete arrayType; … … 67 73 68 74 Type * AdjustExprType::postmutate( FunctionType * functionType ) { 69 return new PointerType ( Type::Qualifiers(), functionType );75 return new PointerType{ Type::Qualifiers(), functionType }; 70 76 } 71 77 72 78 Type * AdjustExprType::postmutate( TypeInstType * typeInst ) { 73 EqvClass eqvClass; 74 if ( env.lookup( typeInst->get_name(), eqvClass ) ) { 75 if ( eqvClass.data.kind == TypeDecl::Ftype ) { 76 PointerType *pointerType = new PointerType( Type::Qualifiers(), typeInst ); 77 return pointerType; 79 if ( const EqvClass* eqvClass = env.lookup( typeInst->get_name() ) ) { 80 if ( eqvClass->data.kind == TypeDecl::Ftype ) { 81 return new PointerType{ Type::Qualifiers(), typeInst }; 78 82 } 79 83 } else if ( NamedTypeDecl *ntDecl = indexer.lookupType( typeInst->get_name() ) ) { 80 84 if ( TypeDecl *tyDecl = dynamic_cast< TypeDecl* >( ntDecl ) ) { 81 85 if ( tyDecl->get_kind() == TypeDecl::Ftype ) { 82 PointerType *pointerType = new PointerType( Type::Qualifiers(), typeInst ); 83 return pointerType; 86 return new PointerType{ Type::Qualifiers(), typeInst }; 84 87 } // if 85 88 } // if
Note:
See TracChangeset
for help on using the changeset viewer.