Changeset e994912 for src/SynTree
- Timestamp:
- Feb 9, 2017, 3:17:29 PM (9 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:
- 6ef2d81, a073d46
- Parents:
- ea23d10
- Location:
- src/SynTree
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/Declaration.cc
rea23d10 re994912 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 18 23:49:57 201613 // Update Count : 1 312 // Last Modified On : Thu Feb 9 14:28:05 2017 13 // Update Count : 16 14 14 // 15 15 … … 66 66 67 67 68 AsmDecl::AsmDecl( AsmStmt *stmt ) : Declaration( "", DeclarationNode::NoStorageClass, LinkageSpec::C ), stmt( stmt ) { 69 } 70 71 AsmDecl::AsmDecl( const AsmDecl &other ) : Declaration( other ), stmt( maybeClone( other.stmt ) ) { 72 } 73 74 AsmDecl::~AsmDecl() { 75 delete stmt; 76 } 77 78 void AsmDecl::print( std::ostream &os, int indent ) const { 79 stmt->print( os, indent ); 80 } 81 82 void AsmDecl::printShort( std::ostream &os, int indent ) const { 83 stmt->print( os, indent ); 84 } 85 86 68 87 // Local Variables: // 69 88 // tab-width: 4 // -
src/SynTree/Declaration.h
rea23d10 re994912 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Fri Jan 20 15:07:29201713 // Update Count : 5 312 // Last Modified On : Thu Feb 9 14:27:08 2017 13 // Update Count : 56 14 14 // 15 15 … … 304 304 }; 305 305 306 class AsmDecl : public Declaration { 307 public: 308 AsmDecl( AsmStmt *stmt ); 309 AsmDecl( const AsmDecl &other ); 310 virtual ~AsmDecl(); 311 312 AsmStmt *get_stmt() { return stmt; } 313 void set_stmt( AsmStmt *newValue ) { stmt = newValue; } 314 315 virtual AsmDecl *clone() const { return new AsmDecl( *this ); } 316 virtual void accept( Visitor &v ) { v.visit( this ); } 317 virtual AsmDecl *acceptMutator( Mutator &m ) { return m.mutate( this ); } 318 virtual void print( std::ostream &os, int indent = 0 ) const; 319 virtual void printShort( std::ostream &os, int indent = 0 ) const; 320 private: 321 AsmStmt *stmt; 322 }; 323 306 324 std::ostream & operator<<( std::ostream & out, const Declaration * decl ); 307 325 std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data ); -
src/SynTree/Mutator.cc
rea23d10 re994912 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 4 11:23:21 201613 // Update Count : 1912 // Last Modified On : Thu Feb 9 14:22:56 2017 13 // Update Count : 20 14 14 // 15 15 … … 86 86 } 87 87 88 AsmDecl *Mutator::mutate( AsmDecl *asmDecl ) { 89 asmDecl->set_stmt( maybeMutate( asmDecl->get_stmt(), *this ) ); 90 return asmDecl; 91 } 92 93 88 94 CompoundStmt *Mutator::mutate( CompoundStmt *compoundStmt ) { 89 95 mutateAll( compoundStmt->get_kids(), *this ); … … 177 183 return impCtorDtorStmt; 178 184 } 185 179 186 180 187 Expression *Mutator::mutate( ApplicationExpr *applicationExpr ) { … … 433 440 } 434 441 442 435 443 Type *Mutator::mutate( VoidType *voidType ) { 436 444 mutateAll( voidType->get_forall(), *this ); … … 533 541 } 534 542 543 535 544 Initializer *Mutator::mutate( SingleInit *singleInit ) { 536 545 singleInit->set_value( singleInit->get_value()->acceptMutator( *this ) ); … … 551 560 } 552 561 562 553 563 Subrange *Mutator::mutate( Subrange *subrange ) { 554 564 return subrange; 555 565 } 566 556 567 557 568 Constant *Mutator::mutate( Constant *constant ) { -
src/SynTree/Mutator.h
rea23d10 re994912 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 3 16:59:45 201613 // Update Count : 1 212 // Last Modified On : Thu Feb 9 14:23:23 2017 13 // Update Count : 13 14 14 // 15 15 #include <cassert> … … 34 34 virtual TypeDecl* mutate( TypeDecl *typeDecl ); 35 35 virtual Declaration* mutate( TypedefDecl *typeDecl ); 36 virtual AsmDecl* mutate( AsmDecl *asmDecl ); 36 37 37 38 virtual CompoundStmt* mutate( CompoundStmt *compoundStmt ); -
src/SynTree/SynTree.h
rea23d10 re994912 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 3 17:02:34 201613 // Update Count : 712 // Last Modified On : Thu Feb 9 14:23:49 2017 13 // Update Count : 8 14 14 // 15 15 … … 36 36 class DtypeDecl; 37 37 class TypedefDecl; 38 class AsmDecl; 38 39 39 40 class Statement; -
src/SynTree/Visitor.cc
rea23d10 re994912 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Thu Aug 4 11:24:25 201613 // Update Count : 2 112 // Last Modified On : Thu Feb 9 14:19:22 2017 13 // Update Count : 22 14 14 // 15 15 … … 74 74 } 75 75 76 void Visitor::visit( AsmDecl *asmDecl ) { 77 maybeAccept( asmDecl->get_stmt(), *this ); 78 } 79 80 76 81 void Visitor::visit( CompoundStmt *compoundStmt ) { 77 82 acceptAll( compoundStmt->get_kids(), *this ); … … 148 153 maybeAccept( impCtorDtorStmt->get_callStmt(), *this ); 149 154 } 155 150 156 151 157 void Visitor::visit( ApplicationExpr *applicationExpr ) { … … 338 344 maybeAccept( uniqueExpr->get_expr(), *this ); 339 345 } 346 340 347 341 348 void Visitor::visit( VoidType *voidType ) { … … 422 429 } 423 430 431 424 432 void Visitor::visit( SingleInit *singleInit ) { 425 433 singleInit->get_value()->accept( *this ); … … 437 445 } 438 446 447 439 448 void Visitor::visit( Subrange *subrange ) {} 449 440 450 441 451 void Visitor::visit( Constant *constant ) {} -
src/SynTree/Visitor.h
rea23d10 re994912 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Aug 3 17:01:50 201613 // Update Count : 912 // Last Modified On : Thu Feb 9 14:23:24 2017 13 // Update Count : 10 14 14 // 15 15 … … 34 34 virtual void visit( TypeDecl *typeDecl ); 35 35 virtual void visit( TypedefDecl *typeDecl ); 36 virtual void visit( AsmDecl *asmDecl ); 36 37 37 38 virtual void visit( CompoundStmt *compoundStmt );
Note:
See TracChangeset
for help on using the changeset viewer.