Changeset 906e24d for src/SynTree
- Timestamp:
- Sep 15, 2016, 10:17:16 AM (8 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:
- aa8f9df
- Parents:
- 96a10cd
- git-author:
- Rob Schluntz <rschlunt@…> (09/14/16 22:32:34)
- git-committer:
- Rob Schluntz <rschlunt@…> (09/15/16 10:17:16)
- Location:
- src/SynTree
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/AddressExpr.cc
r96a10cd r906e24d 19 19 20 20 AddressExpr::AddressExpr( Expression *arg, Expression *_aname ) : Expression( _aname ), arg( arg ) { 21 for ( std::list< Type* >::const_iterator i = arg->get_results().begin(); i != arg->get_results().end(); ++i) {22 get_results().push_back( new PointerType( Type::Qualifiers(), (*i)->clone() ) );23 } // for21 if ( arg->has_result() ) { 22 set_result( new PointerType( Type::Qualifiers(), arg->get_result()->clone() ) ); 23 } 24 24 } 25 25 … … 35 35 if ( arg ) { 36 36 os << std::string( indent+2, ' ' ); 37 37 arg->print( os, indent+2 ); 38 38 } // if 39 39 } -
src/SynTree/ApplicationExpr.cc
r96a10cd r906e24d 21 21 #include "TypeSubstitution.h" 22 22 #include "Common/utility.h" 23 23 #include "ResolvExpr/typeops.h" 24 24 25 25 ParamEntry::ParamEntry( const ParamEntry &other ) : … … 43 43 44 44 ApplicationExpr::ApplicationExpr( Expression *funcExpr ) : function( funcExpr ) { 45 PointerType *pointer = dynamic_cast< PointerType* >( funcExpr->get_results().front() ); 46 assert( pointer ); 47 FunctionType *function = dynamic_cast< FunctionType* >( pointer->get_base() ); 48 assert( function ); 45 PointerType *pointer = safe_dynamic_cast< PointerType* >( funcExpr->get_result() ); 46 FunctionType *function = safe_dynamic_cast< FunctionType* >( pointer->get_base() ); 49 47 50 for ( std::list< DeclarationWithType* >::const_iterator i = function->get_returnVals().begin(); i != function->get_returnVals().end(); ++i ) {51 get_results().push_back( (*i)->get_type()->clone() ); 52 } // for48 set_result( ResolvExpr::extractResultType( function ) ); 49 50 assert( has_result() ); 53 51 } 54 52 -
src/SynTree/CommaExpr.cc
r96a10cd r906e24d 23 23 // to false on all result types. Actually doing this causes some strange things 24 24 // to happen in later passes (particularly, Specialize, Lvalue, and Box). This needs to be looked into. 25 cloneAll( arg2->get_results(), get_results() ); 26 // for ( Type *& type : get_results() ) { 27 // type->set_isLvalue( false ); 28 // } 25 set_result( maybeClone( arg2->get_result() ) ); 26 // get_type->set_isLvalue( false ); 29 27 } 30 28 -
src/SynTree/Expression.cc
r96a10cd r906e24d 31 31 32 32 33 Expression::Expression( Expression *_aname ) : env( 0 ), argName( _aname ) {} 34 35 Expression::Expression( const Expression &other ) : env( maybeClone( other.env ) ), argName( maybeClone( other.get_argName() ) ), extension( other.extension ) { 36 cloneAll( other.results, results ); 33 Expression::Expression( Expression *_aname ) : result( 0 ), env( 0 ), argName( _aname ) {} 34 35 Expression::Expression( const Expression &other ) : result( maybeClone( other.result ) ), env( maybeClone( other.env ) ), argName( maybeClone( other.get_argName() ) ), extension( other.extension ) { 37 36 } 38 37 … … 40 39 delete env; 41 40 delete argName; // xxx -- there's a problem in cloning ConstantExpr I still don't know how to fix 42 deleteAll( results ); 43 } 44 45 void Expression::add_result( Type *t ) { 46 if ( TupleType *tuple = dynamic_cast< TupleType* >( t ) ) { 47 std::copy( tuple->get_types().begin(), tuple->get_types().end(), back_inserter( results ) ); 48 } else { 49 results.push_back(t); 50 } // if 41 delete result; 51 42 } 52 43 … … 68 59 69 60 ConstantExpr::ConstantExpr( Constant _c, Expression *_aname ) : Expression( _aname ), constant( _c ) { 70 add_result( constant.get_type()->clone() );61 set_result( constant.get_type()->clone() ); 71 62 } 72 63 … … 85 76 assert( var ); 86 77 assert( var->get_type() ); 87 add_result( var->get_type()->clone() ); 88 for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) { 89 (*i)->set_isLvalue( true ); 90 } // for 78 Type * type = var->get_type()->clone(); 79 type->set_isLvalue( true ); 80 set_result( type ); 91 81 } 92 82 … … 110 100 SizeofExpr::SizeofExpr( Expression *expr_, Expression *_aname ) : 111 101 Expression( _aname ), expr(expr_), type(0), isType(false) { 112 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );102 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 113 103 } 114 104 115 105 SizeofExpr::SizeofExpr( Type *type_, Expression *_aname ) : 116 106 Expression( _aname ), expr(0), type(type_), isType(true) { 117 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );107 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 118 108 } 119 109 … … 141 131 AlignofExpr::AlignofExpr( Expression *expr_, Expression *_aname ) : 142 132 Expression( _aname ), expr(expr_), type(0), isType(false) { 143 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );133 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 144 134 } 145 135 146 136 AlignofExpr::AlignofExpr( Type *type_, Expression *_aname ) : 147 137 Expression( _aname ), expr(0), type(type_), isType(true) { 148 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );138 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 149 139 } 150 140 … … 172 162 UntypedOffsetofExpr::UntypedOffsetofExpr( Type *type_, const std::string &member_, Expression *_aname ) : 173 163 Expression( _aname ), type(type_), member(member_) { 174 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );164 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 175 165 } 176 166 … … 197 187 OffsetofExpr::OffsetofExpr( Type *type_, DeclarationWithType *member_, Expression *_aname ) : 198 188 Expression( _aname ), type(type_), member(member_) { 199 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) );189 set_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 200 190 } 201 191 … … 229 219 230 220 OffsetPackExpr::OffsetPackExpr( StructInstType *type_, Expression *aname_ ) : Expression( aname_ ), type( type_ ) { 231 add_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) );221 set_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) ); 232 222 } 233 223 … … 284 274 285 275 CastExpr::CastExpr( Expression *arg_, Type *toType, Expression *_aname ) : Expression( _aname ), arg(arg_) { 286 add_result(toType);276 set_result(toType); 287 277 } 288 278 289 279 CastExpr::CastExpr( Expression *arg_, Expression *_aname ) : Expression( _aname ), arg(arg_) { 280 set_result( new VoidType( Type::Qualifiers() ) ); 290 281 } 291 282 … … 303 294 arg->print(os, indent+2); 304 295 os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl; 305 if ( results.empty() ) { 306 os << std::string( indent+2, ' ' ) << "nothing" << std::endl; 296 os << std::string( indent+2, ' ' ); 297 if ( result->isVoid() ) { 298 os << "nothing"; 307 299 } else { 308 printAll(results, os, indent+2);300 result->print( os, indent+2 ); 309 301 } // if 302 os << std::endl; 310 303 Expression::print( os, indent ); 311 304 } … … 338 331 MemberExpr::MemberExpr( DeclarationWithType *_member, Expression *_aggregate, Expression *_aname ) : 339 332 Expression( _aname ), member(_member), aggregate(_aggregate) { 340 add_result( member->get_type()->clone() ); 341 for ( std::list< Type* >::iterator i = get_results().begin(); i != get_results().end(); ++i ) { 342 (*i)->set_isLvalue( true ); 343 } // for 333 set_result( member->get_type()->clone() ); 334 get_result()->set_isLvalue( true ); 344 335 } 345 336 … … 419 410 LogicalExpr::LogicalExpr( Expression *arg1_, Expression *arg2_, bool andp, Expression *_aname ) : 420 411 Expression( _aname ), arg1(arg1_), arg2(arg2_), isAnd(andp) { 421 add_result( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) );412 set_result( new BasicType( Type::Qualifiers(), BasicType::SignedInt ) ); 422 413 } 423 414 … … 477 468 ImplicitCopyCtorExpr::ImplicitCopyCtorExpr( ApplicationExpr * callExpr ) : callExpr( callExpr ) { 478 469 assert( callExpr ); 479 cloneAll( callExpr->get_results(), results ); 470 assert( callExpr->has_result() ); 471 set_result( callExpr->get_result()->clone() ); 480 472 } 481 473 … … 510 502 Expression * arg = InitTweak::getCallArg( callExpr, 0 ); 511 503 assert( arg ); 512 cloneAll( arg->get_results(), results);504 set_result( maybeClone( arg->get_result() ) ); 513 505 } 514 506 … … 530 522 531 523 CompoundLiteralExpr::CompoundLiteralExpr( Type * type, Initializer * initializer ) : type( type ), initializer( initializer ) { 532 add_result( type->clone() );524 set_result( type->clone() ); 533 525 } 534 526 -
src/SynTree/Expression.h
r96a10cd r906e24d 32 32 virtual ~Expression(); 33 33 34 std::list<Type *>& get_results() { return results; } 35 void add_result( Type *t ); 34 Type *& get_result() { return result; } 35 void set_result( Type *newValue ) { result = newValue; } 36 bool has_result() const { return result != nullptr; } 36 37 37 38 TypeSubstitution *get_env() const { return env; } … … 47 48 virtual void print( std::ostream &os, int indent = 0 ) const; 48 49 protected: 49 std::list<Type *> results;50 Type * result; 50 51 TypeSubstitution *env; 51 52 Expression* argName; // if expression is used as an argument, it can be "designated" by this name -
src/SynTree/Mutator.cc
r96a10cd r906e24d 178 178 179 179 Expression *Mutator::mutate( ApplicationExpr *applicationExpr ) { 180 mutateAll( applicationExpr->get_results(), *this);180 applicationExpr->set_result( maybeMutate( applicationExpr->get_result(), *this ) ); 181 181 applicationExpr->set_function( maybeMutate( applicationExpr->get_function(), *this ) ); 182 182 mutateAll( applicationExpr->get_args(), *this ); … … 185 185 186 186 Expression *Mutator::mutate( UntypedExpr *untypedExpr ) { 187 mutateAll( untypedExpr->get_results(), *this);187 untypedExpr->set_result( maybeMutate( untypedExpr->get_result(), *this ) ); 188 188 mutateAll( untypedExpr->get_args(), *this ); 189 189 return untypedExpr; … … 191 191 192 192 Expression *Mutator::mutate( NameExpr *nameExpr ) { 193 mutateAll( nameExpr->get_results(), *this);193 nameExpr->set_result( maybeMutate( nameExpr->get_result(), *this ) ); 194 194 return nameExpr; 195 195 } 196 196 197 197 Expression *Mutator::mutate( AddressExpr *addressExpr ) { 198 mutateAll( addressExpr->get_results(), *this);198 addressExpr->set_result( maybeMutate( addressExpr->get_result(), *this ) ); 199 199 addressExpr->set_arg( maybeMutate( addressExpr->get_arg(), *this ) ); 200 200 return addressExpr; … … 202 202 203 203 Expression *Mutator::mutate( LabelAddressExpr *labelAddressExpr ) { 204 mutateAll( labelAddressExpr->get_results(), *this);204 labelAddressExpr->set_result( maybeMutate( labelAddressExpr->get_result(), *this ) ); 205 205 labelAddressExpr->set_arg( maybeMutate( labelAddressExpr->get_arg(), *this ) ); 206 206 return labelAddressExpr; … … 208 208 209 209 Expression *Mutator::mutate( CastExpr *castExpr ) { 210 mutateAll( castExpr->get_results(), *this);210 castExpr->set_result( maybeMutate( castExpr->get_result(), *this ) ); 211 211 castExpr->set_arg( maybeMutate( castExpr->get_arg(), *this ) ); 212 212 return castExpr; … … 214 214 215 215 Expression *Mutator::mutate( UntypedMemberExpr *memberExpr ) { 216 m utateAll( memberExpr->get_results(), *this);216 memberExpr->set_result( maybeMutate( memberExpr->get_result(), *this ) ); 217 217 memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) ); 218 218 return memberExpr; … … 220 220 221 221 Expression *Mutator::mutate( MemberExpr *memberExpr ) { 222 m utateAll( memberExpr->get_results(), *this);222 memberExpr->set_result( maybeMutate( memberExpr->get_result(), *this ) ); 223 223 memberExpr->set_aggregate( maybeMutate( memberExpr->get_aggregate(), *this ) ); 224 224 return memberExpr; … … 226 226 227 227 Expression *Mutator::mutate( VariableExpr *variableExpr ) { 228 mutateAll( variableExpr->get_results(), *this);228 variableExpr->set_result( maybeMutate( variableExpr->get_result(), *this ) ); 229 229 return variableExpr; 230 230 } 231 231 232 232 Expression *Mutator::mutate( ConstantExpr *constantExpr ) { 233 mutateAll( constantExpr->get_results(), *this);233 constantExpr->set_result( maybeMutate( constantExpr->get_result(), *this ) ); 234 234 // maybeMutate( constantExpr->get_constant(), *this ) 235 235 return constantExpr; … … 237 237 238 238 Expression *Mutator::mutate( SizeofExpr *sizeofExpr ) { 239 mutateAll( sizeofExpr->get_results(), *this);239 sizeofExpr->set_result( maybeMutate( sizeofExpr->get_result(), *this ) ); 240 240 if ( sizeofExpr->get_isType() ) { 241 241 sizeofExpr->set_type( maybeMutate( sizeofExpr->get_type(), *this ) ); … … 247 247 248 248 Expression *Mutator::mutate( AlignofExpr *alignofExpr ) { 249 mutateAll( alignofExpr->get_results(), *this);249 alignofExpr->set_result( maybeMutate( alignofExpr->get_result(), *this ) ); 250 250 if ( alignofExpr->get_isType() ) { 251 251 alignofExpr->set_type( maybeMutate( alignofExpr->get_type(), *this ) ); … … 257 257 258 258 Expression *Mutator::mutate( UntypedOffsetofExpr *offsetofExpr ) { 259 mutateAll( offsetofExpr->get_results(), *this);259 offsetofExpr->set_result( maybeMutate( offsetofExpr->get_result(), *this ) ); 260 260 offsetofExpr->set_type( maybeMutate( offsetofExpr->get_type(), *this ) ); 261 261 return offsetofExpr; … … 263 263 264 264 Expression *Mutator::mutate( OffsetofExpr *offsetofExpr ) { 265 mutateAll( offsetofExpr->get_results(), *this);265 offsetofExpr->set_result( maybeMutate( offsetofExpr->get_result(), *this ) ); 266 266 offsetofExpr->set_type( maybeMutate( offsetofExpr->get_type(), *this ) ); 267 267 offsetofExpr->set_member( maybeMutate( offsetofExpr->get_member(), *this ) ); … … 270 270 271 271 Expression *Mutator::mutate( OffsetPackExpr *offsetPackExpr ) { 272 mutateAll( offsetPackExpr->get_results(), *this);272 offsetPackExpr->set_result( maybeMutate( offsetPackExpr->get_result(), *this ) ); 273 273 offsetPackExpr->set_type( maybeMutate( offsetPackExpr->get_type(), *this ) ); 274 274 return offsetPackExpr; … … 276 276 277 277 Expression *Mutator::mutate( AttrExpr *attrExpr ) { 278 mutateAll( attrExpr->get_results(), *this);278 attrExpr->set_result( maybeMutate( attrExpr->get_result(), *this ) ); 279 279 if ( attrExpr->get_isType() ) { 280 280 attrExpr->set_type( maybeMutate( attrExpr->get_type(), *this ) ); … … 286 286 287 287 Expression *Mutator::mutate( LogicalExpr *logicalExpr ) { 288 mutateAll( logicalExpr->get_results(), *this);288 logicalExpr->set_result( maybeMutate( logicalExpr->get_result(), *this ) ); 289 289 logicalExpr->set_arg1( maybeMutate( logicalExpr->get_arg1(), *this ) ); 290 290 logicalExpr->set_arg2( maybeMutate( logicalExpr->get_arg2(), *this ) ); … … 293 293 294 294 Expression *Mutator::mutate( ConditionalExpr *conditionalExpr ) { 295 mutateAll( conditionalExpr->get_results(), *this);295 conditionalExpr->set_result( maybeMutate( conditionalExpr->get_result(), *this ) ); 296 296 conditionalExpr->set_arg1( maybeMutate( conditionalExpr->get_arg1(), *this ) ); 297 297 conditionalExpr->set_arg2( maybeMutate( conditionalExpr->get_arg2(), *this ) ); … … 301 301 302 302 Expression *Mutator::mutate( CommaExpr *commaExpr ) { 303 mutateAll( commaExpr->get_results(), *this);303 commaExpr->set_result( maybeMutate( commaExpr->get_result(), *this ) ); 304 304 commaExpr->set_arg1( maybeMutate( commaExpr->get_arg1(), *this ) ); 305 305 commaExpr->set_arg2( maybeMutate( commaExpr->get_arg2(), *this ) ); … … 308 308 309 309 Expression *Mutator::mutate( TupleExpr *tupleExpr ) { 310 mutateAll( tupleExpr->get_results(), *this);310 tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) ); 311 311 mutateAll( tupleExpr->get_exprs(), *this ); 312 312 return tupleExpr; … … 314 314 315 315 Expression *Mutator::mutate( SolvedTupleExpr *tupleExpr ) { 316 mutateAll( tupleExpr->get_results(), *this);316 tupleExpr->set_result( maybeMutate( tupleExpr->get_result(), *this ) ); 317 317 mutateAll( tupleExpr->get_exprs(), *this ); 318 318 return tupleExpr; … … 320 320 321 321 Expression *Mutator::mutate( TypeExpr *typeExpr ) { 322 mutateAll( typeExpr->get_results(), *this);322 typeExpr->set_result( maybeMutate( typeExpr->get_result(), *this ) ); 323 323 typeExpr->set_type( maybeMutate( typeExpr->get_type(), *this ) ); 324 324 return typeExpr; … … 340 340 341 341 Expression* Mutator::mutate( ConstructorExpr *ctorExpr ) { 342 mutateAll( ctorExpr->get_results(), *this);342 ctorExpr->set_result( maybeMutate( ctorExpr->get_result(), *this ) ); 343 343 ctorExpr->set_callExpr( maybeMutate( ctorExpr->get_callExpr(), *this ) ); 344 344 return ctorExpr; … … 346 346 347 347 Expression *Mutator::mutate( CompoundLiteralExpr *compLitExpr ) { 348 mutateAll( compLitExpr->get_results(), *this);348 compLitExpr->set_result( maybeMutate( compLitExpr->get_result(), *this ) ); 349 349 compLitExpr->set_type( maybeMutate( compLitExpr->get_type(), *this ) ); 350 350 compLitExpr->set_initializer( maybeMutate( compLitExpr->get_initializer(), *this ) ); … … 353 353 354 354 Expression *Mutator::mutate( UntypedValofExpr *valofExpr ) { 355 mutateAll( valofExpr->get_results(), *this);355 valofExpr->set_result( maybeMutate( valofExpr->get_result(), *this ) ); 356 356 return valofExpr; 357 357 } -
src/SynTree/Type.h
r96a10cd r906e24d 65 65 std::list<TypeDecl*>& get_forall() { return forall; } 66 66 67 /// How many elemental types are represented by this type 68 virtual unsigned size() const { return 1; }; 69 virtual bool isVoid() const { return size() == 0; } 70 67 71 virtual Type *clone() const = 0; 68 72 virtual void accept( Visitor &v ) = 0; … … 77 81 public: 78 82 VoidType( const Type::Qualifiers &tq ); 83 84 virtual unsigned size() const { return 0; }; 79 85 80 86 virtual VoidType *clone() const { return new VoidType( *this ); } … … 353 359 354 360 std::list<Type*>& get_types() { return types; } 361 virtual unsigned size() const { return types.size(); }; 355 362 356 363 virtual TupleType *clone() const { return new TupleType( *this ); } -
src/SynTree/Visitor.cc
r96a10cd r906e24d 150 150 151 151 void Visitor::visit( ApplicationExpr *applicationExpr ) { 152 acceptAll( applicationExpr->get_results(), *this );152 maybeAccept( applicationExpr->get_result(), *this ); 153 153 maybeAccept( applicationExpr->get_function(), *this ); 154 154 acceptAll( applicationExpr->get_args(), *this ); … … 156 156 157 157 void Visitor::visit( UntypedExpr *untypedExpr ) { 158 acceptAll( untypedExpr->get_results(), *this );158 maybeAccept( untypedExpr->get_result(), *this ); 159 159 acceptAll( untypedExpr->get_args(), *this ); 160 160 } 161 161 162 162 void Visitor::visit( NameExpr *nameExpr ) { 163 acceptAll( nameExpr->get_results(), *this );163 maybeAccept( nameExpr->get_result(), *this ); 164 164 } 165 165 166 166 void Visitor::visit( AddressExpr *addressExpr ) { 167 acceptAll( addressExpr->get_results(), *this );167 maybeAccept( addressExpr->get_result(), *this ); 168 168 maybeAccept( addressExpr->get_arg(), *this ); 169 169 } 170 170 171 171 void Visitor::visit( LabelAddressExpr *labAddressExpr ) { 172 acceptAll( labAddressExpr->get_results(), *this );172 maybeAccept( labAddressExpr->get_result(), *this ); 173 173 maybeAccept( labAddressExpr->get_arg(), *this ); 174 174 } 175 175 176 176 void Visitor::visit( CastExpr *castExpr ) { 177 acceptAll( castExpr->get_results(), *this );177 maybeAccept( castExpr->get_result(), *this ); 178 178 maybeAccept( castExpr->get_arg(), *this ); 179 179 } 180 180 181 181 void Visitor::visit( UntypedMemberExpr *memberExpr ) { 182 acceptAll( memberExpr->get_results(), *this );182 maybeAccept( memberExpr->get_result(), *this ); 183 183 maybeAccept( memberExpr->get_aggregate(), *this ); 184 184 } 185 185 186 186 void Visitor::visit( MemberExpr *memberExpr ) { 187 acceptAll( memberExpr->get_results(), *this );187 maybeAccept( memberExpr->get_result(), *this ); 188 188 maybeAccept( memberExpr->get_aggregate(), *this ); 189 189 } 190 190 191 191 void Visitor::visit( VariableExpr *variableExpr ) { 192 acceptAll( variableExpr->get_results(), *this );192 maybeAccept( variableExpr->get_result(), *this ); 193 193 } 194 194 195 195 void Visitor::visit( ConstantExpr *constantExpr ) { 196 acceptAll( constantExpr->get_results(), *this );196 maybeAccept( constantExpr->get_result(), *this ); 197 197 maybeAccept( constantExpr->get_constant(), *this ); 198 198 } 199 199 200 200 void Visitor::visit( SizeofExpr *sizeofExpr ) { 201 acceptAll( sizeofExpr->get_results(), *this );201 maybeAccept( sizeofExpr->get_result(), *this ); 202 202 if ( sizeofExpr->get_isType() ) { 203 203 maybeAccept( sizeofExpr->get_type(), *this ); … … 208 208 209 209 void Visitor::visit( AlignofExpr *alignofExpr ) { 210 acceptAll( alignofExpr->get_results(), *this );210 maybeAccept( alignofExpr->get_result(), *this ); 211 211 if ( alignofExpr->get_isType() ) { 212 212 maybeAccept( alignofExpr->get_type(), *this ); … … 217 217 218 218 void Visitor::visit( UntypedOffsetofExpr *offsetofExpr ) { 219 acceptAll( offsetofExpr->get_results(), *this );219 maybeAccept( offsetofExpr->get_result(), *this ); 220 220 maybeAccept( offsetofExpr->get_type(), *this ); 221 221 } 222 222 223 223 void Visitor::visit( OffsetofExpr *offsetofExpr ) { 224 acceptAll( offsetofExpr->get_results(), *this );224 maybeAccept( offsetofExpr->get_result(), *this ); 225 225 maybeAccept( offsetofExpr->get_type(), *this ); 226 226 maybeAccept( offsetofExpr->get_member(), *this ); … … 228 228 229 229 void Visitor::visit( OffsetPackExpr *offsetPackExpr ) { 230 acceptAll( offsetPackExpr->get_results(), *this );230 maybeAccept( offsetPackExpr->get_result(), *this ); 231 231 maybeAccept( offsetPackExpr->get_type(), *this ); 232 232 } 233 233 234 234 void Visitor::visit( AttrExpr *attrExpr ) { 235 acceptAll( attrExpr->get_results(), *this );235 maybeAccept( attrExpr->get_result(), *this ); 236 236 if ( attrExpr->get_isType() ) { 237 237 maybeAccept( attrExpr->get_type(), *this ); … … 242 242 243 243 void Visitor::visit( LogicalExpr *logicalExpr ) { 244 acceptAll( logicalExpr->get_results(), *this );244 maybeAccept( logicalExpr->get_result(), *this ); 245 245 maybeAccept( logicalExpr->get_arg1(), *this ); 246 246 maybeAccept( logicalExpr->get_arg2(), *this ); … … 248 248 249 249 void Visitor::visit( ConditionalExpr *conditionalExpr ) { 250 acceptAll( conditionalExpr->get_results(), *this );250 maybeAccept( conditionalExpr->get_result(), *this ); 251 251 maybeAccept( conditionalExpr->get_arg1(), *this ); 252 252 maybeAccept( conditionalExpr->get_arg2(), *this ); … … 255 255 256 256 void Visitor::visit( CommaExpr *commaExpr ) { 257 acceptAll( commaExpr->get_results(), *this );257 maybeAccept( commaExpr->get_result(), *this ); 258 258 maybeAccept( commaExpr->get_arg1(), *this ); 259 259 maybeAccept( commaExpr->get_arg2(), *this ); … … 261 261 262 262 void Visitor::visit( TupleExpr *tupleExpr ) { 263 acceptAll( tupleExpr->get_results(), *this );263 maybeAccept( tupleExpr->get_result(), *this ); 264 264 acceptAll( tupleExpr->get_exprs(), *this ); 265 265 } 266 266 267 267 void Visitor::visit( SolvedTupleExpr *tupleExpr ) { 268 acceptAll( tupleExpr->get_results(), *this );268 maybeAccept( tupleExpr->get_result(), *this ); 269 269 acceptAll( tupleExpr->get_exprs(), *this ); 270 270 } 271 271 272 272 void Visitor::visit( TypeExpr *typeExpr ) { 273 acceptAll( typeExpr->get_results(), *this );273 maybeAccept( typeExpr->get_result(), *this ); 274 274 maybeAccept( typeExpr->get_type(), *this ); 275 275 } … … 288 288 289 289 void Visitor::visit( ConstructorExpr * ctorExpr ) { 290 acceptAll( ctorExpr->get_results(), *this );290 maybeAccept( ctorExpr->get_result(), *this ); 291 291 maybeAccept( ctorExpr->get_callExpr(), *this ); 292 292 } 293 293 294 294 void Visitor::visit( CompoundLiteralExpr *compLitExpr ) { 295 acceptAll( compLitExpr->get_results(), *this );295 maybeAccept( compLitExpr->get_result(), *this ); 296 296 maybeAccept( compLitExpr->get_type(), *this ); 297 297 maybeAccept( compLitExpr->get_initializer(), *this ); … … 299 299 300 300 void Visitor::visit( UntypedValofExpr *valofExpr ) { 301 acceptAll( valofExpr->get_results(), *this );301 maybeAccept( valofExpr->get_result(), *this ); 302 302 maybeAccept( valofExpr->get_body(), *this ); 303 303 }
Note: See TracChangeset
for help on using the changeset viewer.