Changeset 2a4b088 for src/SynTree
- Timestamp:
- Feb 2, 2016, 2:00:37 PM (10 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:
- 4789f44, b10c9959
- Parents:
- 5721a6d
- Location:
- src/SynTree
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Expression.cc
r5721a6d r2a4b088 163 163 } 164 164 165 UntypedOffsetofExpr::UntypedOffsetofExpr( Type *type_, const std::string &member_, Expression *_aname ) : 166 Expression( _aname ), type(type_), member(member_) { 167 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 168 } 169 170 UntypedOffsetofExpr::UntypedOffsetofExpr( const UntypedOffsetofExpr &other ) : 171 Expression( other ), type( maybeClone( other.type ) ), member( other.member ) {} 172 173 UntypedOffsetofExpr::~UntypedOffsetofExpr() { 174 delete type; 175 } 176 177 void UntypedOffsetofExpr::print( std::ostream &os, int indent) const { 178 os << std::string( indent, ' ' ) << "Untyped Offsetof Expression on member " << member << " of "; 179 180 if ( type ) { 181 type->print(os, indent + 2); 182 } else { 183 os << "<NULL>"; 184 } 185 186 os << std::endl; 187 Expression::print( os, indent ); 188 } 189 165 190 OffsetofExpr::OffsetofExpr( Type *type_, DeclarationWithType *member_, Expression *_aname ) : 166 191 Expression( _aname ), type(type_), member(member_) { -
src/SynTree/Expression.h
r5721a6d r2a4b088 319 319 }; 320 320 321 /// UntypedOffsetofExpr represents an offsetof expression before resolution 322 class UntypedOffsetofExpr : public Expression { 323 public: 324 UntypedOffsetofExpr( Type *type, const std::string &member, Expression *_aname = 0 ); 325 UntypedOffsetofExpr( const UntypedOffsetofExpr &other ); 326 virtual ~UntypedOffsetofExpr(); 327 328 std::string get_member() const { return member; } 329 void set_member( const std::string &newValue ) { member = newValue; } 330 Type *get_type() const { return type; } 331 void set_type( Type *newValue ) { type = newValue; } 332 333 virtual UntypedOffsetofExpr *clone() const { return new UntypedOffsetofExpr( *this ); } 334 virtual void accept( Visitor &v ) { v.visit( this ); } 335 virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); } 336 virtual void print( std::ostream &os, int indent = 0 ) const; 337 private: 338 Type *type; 339 std::string member; 340 }; 341 321 342 /// OffsetofExpr represents an offsetof expression 322 343 class OffsetofExpr : public Expression { -
src/SynTree/Mutator.cc
r5721a6d r2a4b088 261 261 } 262 262 263 Expression *Mutator::mutate( UntypedOffsetofExpr *offsetofExpr ) { 264 mutateAll( offsetofExpr->get_results(), *this ); 265 offsetofExpr->set_type( maybeMutate( offsetofExpr->get_type(), *this ) ); 266 return offsetofExpr; 267 } 268 263 269 Expression *Mutator::mutate( OffsetofExpr *offsetofExpr ) { 264 270 mutateAll( offsetofExpr->get_results(), *this ); -
src/SynTree/Mutator.h
r5721a6d r2a4b088 65 65 virtual Expression* mutate( SizeofExpr *sizeofExpr ); 66 66 virtual Expression* mutate( AlignofExpr *alignofExpr ); 67 virtual Expression* mutate( UntypedOffsetofExpr *offsetofExpr ); 67 68 virtual Expression* mutate( OffsetofExpr *offsetofExpr ); 68 69 virtual Expression* mutate( AttrExpr *attrExpr ); -
src/SynTree/SynTree.h
r5721a6d r2a4b088 70 70 class SizeofExpr; 71 71 class AlignofExpr; 72 class UntypedOffsetofExpr; 72 73 class OffsetofExpr; 73 74 class AttrExpr; -
src/SynTree/Visitor.cc
r5721a6d r2a4b088 219 219 } 220 220 221 void Visitor::visit( UntypedOffsetofExpr *offsetofExpr ) { 222 acceptAll( offsetofExpr->get_results(), *this ); 223 maybeAccept( offsetofExpr->get_type(), *this ); 224 } 225 221 226 void Visitor::visit( OffsetofExpr *offsetofExpr ) { 222 227 acceptAll( offsetofExpr->get_results(), *this ); -
src/SynTree/Visitor.h
r5721a6d r2a4b088 65 65 virtual void visit( SizeofExpr *sizeofExpr ); 66 66 virtual void visit( AlignofExpr *alignofExpr ); 67 virtual void visit( UntypedOffsetofExpr *offsetofExpr ); 67 68 virtual void visit( OffsetofExpr *offsetofExpr ); 68 69 virtual void visit( AttrExpr *attrExpr );
Note:
See TracChangeset
for help on using the changeset viewer.