Changeset a08ba92 for translator/SynTree
- Timestamp:
- May 19, 2015, 4:58:14 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:
- 843054c2
- Parents:
- 01aeade
- Location:
- translator/SynTree
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/SynTree/AddressExpr.cc
r01aeade ra08ba92 10 10 // Created On : Sun May 17 23:54:44 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 18 07:48:14201513 // Update Count : 512 // Last Modified On : Tue May 19 16:52:51 2015 13 // Update Count : 6 14 14 // 15 15 … … 19 19 20 20 AddressExpr::AddressExpr( Expression *arg, Expression *_aname ) : Expression( _aname ), arg( arg ) { 21 21 for ( std::list< Type* >::const_iterator i = arg->get_results().begin(); i != arg->get_results().end(); ++i ) { 22 22 get_results().push_back( new PointerType( Type::Qualifiers(), (*i)->clone() ) ); 23 23 } // for 24 24 } 25 25 … … 28 28 29 29 AddressExpr::~AddressExpr() { 30 30 delete arg; 31 31 } 32 32 33 33 void AddressExpr::print( std::ostream &os, int indent ) const { 34 35 34 os << std::string( indent, ' ' ) << "Address of:" << std::endl; 35 if ( arg ) { 36 36 arg->print( os, indent+2 ); 37 37 } // if 38 38 } 39 39 -
translator/SynTree/AggregateDecl.cc
r01aeade ra08ba92 10 10 // Created On : Sun May 17 23:56:39 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 18 07:48:23201513 // Update Count : 412 // Last Modified On : Tue May 19 16:52:08 2015 13 // Update Count : 5 14 14 // 15 15 … … 23 23 24 24 AggregateDecl::AggregateDecl( const AggregateDecl &other ) : Parent( other ) { 25 26 25 cloneAll( other.members, members ); 26 cloneAll( other.parameters, parameters ); 27 27 } 28 28 29 29 AggregateDecl::~AggregateDecl() { 30 31 30 deleteAll( members ); 31 deleteAll( parameters ); 32 32 } 33 33 34 34 void AggregateDecl::print( std::ostream &os, int indent ) const { 35 36 35 using std::string; 36 using std::endl; 37 37 38 39 38 os << typeString() << " " << get_name(); 39 if ( ! parameters.empty() ) { 40 40 os << endl << string( indent+2, ' ' ) << "with parameters" << endl; 41 41 printAll( parameters, os, indent+4 ); 42 43 42 } // if 43 if ( ! members.empty() ) { 44 44 os << endl << string( indent+2, ' ' ) << "with members" << endl; 45 45 printAll( members, os, indent+4 ); 46 46 } // if 47 47 } 48 48 49 49 void AggregateDecl::printShort( std::ostream &os, int indent ) const { 50 51 50 using std::string; 51 using std::endl; 52 52 53 54 53 os << typeString() << " " << get_name(); 54 if ( ! parameters.empty() ) { 55 55 os << endl << string( indent+2, ' ' ) << "with parameters" << endl; 56 56 printAll( parameters, os, indent+4 ); 57 57 } // if 58 58 } 59 59 -
translator/SynTree/AttrType.cc
r01aeade ra08ba92 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // XXX.cc --7 // AttrType.cc.cc -- 8 8 // 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 18 07:53:48201513 // Update Count : 112 // Last Modified On : Tue May 19 16:41:51 2015 13 // Update Count : 2 14 14 // 15 15 -
translator/SynTree/CodeGenVisitor.cc
r01aeade ra08ba92 22 22 using namespace std; 23 23 24 void CodeGenVisitor::visit( Type *type ) { }24 void CodeGenVisitor::visit( Type *type ) { } 25 25 void CodeGenVisitor::visit( BasicType *basicType ) { } 26 26 … … 29 29 } 30 30 31 void CodeGenVisitor::visit( Expression *expr ) { }31 void CodeGenVisitor::visit( Expression *expr ) { } 32 32 33 33 void CodeGenVisitor::visit( ConstantExpr *cnst ) { -
translator/SynTree/Expression.cc
r01aeade ra08ba92 295 295 } 296 296 297 LogicalExpr::~LogicalExpr() {297 LogicalExpr::~LogicalExpr() { 298 298 delete arg1; 299 299 delete arg2; -
translator/SynTree/ReferenceToType.cc
r01aeade ra08ba92 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 18 10:49:00 201513 // Update Count : 212 // Last Modified On : Tue May 19 16:52:40 2015 13 // Update Count : 3 14 14 // 15 15 … … 27 27 28 28 ReferenceToType::ReferenceToType( const ReferenceToType &other ) : Type( other ), name( other.name ) { 29 29 cloneAll( other.parameters, parameters ); 30 30 } 31 31 32 32 ReferenceToType::~ReferenceToType() { 33 33 deleteAll( parameters ); 34 34 } 35 35 36 36 void ReferenceToType::print( std::ostream &os, int indent ) const { 37 38 39 40 41 37 using std::endl; 38 39 Type::print( os, indent ); 40 os << "instance of " << typeString() << " " << name << " "; 41 if ( ! parameters.empty() ) { 42 42 os << endl << std::string( indent, ' ' ) << "with parameters" << endl; 43 43 printAll( parameters, os, indent+2 ); 44 44 } // if 45 45 } 46 46 … … 60 60 61 61 void StructInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const { 62 63 62 assert( baseStruct ); 63 doLookup( baseStruct->get_members(), baseStruct->get_parameters(), parameters, name, foundDecls ); 64 64 } 65 65 … … 67 67 68 68 void UnionInstType::lookup( const std::string &name, std::list< Declaration* > &foundDecls ) const { 69 70 69 assert( baseUnion ); 70 doLookup( baseUnion->get_members(), baseUnion->get_parameters(), parameters, name, foundDecls ); 71 71 } 72 72 … … 76 76 77 77 ContextInstType::ContextInstType( const ContextInstType &other ) : Parent( other ) { 78 78 cloneAll( other.members, members ); 79 79 } 80 80 81 81 ContextInstType::~ContextInstType() { 82 82 deleteAll( members ); 83 83 } 84 84 85 85 TypeInstType::TypeInstType( const Type::Qualifiers &tq, const std::string &name, TypeDecl *baseType ) : Parent( tq, name ) { 86 86 set_baseType( baseType ); 87 87 } 88 88 … … 91 91 92 92 void TypeInstType::set_baseType( TypeDecl *newValue ) { 93 94 93 baseType = newValue; 94 isFtype = newValue->get_kind() == TypeDecl::Ftype; 95 95 } 96 96 … … 98 98 99 99 void TypeInstType::print( std::ostream &os, int indent ) const { 100 101 102 103 104 100 using std::endl; 101 102 Type::print( os, indent ); 103 os << "instance of " << typeString() << " " << get_name() << " (" << ( isFtype ? "" : "not" ) << " a function type) "; 104 if ( ! parameters.empty() ) { 105 105 os << endl << std::string( indent, ' ' ) << "with parameters" << endl; 106 106 printAll( parameters, os, indent+2 ); 107 107 } // if 108 108 } 109 109 -
translator/SynTree/Statement.cc
r01aeade ra08ba92 58 58 } 59 59 60 void BranchStmt::print( std::ostream &os, int indent ) {60 void BranchStmt::print( std::ostream &os, int indent ) { 61 61 os << "\r" << string( indent, ' ') << "Branch (" << brType[type] << ")" << endl ; 62 62 } … … 79 79 IfStmt::~IfStmt() {} 80 80 81 void IfStmt::print( std::ostream &os, int indent ) {81 void IfStmt::print( std::ostream &os, int indent ) { 82 82 os << "\r" << string( indent, ' ') << "If on condition: " << endl ; 83 83 condition->print( os, indent + 4 ); … … 175 175 } 176 176 177 WhileStmt::~WhileStmt() {177 WhileStmt::~WhileStmt() { 178 178 delete body; 179 179 } 180 180 181 void WhileStmt::print( std::ostream &os, int indent ) {181 void WhileStmt::print( std::ostream &os, int indent ) { 182 182 os << "\r" << string( indent, ' ') << "While on condition: " << endl ; 183 183 condition->print( os, indent + 4 ); … … 199 199 } 200 200 201 void ForStmt::print( std::ostream &os, int indent ) {201 void ForStmt::print( std::ostream &os, int indent ) { 202 202 os << "\r" << string( indent, ' ') << "For Statement" << endl ; 203 203 … … 231 231 } 232 232 233 TryStmt::~TryStmt() {233 TryStmt::~TryStmt() { 234 234 delete block; 235 235 } … … 257 257 } 258 258 259 CatchStmt::~CatchStmt() {259 CatchStmt::~CatchStmt() { 260 260 delete decl; 261 261 delete body; -
translator/SynTree/Type.cc
r01aeade ra08ba92 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon May 18 11:00:29201513 // Update Count : 112 // Last Modified On : Tue May 19 16:52:27 2015 13 // Update Count : 2 14 14 // 15 15 … … 21 21 22 22 const char *BasicType::typeNames[BasicType::NUMBER_OF_BASIC_TYPES] = { 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 23 "_Bool", 24 "char", 25 "char", 26 "unsigned char", 27 "short", 28 "short unsigned", 29 "int", 30 "unsigned int", 31 "long int", 32 "long unsigned int", 33 "long long int", 34 "long long unsigned int", 35 "float", 36 "double", 37 "long double", 38 "float _Complex", 39 "double _Complex", 40 "long double _Complex", 41 "float _Imaginary", 42 "double _Imaginary", 43 "long double _Imaginary", 44 44 }; 45 45 … … 47 47 48 48 Type::Type( const Type &other ) : tq( other.tq ) { 49 49 cloneAll( other.forall, forall ); 50 50 } 51 51 52 52 Type::~Type() { 53 53 deleteAll( forall ); 54 54 } 55 55 56 56 void Type::print( std::ostream &os, int indent ) const { 57 57 if ( ! forall.empty() ) { 58 58 os << "forall" << std::endl; 59 59 printAll( forall, os, indent + 4 ); 60 60 os << std::string( indent+2, ' ' ); 61 62 61 } // if 62 if ( tq.isConst ) { 63 63 os << "const "; 64 65 64 } // if 65 if ( tq.isVolatile ) { 66 66 os << "volatile "; 67 68 67 } // if 68 if ( tq.isRestrict ) { 69 69 os << "restrict "; 70 71 70 } // if 71 if ( tq.isLvalue ) { 72 72 os << "lvalue "; 73 74 73 } // if 74 if ( tq.isAtomic ) { 75 75 os << "_Atomic "; 76 76 } // if 77 77 } 78 78 -
translator/SynTree/Visitor.cc
r01aeade ra08ba92 111 111 } 112 112 113 void Visitor::visit( FallthruStmt *fallthruStmt ) {}113 void Visitor::visit( FallthruStmt *fallthruStmt ) {} 114 114 115 115 void Visitor::visit( CaseStmt *caseStmt ) {
Note: See TracChangeset
for help on using the changeset viewer.