Changeset d63eeb0 for src/SynTree
- Timestamp:
- Feb 9, 2016, 3:25:05 PM (8 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, with_gc
- Children:
- 7528ba1
- Parents:
- 771b3c3 (diff), bd85400 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - Location:
- src/SynTree
- Files:
-
- 31 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/AddressExpr.cc
r771b3c3 rd63eeb0 16 16 #include "Expression.h" 17 17 #include "Type.h" 18 #include " utility.h"18 #include "Common/utility.h" 19 19 20 20 AddressExpr::AddressExpr( Expression *arg, Expression *_aname ) : Expression( _aname ), arg( arg ) { -
src/SynTree/AggregateDecl.cc
r771b3c3 rd63eeb0 16 16 #include "Declaration.h" 17 17 #include "Type.h" 18 #include " utility.h"18 #include "Common/utility.h" 19 19 20 20 -
src/SynTree/ApplicationExpr.cc
r771b3c3 rd63eeb0 20 20 #include "Type.h" 21 21 #include "TypeSubstitution.h" 22 #include " utility.h"22 #include "Common/utility.h" 23 23 24 24 -
src/SynTree/ArrayType.cc
r771b3c3 rd63eeb0 16 16 #include "Type.h" 17 17 #include "Expression.h" 18 #include " utility.h"18 #include "Common/utility.h" 19 19 20 20 -
src/SynTree/AttrType.cc
r771b3c3 rd63eeb0 16 16 #include "Type.h" 17 17 #include "Expression.h" 18 #include " utility.h"18 #include "Common/utility.h" 19 19 20 20 -
src/SynTree/CommaExpr.cc
r771b3c3 rd63eeb0 16 16 #include "Expression.h" 17 17 #include "Type.h" 18 #include " utility.h"18 #include "Common/utility.h" 19 19 20 20 CommaExpr::CommaExpr( Expression *arg1, Expression *arg2, Expression *_aname ) -
src/SynTree/CompoundStmt.cc
r771b3c3 rd63eeb0 15 15 16 16 #include "Statement.h" 17 #include " utility.h"17 #include "Common/utility.h" 18 18 #include <algorithm> 19 19 #include <functional> -
src/SynTree/DeclStmt.cc
r771b3c3 rd63eeb0 16 16 #include "Statement.h" 17 17 #include "Declaration.h" 18 #include " utility.h"18 #include "Common/utility.h" 19 19 20 20 DeclStmt::DeclStmt( std::list<Label> labels, Declaration *decl ) : Statement( labels ), decl( decl ) { -
src/SynTree/Declaration.cc
r771b3c3 rd63eeb0 20 20 #include "Initializer.h" 21 21 #include "Type.h" 22 #include " utility.h"22 #include "Common/utility.h" 23 23 24 24 static UniqueId lastUniqueId = 0; -
src/SynTree/DeclarationWithType.cc
r771b3c3 rd63eeb0 16 16 #include "Declaration.h" 17 17 #include "Type.h" 18 #include " utility.h"18 #include "Common/utility.h" 19 19 20 20 DeclarationWithType::DeclarationWithType( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage ) -
src/SynTree/Expression.cc
r771b3c3 rd63eeb0 26 26 #include "Statement.h" 27 27 #include "TypeSubstitution.h" 28 #include " utility.h"28 #include "Common/utility.h" 29 29 30 30 … … 103 103 SizeofExpr::SizeofExpr( Expression *expr_, Expression *_aname ) : 104 104 Expression( _aname ), expr(expr_), type(0), isType(false) { 105 add_result( new BasicType( Type::Qualifiers(), BasicType:: UnsignedInt ) );105 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 106 106 } 107 107 108 108 SizeofExpr::SizeofExpr( Type *type_, Expression *_aname ) : 109 109 Expression( _aname ), expr(0), type(type_), isType(true) { 110 add_result( new BasicType( Type::Qualifiers(), BasicType:: UnsignedInt ) );110 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 111 111 } 112 112 … … 134 134 AlignofExpr::AlignofExpr( Expression *expr_, Expression *_aname ) : 135 135 Expression( _aname ), expr(expr_), type(0), isType(false) { 136 add_result( new BasicType( Type::Qualifiers(), BasicType:: UnsignedInt ) );136 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 137 137 } 138 138 139 139 AlignofExpr::AlignofExpr( Type *type_, Expression *_aname ) : 140 140 Expression( _aname ), expr(0), type(type_), isType(true) { 141 add_result( new BasicType( Type::Qualifiers(), BasicType:: UnsignedInt ) );141 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 142 142 } 143 143 … … 158 158 else 159 159 expr->print(os, indent + 2); 160 161 os << std::endl; 162 Expression::print( os, indent ); 163 } 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 190 OffsetofExpr::OffsetofExpr( Type *type_, DeclarationWithType *member_, Expression *_aname ) : 191 Expression( _aname ), type(type_), member(member_) { 192 add_result( new BasicType( Type::Qualifiers(), BasicType::LongUnsignedInt ) ); 193 } 194 195 OffsetofExpr::OffsetofExpr( const OffsetofExpr &other ) : 196 Expression( other ), type( maybeClone( other.type ) ), member( maybeClone( other.member ) ) {} 197 198 OffsetofExpr::~OffsetofExpr() { 199 delete type; 200 delete member; 201 } 202 203 void OffsetofExpr::print( std::ostream &os, int indent) const { 204 os << std::string( indent, ' ' ) << "Offsetof Expression on member "; 205 206 if ( member ) { 207 os << member->get_name(); 208 } else { 209 os << "<NULL>"; 210 } 211 212 os << " of "; 213 214 if ( type ) { 215 type->print(os, indent + 2); 216 } else { 217 os << "<NULL>"; 218 } 160 219 161 220 os << std::endl; -
src/SynTree/Expression.h
r771b3c3 rd63eeb0 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 342 /// OffsetofExpr represents an offsetof expression 343 class OffsetofExpr : public Expression { 344 public: 345 OffsetofExpr( Type *type, DeclarationWithType *member, Expression *_aname = 0 ); 346 OffsetofExpr( const OffsetofExpr &other ); 347 virtual ~OffsetofExpr(); 348 349 Type *get_type() const { return type; } 350 void set_type( Type *newValue ) { type = newValue; } 351 DeclarationWithType *get_member() const { return member; } 352 void set_member( DeclarationWithType *newValue ) { member = newValue; } 353 354 virtual OffsetofExpr *clone() const { return new OffsetofExpr( *this ); } 355 virtual void accept( Visitor &v ) { v.visit( this ); } 356 virtual Expression *acceptMutator( Mutator &m ) { return m.mutate( this ); } 357 virtual void print( std::ostream &os, int indent = 0 ) const; 358 private: 359 Type *type; 360 DeclarationWithType *member; 361 }; 362 321 363 /// AttrExpr represents an @attribute expression (like sizeof, but user-defined) 322 364 class AttrExpr : public Expression { -
src/SynTree/FunctionDecl.cc
r771b3c3 rd63eeb0 19 19 #include "Statement.h" 20 20 #include "Type.h" 21 #include " utility.h"21 #include "Common/utility.h" 22 22 23 23 FunctionDecl::FunctionDecl( const std::string &name, DeclarationNode::StorageClass sc, LinkageSpec::Type linkage, FunctionType *type, CompoundStmt *statements, bool isInline, bool isNoreturn ) -
src/SynTree/FunctionType.cc
r771b3c3 rd63eeb0 18 18 #include "Type.h" 19 19 #include "Declaration.h" 20 #include " utility.h"20 #include "Common/utility.h" 21 21 22 22 FunctionType::FunctionType( const Type::Qualifiers &tq, bool isVarArgs ) : Type( tq ), isVarArgs( isVarArgs ) { -
src/SynTree/Initializer.cc
r771b3c3 rd63eeb0 16 16 #include "Initializer.h" 17 17 #include "Expression.h" 18 #include " utility.h"18 #include "Common/utility.h" 19 19 20 20 Initializer::Initializer( bool maybeConstructed ) : maybeConstructed( maybeConstructed ) {} -
src/SynTree/Initializer.h
r771b3c3 rd63eeb0 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jan 13 15:29:53201613 // Update Count : 1 712 // Last Modified On : Tue Feb 09 14:40:15 2016 13 // Update Count : 19 14 14 // 15 15 … … 58 58 class SingleInit : public Initializer { 59 59 public: 60 SingleInit( Expression *value, std::list< Expression *> &designators, bool maybeConstructed );60 SingleInit( Expression *value, std::list< Expression *> &designators, bool maybeConstructed = false ); 61 61 SingleInit( const SingleInit &other ); 62 62 virtual ~SingleInit(); … … 83 83 public: 84 84 ListInit( std::list<Initializer*> &, 85 std::list<Expression *> &designators, bool maybeConstructed );85 std::list<Expression *> &designators, bool maybeConstructed = false ); 86 86 virtual ~ListInit(); 87 87 -
src/SynTree/Mutator.cc
r771b3c3 rd63eeb0 22 22 #include "Expression.h" 23 23 #include "Constant.h" 24 #include " utility.h"24 #include "Common/utility.h" 25 25 26 26 Mutator::Mutator() {} … … 259 259 } 260 260 return alignofExpr; 261 } 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 269 Expression *Mutator::mutate( OffsetofExpr *offsetofExpr ) { 270 mutateAll( offsetofExpr->get_results(), *this ); 271 offsetofExpr->set_type( maybeMutate( offsetofExpr->get_type(), *this ) ); 272 offsetofExpr->set_member( maybeMutate( offsetofExpr->get_member(), *this ) ); 273 return offsetofExpr; 261 274 } 262 275 -
src/SynTree/Mutator.h
r771b3c3 rd63eeb0 16 16 17 17 #include "SynTree.h" 18 #include " SemanticError.h"18 #include "Common/SemanticError.h" 19 19 20 20 #ifndef MUTATOR_H … … 65 65 virtual Expression* mutate( SizeofExpr *sizeofExpr ); 66 66 virtual Expression* mutate( AlignofExpr *alignofExpr ); 67 virtual Expression* mutate( UntypedOffsetofExpr *offsetofExpr ); 68 virtual Expression* mutate( OffsetofExpr *offsetofExpr ); 67 69 virtual Expression* mutate( AttrExpr *attrExpr ); 68 70 virtual Expression* mutate( LogicalExpr *logicalExpr ); -
src/SynTree/NamedTypeDecl.cc
r771b3c3 rd63eeb0 16 16 #include "Declaration.h" 17 17 #include "Type.h" 18 #include " utility.h"18 #include "Common/utility.h" 19 19 20 20 NamedTypeDecl::NamedTypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *base ) -
src/SynTree/ObjectDecl.cc
r771b3c3 rd63eeb0 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jan 13 16:11:19201613 // Update Count : 2912 // Last Modified On : Tue Feb 09 13:21:03 2016 13 // Update Count : 30 14 14 // 15 15 … … 18 18 #include "Initializer.h" 19 19 #include "Expression.h" 20 #include " utility.h"20 #include "Common/utility.h" 21 21 #include "Statement.h" 22 22 -
src/SynTree/PointerType.cc
r771b3c3 rd63eeb0 16 16 #include "Type.h" 17 17 #include "Expression.h" 18 #include " utility.h"18 #include "Common/utility.h" 19 19 20 20 PointerType::PointerType( const Type::Qualifiers &tq, Type *base ) -
src/SynTree/ReferenceToType.cc
r771b3c3 rd63eeb0 21 21 #include "Expression.h" 22 22 #include "TypeSubstitution.h" 23 #include " utility.h"23 #include "Common/utility.h" 24 24 25 25 ReferenceToType::ReferenceToType( const Type::Qualifiers &tq, const std::string &name ) : Type( tq ), name( name ) { -
src/SynTree/SynTree.h
r771b3c3 rd63eeb0 70 70 class SizeofExpr; 71 71 class AlignofExpr; 72 class UntypedOffsetofExpr; 73 class OffsetofExpr; 72 74 class AttrExpr; 73 75 class LogicalExpr; -
src/SynTree/TupleExpr.cc
r771b3c3 rd63eeb0 15 15 16 16 #include "Expression.h" 17 #include " utility.h"17 #include "Common/utility.h" 18 18 19 19 TupleExpr::TupleExpr( Expression *_aname ) : Expression( _aname ) { -
src/SynTree/TupleType.cc
r771b3c3 rd63eeb0 15 15 16 16 #include "Type.h" 17 #include " utility.h"17 #include "Common/utility.h" 18 18 19 19 TupleType::TupleType( const Type::Qualifiers &tq ) : Type( tq ) { -
src/SynTree/Type.cc
r771b3c3 rd63eeb0 18 18 #include "Type.h" 19 19 #include "Declaration.h" 20 #include " utility.h"20 #include "Common/utility.h" 21 21 22 22 const char *BasicType::typeNames[BasicType::NUMBER_OF_BASIC_TYPES] = { -
src/SynTree/TypeDecl.cc
r771b3c3 rd63eeb0 16 16 #include "Declaration.h" 17 17 #include "Type.h" 18 #include " utility.h"18 #include "Common/utility.h" 19 19 20 20 TypeDecl::TypeDecl( const std::string &name, DeclarationNode::StorageClass sc, Type *type, Kind kind ) : Parent( name, sc, type ), kind( kind ) { -
src/SynTree/TypeExpr.cc
r771b3c3 rd63eeb0 16 16 #include "Expression.h" 17 17 #include "Type.h" 18 #include " utility.h"18 #include "Common/utility.h" 19 19 20 20 TypeExpr::TypeExpr( Type *type ) : type( type ) { -
src/SynTree/TypeofType.cc
r771b3c3 rd63eeb0 16 16 #include "Type.h" 17 17 #include "Expression.h" 18 #include " utility.h"18 #include "Common/utility.h" 19 19 20 20 TypeofType::TypeofType( const Type::Qualifiers &tq, Expression *expr ) : Type( tq ), expr( expr ) { -
src/SynTree/Visitor.cc
r771b3c3 rd63eeb0 219 219 } 220 220 221 void Visitor::visit( UntypedOffsetofExpr *offsetofExpr ) { 222 acceptAll( offsetofExpr->get_results(), *this ); 223 maybeAccept( offsetofExpr->get_type(), *this ); 224 } 225 226 void Visitor::visit( OffsetofExpr *offsetofExpr ) { 227 acceptAll( offsetofExpr->get_results(), *this ); 228 maybeAccept( offsetofExpr->get_type(), *this ); 229 maybeAccept( offsetofExpr->get_member(), *this ); 230 } 231 221 232 void Visitor::visit( AttrExpr *attrExpr ) { 222 233 acceptAll( attrExpr->get_results(), *this ); -
src/SynTree/Visitor.h
r771b3c3 rd63eeb0 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Rob Schluntz 12 // Last Modified On : Wed Jan 13 15:24:05201613 // Update Count : 512 // Last Modified On : Tue Feb 09 13:20:48 2016 13 // Update Count : 6 14 14 // 15 15 … … 18 18 19 19 #include "SynTree.h" 20 #include " SemanticError.h"21 #include "Com pilerError.h"20 #include "Common/SemanticError.h" 21 #include "Common/CompilerError.h" 22 22 23 23 class Visitor { … … 65 65 virtual void visit( SizeofExpr *sizeofExpr ); 66 66 virtual void visit( AlignofExpr *alignofExpr ); 67 virtual void visit( UntypedOffsetofExpr *offsetofExpr ); 68 virtual void visit( OffsetofExpr *offsetofExpr ); 67 69 virtual void visit( AttrExpr *attrExpr ); 68 70 virtual void visit( LogicalExpr *logicalExpr );
Note: See TracChangeset
for help on using the changeset viewer.