Changeset afc1045 for src/SynTree
- Timestamp:
- Apr 5, 2016, 3:31:09 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- d75038c
- Parents:
- b3f9a0cb
- Location:
- src/SynTree
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
rb3f9a0cb rafc1045 222 222 } 223 223 224 OffsetPackExpr::OffsetPackExpr( StructInstType *type_, Expression *aname_ ) : Expression( aname_ ), type( type_ ) { 225 add_result( new ArrayType( Type::Qualifiers(), new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ), 0, false, false ) ); 226 } 227 228 OffsetPackExpr::OffsetPackExpr( const OffsetPackExpr &other ) : Expression( other ), type( maybeClone( other.type ) ) {} 229 230 OffsetPackExpr::~OffsetPackExpr() { delete type; } 231 232 void OffsetPackExpr::print( std::ostream &os, int indent ) const { 233 os << std::string( indent, ' ' ) << "Offset pack expression on "; 234 235 if ( type ) { 236 type->print(os, indent + 2); 237 } else { 238 os << "<NULL>"; 239 } 240 241 os << std::endl; 242 Expression::print( os, indent ); 243 } 244 224 245 AttrExpr::AttrExpr( Expression *attr, Expression *expr_, Expression *_aname ) : 225 246 Expression( _aname ), attr( attr ), expr(expr_), type(0), isType(false) { -
src/SynTree/Expression.h
rb3f9a0cb rafc1045 362 362 }; 363 363 364 /// Expression representing a pack of field-offsets for a generic type 365 class OffsetPackExpr : public Expression { 366 public: 367 OffsetPackExpr( StructInstType *type_, Expression *aname_ = 0 ); 368 OffsetPackExpr( const OffsetPackExpr &other ); 369 virtual ~OffsetPackExpr(); 370 371 StructInstType *get_type() const { return type; } 372 void set_type( StructInstType *newValue ) { type = newValue; } 373 374 virtual OffsetPackExpr *clone() const { return new OffsetPackExpr( *this ); } 375 virtual void accept( Visitor &v ) { v.visit( this ); } 376 virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); } 377 378 virtual void print( std::ostream &os, int indent = 0 ) const; 379 380 private: 381 StructInstType *type; 382 }; 383 364 384 /// AttrExpr represents an @attribute expression (like sizeof, but user-defined) 365 385 class AttrExpr : public Expression { -
src/SynTree/Mutator.cc
rb3f9a0cb rafc1045 274 274 } 275 275 276 Expression *Mutator::mutate( OffsetPackExpr *offsetPackExpr ) { 277 mutateAll( offsetPackExpr->get_results(), *this ); 278 offsetPackExpr->set_type( maybeMutate( offsetPackExpr->get_type(), *this ) ); 279 return offsetPackExpr; 280 } 281 276 282 Expression *Mutator::mutate( AttrExpr *attrExpr ) { 277 283 mutateAll( attrExpr->get_results(), *this ); -
src/SynTree/Mutator.h
rb3f9a0cb rafc1045 67 67 virtual Expression* mutate( UntypedOffsetofExpr *offsetofExpr ); 68 68 virtual Expression* mutate( OffsetofExpr *offsetofExpr ); 69 virtual Expression* mutate( OffsetPackExpr *offsetPackExpr ); 69 70 virtual Expression* mutate( AttrExpr *attrExpr ); 70 71 virtual Expression* mutate( LogicalExpr *logicalExpr ); -
src/SynTree/SynTree.h
rb3f9a0cb rafc1045 72 72 class UntypedOffsetofExpr; 73 73 class OffsetofExpr; 74 class OffsetPackExpr; 74 75 class AttrExpr; 75 76 class LogicalExpr; -
src/SynTree/Visitor.cc
rb3f9a0cb rafc1045 230 230 } 231 231 232 void Visitor::visit( OffsetPackExpr *offsetPackExpr ) { 233 acceptAll( offsetPackExpr->get_results(), *this ); 234 maybeAccept( offsetPackExpr->get_type(), *this ); 235 } 236 232 237 void Visitor::visit( AttrExpr *attrExpr ) { 233 238 acceptAll( attrExpr->get_results(), *this ); -
src/SynTree/Visitor.h
rb3f9a0cb rafc1045 67 67 virtual void visit( UntypedOffsetofExpr *offsetofExpr ); 68 68 virtual void visit( OffsetofExpr *offsetofExpr ); 69 virtual void visit( OffsetPackExpr *offsetPackExpr ); 69 70 virtual void visit( AttrExpr *attrExpr ); 70 71 virtual void visit( LogicalExpr *logicalExpr );
Note:
See TracChangeset
for help on using the changeset viewer.