Changeset 0698aa1 for src/SynTree
- Timestamp:
- Jul 12, 2017, 4:44:44 PM (7 years ago)
- 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:
- cda7889
- Parents:
- aca65621
- Location:
- src/SynTree
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
raca65621 r0698aa1 335 335 namespace { 336 336 TypeSubstitution makeSub( Type * t ) { 337 if ( StructInstType * aggInst = dynamic_cast< StructInstType * >( t ) ) { 337 if ( ReferenceType * refType = dynamic_cast< ReferenceType * >( t ) ) { 338 return makeSub( refType->get_base() ); 339 } else if ( StructInstType * aggInst = dynamic_cast< StructInstType * >( t ) ) { 338 340 return TypeSubstitution( aggInst->get_baseParameters()->begin(), aggInst->get_baseParameters()->end(), aggInst->get_parameters().begin() ); 339 341 } else if ( UnionInstType * aggInst = dynamic_cast< UnionInstType * >( t ) ) { … … 400 402 if ( Type * type = expr->get_result() ) { 401 403 Type * base = InitTweak::getPointerBase( type ); 402 if ( ! base ) { 403 std::cerr << type << std::endl; 404 } 405 assertf( base, "expected pointer type in dereference\n" ); 406 ret->set_result( maybeClone( base ) ); 404 assertf( base, "expected pointer type in dereference (type was %s)", toString( type ).c_str() ); 405 ret->set_result( new ReferenceType( Type::Qualifiers(), base->clone() ) ); 407 406 } 408 407 return ret; -
src/SynTree/Type.cc
raca65621 r0698aa1 65 65 const char * Type::QualifiersNames[] = { "const", "restrict", "volatile", "lvalue", "mutex", "_Atomic" }; 66 66 67 Type * Type::stripDeclarator() {67 Type * Type::stripDeclarator() { 68 68 Type * type = this; 69 69 while ( Type * at = InitTweak::getPointerBase( type ) ) { 70 70 type = at; 71 } 72 return type; 73 } 74 75 Type * Type::stripReferences() { 76 Type * type = this; 77 while ( ReferenceType * ref = dynamic_cast<ReferenceType *>( type ) ) { 78 type = ref->get_base(); 71 79 } 72 80 return type; -
src/SynTree/Type.h
raca65621 r0698aa1 158 158 159 159 /// return type without outer pointers and arrays 160 Type *stripDeclarator(); 160 Type * stripDeclarator(); 161 162 /// return type without outer references 163 Type * stripReferences(); 161 164 162 165 virtual bool isComplete() const { return true; }
Note: See TracChangeset
for help on using the changeset viewer.