Changeset 9236060 for src/SynTree
- Timestamp:
- Aug 14, 2017, 2:03:39 PM (8 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:
- 74b007ba
- Parents:
- fd344aa (diff), 54cd58b0 (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:
-
- 25 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SynTree/AddStmtVisitor.h
rfd344aa r9236060 10 10 // Created On : Wed Jun 22 12:05:48 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Tue Jul 12 17:50:32 201613 // Update Count : 812 // Last Modified On : Sat Jul 22 09:51:08 2017 13 // Update Count : 9 14 14 // 15 15 16 #ifndef ADD_STATEMENT_VISITOR_H 17 #define ADD_STATEMENT_VISITOR_H 16 #pragma once 18 17 19 18 #include <list> … … 42 41 }; 43 42 44 #endif // ADD_STATEMENT_VISITOR_H 43 // Local Variables: // 44 // tab-width: 4 // 45 // mode: c++ // 46 // compile-command: "make install" // 47 // End: // -
src/SynTree/AggregateDecl.cc
rfd344aa r9236060 10 10 // Created On : Sun May 17 23:56:39 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus Jun 27 15:30:00 201713 // Update Count : 2 112 // Last Modified On : Fri Aug 4 14:22:00 2017 13 // Update Count : 22 14 14 // 15 15 … … 40 40 using std::endl; 41 41 42 os << typeString() << " " << get_name(); 43 os << string( indent+2, ' ' ) << "with body " << has_body() << endl; 42 os << typeString() << " " << get_name() << ":"; 43 if ( get_linkage() != LinkageSpec::Cforall ) { 44 os << " " << LinkageSpec::linkageName( get_linkage() ); 45 } // if 46 os << " with body " << has_body() << endl; 44 47 45 48 if ( ! parameters.empty() ) { -
src/SynTree/Attribute.h
rfd344aa r9236060 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Jan 18 16:27:11201713 // Update Count : 3 812 // Last Modified On : Sat Jul 22 09:54:14 2017 13 // Update Count : 39 14 14 // 15 15 16 #ifndef GCC_ATTRIBUTE_H 17 #define GCC_ATTRIBUTE_H 16 #pragma once 18 17 19 18 #include "SynTree.h" … … 42 41 const std::list< Attribute * > noAttributes; 43 42 44 #endif45 46 43 // Local Variables: // 47 44 // tab-width: 4 // -
src/SynTree/BaseSyntaxNode.h
rfd344aa r9236060 14 14 // 15 15 16 #ifndef BASE_SYNTAX_NODE_H 17 #define BASE_SYNTAX_NODE_H 16 #pragma once 18 17 19 18 #include "Common/utility.h" … … 29 28 }; 30 29 31 #endif // BASE_SYNTAX_NODE_H32 33 30 // Local Variables: // 34 31 // tab-width: 4 // -
src/SynTree/Constant.cc
rfd344aa r9236060 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Jun 22 10:11:00 201713 // Update Count : 2 812 // Last Modified On : Fri Jul 14 14:50:00 2017 13 // Update Count : 29 14 14 // 15 15 … … 46 46 } 47 47 48 Constant Constant::null( Type * ptrtype ) { 49 if ( nullptr == ptrtype ) { 50 ptrtype = new PointerType( 51 Type::Qualifiers(), 52 new VoidType( Type::Qualifiers() ) 53 ); 54 } 55 56 return Constant( ptrtype, "0", (unsigned long long int)0 ); 57 } 58 48 59 unsigned long long Constant::get_ival() const { 49 60 assertf( safe_dynamic_cast<BasicType*>(type)->isInteger(), "Attempt to retrieve ival from non-integer constant." ); -
src/SynTree/Constant.h
rfd344aa r9236060 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Andrew Beach12 // Last Modified On : Thr Jun 22 10:13:00201713 // Update Count : 1 511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:54:46 2017 13 // Update Count : 17 14 14 // 15 15 16 #ifndef CONSTANT_H 17 #define CONSTANT_H 16 #pragma once 18 17 19 18 #include "SynTree.h" … … 44 43 static Constant from_double( double d ); 45 44 45 /// generates a null pointer value for the given type. void * if omitted. 46 static Constant null( Type * ptrtype = nullptr ); 47 46 48 virtual void accept( Visitor & v ) { v.visit( this ); } 47 49 virtual Constant * acceptMutator( Mutator & m ) { return m.mutate( this ); } … … 58 60 }; 59 61 60 #endif // CONSTANT_H61 62 62 // Local Variables: // 63 63 // tab-width: 4 // -
src/SynTree/Declaration.cc
rfd344aa r9236060 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Mar 16 07:49:18201713 // Update Count : 2 411 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Aug 9 14:38:00 2017 13 // Update Count : 25 14 14 // 15 15 … … 28 28 29 29 Declaration::Declaration( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage ) 30 : name( name ), storageClasses( scs ), linkage( linkage), uniqueId( 0 ) {30 : name( name ), linkage( linkage ), storageClasses( scs ), uniqueId( 0 ) { 31 31 } 32 32 33 33 Declaration::Declaration( const Declaration &other ) 34 : BaseSyntaxNode( other ), name( other.name ), storageClasses( other.storageClasses ), linkage( other.linkage), uniqueId( other.uniqueId ) {34 : BaseSyntaxNode( other ), name( other.name ), linkage( other.linkage ), extension( other.extension ), storageClasses( other.storageClasses ), uniqueId( other.uniqueId ) { 35 35 } 36 36 -
src/SynTree/Declaration.h
rfd344aa r9236060 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Tus Jun 27 15:31:00 2017 13 // Update Count : 122 14 // 15 16 #ifndef DECLARATION_H 17 #define DECLARATION_H 12 // Last Modified On : Wed Aug 9 14:45:00 2017 13 // Update Count : 126 14 // 15 16 #pragma once 18 17 19 18 #include <string> … … 28 27 class Declaration : public BaseSyntaxNode { 29 28 public: 29 std::string name; 30 LinkageSpec::Spec linkage; 31 bool extension = false; 32 30 33 Declaration( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage ); 31 34 Declaration( const Declaration &other ); … … 54 57 static void dumpIds( std::ostream &os ); 55 58 static Declaration *declFromId( UniqueId id ); 56 private: 57 std::string name; 59 60 private: 58 61 Type::StorageClasses storageClasses; 59 LinkageSpec::Spec linkage;60 62 UniqueId uniqueId; 61 bool extension = false;62 63 }; 63 64 64 65 class DeclarationWithType : public Declaration { 65 66 public: 66 DeclarationWithType( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, Type::FuncSpecifiers fs );67 DeclarationWithType( const DeclarationWithType &other );68 virtual ~DeclarationWithType();69 70 std::string get_mangleName() const { return mangleName; }71 DeclarationWithType * set_mangleName( std::string newValue ) { mangleName = newValue; return this; }72 73 std::string get_scopedMangleName() const { return mangleName + "_" + std::to_string(scopeLevel); }74 75 int get_scopeLevel() const { return scopeLevel; }76 DeclarationWithType * set_scopeLevel( int newValue ) { scopeLevel = newValue; return this; }77 78 ConstantExpr *get_asmName() const { return asmName; }79 DeclarationWithType * set_asmName( ConstantExpr *newValue ) { asmName = newValue; return this; }80 81 std::list< Attribute * >& get_attributes() { return attributes; }82 const std::list< Attribute * >& get_attributes() const { return attributes; }83 84 Type::FuncSpecifiers get_funcSpec() const { return fs; }85 //void set_functionSpecifiers( Type::FuncSpecifiers newValue ) { fs = newValue; }86 87 virtual DeclarationWithType *clone() const = 0;88 virtual DeclarationWithType *acceptMutator( Mutator &m ) = 0;89 90 virtual Type *get_type() const = 0;91 virtual void set_type(Type *) = 0;92 private:93 67 // this represents the type with all types and typedefs expanded it is generated by SymTab::Validate::Pass2 94 68 std::string mangleName; … … 98 72 ConstantExpr *asmName; 99 73 std::list< Attribute * > attributes; 74 75 DeclarationWithType( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, const std::list< Attribute * > & attributes, Type::FuncSpecifiers fs ); 76 DeclarationWithType( const DeclarationWithType &other ); 77 virtual ~DeclarationWithType(); 78 79 std::string get_mangleName() const { return mangleName; } 80 DeclarationWithType * set_mangleName( std::string newValue ) { mangleName = newValue; return this; } 81 82 std::string get_scopedMangleName() const { return mangleName + "_" + std::to_string(scopeLevel); } 83 84 int get_scopeLevel() const { return scopeLevel; } 85 DeclarationWithType * set_scopeLevel( int newValue ) { scopeLevel = newValue; return this; } 86 87 ConstantExpr *get_asmName() const { return asmName; } 88 DeclarationWithType * set_asmName( ConstantExpr *newValue ) { asmName = newValue; return this; } 89 90 std::list< Attribute * >& get_attributes() { return attributes; } 91 const std::list< Attribute * >& get_attributes() const { return attributes; } 92 93 Type::FuncSpecifiers get_funcSpec() const { return fs; } 94 //void set_functionSpecifiers( Type::FuncSpecifiers newValue ) { fs = newValue; } 95 96 virtual DeclarationWithType *clone() const = 0; 97 virtual DeclarationWithType *acceptMutator( Mutator &m ) = 0; 98 99 virtual Type *get_type() const = 0; 100 virtual void set_type(Type *) = 0; 101 102 private: 100 103 Type::FuncSpecifiers fs; 101 104 }; … … 104 107 typedef DeclarationWithType Parent; 105 108 public: 109 Type *type; 110 Initializer *init; 111 Expression *bitfieldWidth; 112 106 113 ObjectDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, Expression *bitfieldWidth, Type *type, Initializer *init, 107 114 const std::list< Attribute * > attributes = std::list< Attribute * >(), Type::FuncSpecifiers fs = Type::FuncSpecifiers() ); … … 123 130 virtual void print( std::ostream &os, int indent = 0 ) const; 124 131 virtual void printShort( std::ostream &os, int indent = 0 ) const; 125 private:126 Type *type;127 Initializer *init;128 Expression *bitfieldWidth;129 132 }; 130 133 … … 132 135 typedef DeclarationWithType Parent; 133 136 public: 137 FunctionType *type; 138 CompoundStmt *statements; 139 134 140 FunctionDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, FunctionType *type, CompoundStmt *statements, 135 141 const std::list< Attribute * > attributes = std::list< Attribute * >(), Type::FuncSpecifiers fs = Type::FuncSpecifiers() ); … … 150 156 virtual void print( std::ostream &os, int indent = 0 ) const; 151 157 virtual void printShort( std::ostream &os, int indent = 0 ) const; 152 private:153 FunctionType *type;154 CompoundStmt *statements;155 158 }; 156 159 … … 158 161 typedef Declaration Parent; 159 162 public: 163 Type *base; 164 std::list< TypeDecl* > parameters; 165 std::list< DeclarationWithType* > assertions; 166 160 167 NamedTypeDecl( const std::string &name, Type::StorageClasses scs, Type *type ); 161 168 NamedTypeDecl( const NamedTypeDecl &other ); … … 172 179 virtual void print( std::ostream &os, int indent = 0 ) const; 173 180 virtual void printShort( std::ostream &os, int indent = 0 ) const; 174 protected:175 private:176 Type *base;177 std::list< TypeDecl* > parameters;178 std::list< DeclarationWithType* > assertions;179 181 }; 180 182 … … 183 185 public: 184 186 enum Kind { Any, Dtype, Ftype, Ttype }; 187 188 Type * init; 189 bool sized; 190 185 191 /// Data extracted from a type decl 186 192 struct Data { … … 217 223 private: 218 224 Kind kind; 219 Type * init;220 bool sized;221 225 }; 222 226 … … 224 228 typedef NamedTypeDecl Parent; 225 229 public: 226 TypedefDecl( const std::string &name, Type::StorageClasses scs, Type *type ) : Parent( name, scs, type ) {}230 TypedefDecl( const std::string &name, Type::StorageClasses scs, Type *type, LinkageSpec::Spec spec = LinkageSpec::Cforall ) : Parent( name, scs, type ) { set_linkage( spec ); } 227 231 TypedefDecl( const TypedefDecl &other ) : Parent( other ) {} 228 232 … … 238 242 typedef Declaration Parent; 239 243 public: 240 AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall );241 AggregateDecl( const AggregateDecl &other );242 virtual ~AggregateDecl();243 244 std::list<Declaration*>& get_members() { return members; }245 std::list<TypeDecl*>& get_parameters() { return parameters; }246 247 std::list< Attribute * >& get_attributes() { return attributes; }248 const std::list< Attribute * >& get_attributes() const { return attributes; }249 250 bool has_body() const { return body; }251 AggregateDecl * set_body( bool body ) { AggregateDecl::body = body; return this; }252 253 virtual void print( std::ostream &os, int indent = 0 ) const;254 virtual void printShort( std::ostream &os, int indent = 0 ) const;255 protected:256 virtual std::string typeString() const = 0;257 258 private:259 244 std::list<Declaration*> members; 260 245 std::list<TypeDecl*> parameters; 261 246 bool body; 262 247 std::list< Attribute * > attributes; 248 249 AggregateDecl( const std::string &name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ); 250 AggregateDecl( const AggregateDecl &other ); 251 virtual ~AggregateDecl(); 252 253 std::list<Declaration*>& get_members() { return members; } 254 std::list<TypeDecl*>& get_parameters() { return parameters; } 255 256 std::list< Attribute * >& get_attributes() { return attributes; } 257 const std::list< Attribute * >& get_attributes() const { return attributes; } 258 259 bool has_body() const { return body; } 260 AggregateDecl * set_body( bool body ) { AggregateDecl::body = body; return this; } 261 262 virtual void print( std::ostream &os, int indent = 0 ) const; 263 virtual void printShort( std::ostream &os, int indent = 0 ) const; 264 protected: 265 virtual std::string typeString() const = 0; 263 266 }; 264 267 … … 266 269 typedef AggregateDecl Parent; 267 270 public: 268 StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ) {} 271 StructDecl( const std::string &name, DeclarationNode::Aggregate kind = DeclarationNode::Struct, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( kind ), tagged( false ), parent_name( "" ) {} 272 StructDecl( const std::string &name, const std::string *parent, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ), kind( DeclarationNode::Struct ), tagged( true ), parent_name( parent ? *parent : "" ) {} 269 273 StructDecl( const StructDecl &other ) : Parent( other ) {} 270 274 … … 273 277 bool is_thread() { return kind == DeclarationNode::Thread; } 274 278 279 // Tagged/Tree Structure Excetion 280 bool get_tagged() { return tagged; } 281 void set_tagged( bool newValue ) { tagged = newValue; } 282 bool has_parent() { return parent_name != ""; } 283 std::string get_parentName() { return parent_name; } 284 275 285 virtual StructDecl *clone() const { return new StructDecl( *this ); } 276 286 virtual void accept( Visitor &v ) { v.visit( this ); } … … 279 289 DeclarationNode::Aggregate kind; 280 290 virtual std::string typeString() const; 291 292 bool tagged; 293 std::string parent_name; 281 294 }; 282 295 … … 324 337 class AsmDecl : public Declaration { 325 338 public: 339 AsmStmt *stmt; 340 326 341 AsmDecl( AsmStmt *stmt ); 327 342 AsmDecl( const AsmDecl &other ); … … 336 351 virtual void print( std::ostream &os, int indent = 0 ) const; 337 352 virtual void printShort( std::ostream &os, int indent = 0 ) const; 338 private:339 AsmStmt *stmt;340 353 }; 341 354 342 355 std::ostream & operator<<( std::ostream & out, const Declaration * decl ); 343 356 std::ostream & operator<<( std::ostream & os, const TypeDecl::Data & data ); 344 345 #endif // DECLARATION_H346 357 347 358 // Local Variables: // -
src/SynTree/Expression.cc
rfd344aa r9236060 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Mar 30 16:41:13201713 // Update Count : 5 212 // Last Modified On : Tue Jul 25 14:15:47 2017 13 // Update Count : 54 14 14 // 15 15 … … 305 305 if ( result->isVoid() ) { 306 306 os << "nothing"; 307 } else { 308 result->print( os, indent+2 ); 309 } // if 310 os << std::endl; 311 Expression::print( os, indent ); 312 } 313 314 VirtualCastExpr::VirtualCastExpr( Expression *arg_, Type *toType ) : Expression(), arg(arg_) { 315 set_result(toType); 316 } 317 318 VirtualCastExpr::VirtualCastExpr( const VirtualCastExpr &other ) : Expression( other ), arg( maybeClone( other.arg ) ) { 319 } 320 321 VirtualCastExpr::~VirtualCastExpr() { 322 delete arg; 323 } 324 325 void VirtualCastExpr::print( std::ostream &os, int indent ) const { 326 os << "Virtual Cast of:" << std::endl << std::string( indent+2, ' ' ); 327 arg->print(os, indent+2); 328 os << std::endl << std::string( indent, ' ' ) << "to:" << std::endl; 329 os << std::string( indent+2, ' ' ); 330 if ( ! result ) { 331 os << "unknown"; 307 332 } else { 308 333 result->print( os, indent+2 ); -
src/SynTree/Expression.h
rfd344aa r9236060 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Mar 30 16:44:00 201713 // Update Count : 4 111 // Last Modified By : Andrew Beach 12 // Last Modified On : Fri Aug 8 11:54:00 2017 13 // Update Count : 44 14 14 // 15 15 16 #ifndef EXPRESSION_H 17 #define EXPRESSION_H 16 #pragma once 18 17 19 18 #include <map> … … 30 29 class Expression : public BaseSyntaxNode{ 31 30 public: 31 Type * result; 32 TypeSubstitution * env; 33 Expression * argName; // if expression is used as an argument, it can be "designated" by this name 34 bool extension = false; 35 32 36 Expression( Expression * _aname = nullptr ); 33 37 Expression( const Expression & other ); … … 50 54 virtual Expression * acceptMutator( Mutator & m ) = 0; 51 55 virtual void print( std::ostream & os, int indent = 0 ) const; 52 protected:53 Type * result;54 TypeSubstitution * env;55 Expression * argName; // if expression is used as an argument, it can be "designated" by this name56 bool extension = false;57 56 }; 58 57 … … 80 79 class ApplicationExpr : public Expression { 81 80 public: 82 ApplicationExpr( Expression * function, const std::list<Expression *> & args = std::list<Expression *>() ); 81 Expression * function; 82 83 ApplicationExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >() ); 83 84 ApplicationExpr( const ApplicationExpr & other ); 84 85 virtual ~ApplicationExpr(); … … 93 94 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 94 95 virtual void print( std::ostream & os, int indent = 0 ) const; 96 95 97 private: 96 Expression * function;97 98 std::list<Expression *> args; 98 99 InferredParams inferParams; … … 104 105 class UntypedExpr : public Expression { 105 106 public: 107 Expression * function; 108 std::list<Expression*> args; 109 106 110 UntypedExpr( Expression * function, const std::list<Expression *> & args = std::list< Expression * >(), Expression *_aname = nullptr ); 107 111 UntypedExpr( const UntypedExpr & other ); … … 124 128 virtual void print( std::ostream & os, int indent = 0 ) const; 125 129 virtual void printArgs(std::ostream & os, int indent = 0) const; 126 private:127 Expression * function;128 std::list<Expression*> args;129 130 }; 130 131 … … 132 133 class NameExpr : public Expression { 133 134 public: 135 std::string name; 136 134 137 NameExpr( std::string name, Expression *_aname = nullptr ); 135 138 NameExpr( const NameExpr & other ); … … 143 146 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 144 147 virtual void print( std::ostream & os, int indent = 0 ) const; 145 private:146 std::string name;147 148 }; 148 149 … … 153 154 class AddressExpr : public Expression { 154 155 public: 156 Expression * arg; 157 155 158 AddressExpr( Expression * arg, Expression *_aname = nullptr ); 156 159 AddressExpr( const AddressExpr & other ); … … 164 167 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 165 168 virtual void print( std::ostream & os, int indent = 0 ) const; 166 private:167 Expression * arg;168 169 }; 169 170 … … 171 172 class LabelAddressExpr : public Expression { 172 173 public: 174 Expression * arg; 175 173 176 LabelAddressExpr( Expression * arg ); 174 177 LabelAddressExpr( const LabelAddressExpr & other ); … … 182 185 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 183 186 virtual void print( std::ostream & os, int indent = 0 ) const; 184 private:185 Expression * arg;186 187 }; 187 188 … … 189 190 class CastExpr : public Expression { 190 191 public: 192 Expression * arg; 193 191 194 CastExpr( Expression * arg, Expression *_aname = nullptr ); 192 195 CastExpr( Expression * arg, Type * toType, Expression *_aname = nullptr ); … … 195 198 196 199 Expression * get_arg() const { return arg; } 197 void set_arg( Expression * newValue ) { arg = newValue; }200 void set_arg( Expression * newValue ) { arg = newValue; } 198 201 199 202 virtual CastExpr * clone() const { return new CastExpr( * this ); } … … 201 204 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 202 205 virtual void print( std::ostream & os, int indent = 0 ) const; 203 private: 206 }; 207 208 /// VirtualCastExpr repersents a virtual dynamic cast, e.g. (virtual exception)e 209 class VirtualCastExpr : public Expression { 210 public: 204 211 Expression * arg; 212 213 VirtualCastExpr( Expression * arg, Type * toType ); 214 VirtualCastExpr( const VirtualCastExpr & other ); 215 virtual ~VirtualCastExpr(); 216 217 Expression * get_arg() const { return arg; } 218 void set_arg( Expression * newValue ) { arg = newValue; } 219 220 virtual VirtualCastExpr * clone() const { return new VirtualCastExpr( * this ); } 221 virtual void accept( Visitor & v ) { v.visit( this ); } 222 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 223 virtual void print( std::ostream & os, int indent = 0 ) const; 205 224 }; 206 225 … … 208 227 class UntypedMemberExpr : public Expression { 209 228 public: 229 Expression * member; 230 Expression * aggregate; 231 210 232 UntypedMemberExpr( Expression * member, Expression * aggregate, Expression *_aname = nullptr ); 211 233 UntypedMemberExpr( const UntypedMemberExpr & other ); … … 221 243 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 222 244 virtual void print( std::ostream & os, int indent = 0 ) const; 223 private:224 Expression * member;225 Expression * aggregate;226 245 }; 227 246 … … 230 249 class MemberExpr : public Expression { 231 250 public: 251 DeclarationWithType * member; 252 Expression * aggregate; 253 232 254 MemberExpr( DeclarationWithType * member, Expression * aggregate, Expression *_aname = nullptr ); 233 255 MemberExpr( const MemberExpr & other ); … … 243 265 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 244 266 virtual void print( std::ostream & os, int indent = 0 ) const; 245 private:246 DeclarationWithType * member;247 Expression * aggregate;248 267 }; 249 268 … … 252 271 class VariableExpr : public Expression { 253 272 public: 273 DeclarationWithType * var; 274 254 275 VariableExpr( DeclarationWithType * var, Expression *_aname = nullptr ); 255 276 VariableExpr( const VariableExpr & other ); … … 265 286 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 266 287 virtual void print( std::ostream & os, int indent = 0 ) const; 267 private:268 DeclarationWithType * var;269 288 }; 270 289 … … 272 291 class ConstantExpr : public Expression { 273 292 public: 293 Constant constant; 294 274 295 ConstantExpr( Constant constant, Expression *_aname = nullptr ); 275 296 ConstantExpr( const ConstantExpr & other ); … … 283 304 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 284 305 virtual void print( std::ostream & os, int indent = 0 ) const; 285 private:286 Constant constant;287 306 }; 288 307 … … 290 309 class SizeofExpr : public Expression { 291 310 public: 311 Expression * expr; 312 Type * type; 313 bool isType; 314 292 315 SizeofExpr( Expression * expr, Expression *_aname = nullptr ); 293 316 SizeofExpr( const SizeofExpr & other ); … … 306 329 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 307 330 virtual void print( std::ostream & os, int indent = 0 ) const; 308 private: 331 }; 332 333 /// AlignofExpr represents an alignof expression 334 class AlignofExpr : public Expression { 335 public: 309 336 Expression * expr; 310 337 Type * type; 311 338 bool isType; 312 }; 313 314 /// AlignofExpr represents an alignof expression 315 class AlignofExpr : public Expression { 316 public: 339 317 340 AlignofExpr( Expression * expr, Expression *_aname = nullptr ); 318 341 AlignofExpr( const AlignofExpr & other ); … … 331 354 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 332 355 virtual void print( std::ostream & os, int indent = 0 ) const; 333 private:334 Expression * expr;335 Type * type;336 bool isType;337 356 }; 338 357 … … 340 359 class UntypedOffsetofExpr : public Expression { 341 360 public: 361 Type * type; 362 std::string member; 363 342 364 UntypedOffsetofExpr( Type * type, const std::string & member, Expression *_aname = nullptr ); 343 365 UntypedOffsetofExpr( const UntypedOffsetofExpr & other ); … … 353 375 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 354 376 virtual void print( std::ostream & os, int indent = 0 ) const; 355 private:356 Type * type;357 std::string member;358 377 }; 359 378 … … 361 380 class OffsetofExpr : public Expression { 362 381 public: 382 Type * type; 383 DeclarationWithType * member; 384 363 385 OffsetofExpr( Type * type, DeclarationWithType * member, Expression *_aname = nullptr ); 364 386 OffsetofExpr( const OffsetofExpr & other ); … … 374 396 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 375 397 virtual void print( std::ostream & os, int indent = 0 ) const; 376 private:377 Type * type;378 DeclarationWithType * member;379 398 }; 380 399 … … 382 401 class OffsetPackExpr : public Expression { 383 402 public: 403 StructInstType * type; 404 384 405 OffsetPackExpr( StructInstType * type_, Expression * aname_ = 0 ); 385 406 OffsetPackExpr( const OffsetPackExpr & other ); … … 392 413 virtual void accept( Visitor & v ) { v.visit( this ); } 393 414 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 394 395 virtual void print( std::ostream & os, int indent = 0 ) const; 396 397 private: 398 StructInstType * type; 415 virtual void print( std::ostream & os, int indent = 0 ) const; 399 416 }; 400 417 … … 402 419 class AttrExpr : public Expression { 403 420 public: 421 Expression * attr; 422 Expression * expr; 423 Type * type; 424 bool isType; 425 404 426 AttrExpr(Expression * attr, Expression * expr, Expression *_aname = nullptr ); 405 427 AttrExpr( const AttrExpr & other ); … … 420 442 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 421 443 virtual void print( std::ostream & os, int indent = 0 ) const; 422 private:423 Expression * attr;424 Expression * expr;425 Type * type;426 bool isType;427 444 }; 428 445 … … 430 447 class LogicalExpr : public Expression { 431 448 public: 449 Expression * arg1; 450 Expression * arg2; 451 432 452 LogicalExpr( Expression * arg1, Expression * arg2, bool andp = true, Expression *_aname = nullptr ); 433 453 LogicalExpr( const LogicalExpr & other ); … … 444 464 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 445 465 virtual void print( std::ostream & os, int indent = 0 ) const; 466 446 467 private: 468 bool isAnd; 469 }; 470 471 /// ConditionalExpr represents the three-argument conditional ( p ? a : b ) 472 class ConditionalExpr : public Expression { 473 public: 447 474 Expression * arg1; 448 475 Expression * arg2; 449 bool isAnd; 450 }; 451 452 /// ConditionalExpr represents the three-argument conditional ( p ? a : b ) 453 class ConditionalExpr : public Expression { 454 public: 476 Expression * arg3; 477 455 478 ConditionalExpr( Expression * arg1, Expression * arg2, Expression * arg3, Expression *_aname = nullptr ); 456 479 ConditionalExpr( const ConditionalExpr & other ); … … 468 491 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 469 492 virtual void print( std::ostream & os, int indent = 0 ) const; 470 private: 493 }; 494 495 /// CommaExpr represents the sequence operator ( a, b ) 496 class CommaExpr : public Expression { 497 public: 471 498 Expression * arg1; 472 499 Expression * arg2; 473 Expression * arg3; 474 }; 475 476 /// CommaExpr represents the sequence operator ( a, b ) 477 class CommaExpr : public Expression { 478 public: 500 479 501 CommaExpr( Expression * arg1, Expression * arg2, Expression *_aname = nullptr ); 480 502 CommaExpr( const CommaExpr & other ); … … 490 512 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 491 513 virtual void print( std::ostream & os, int indent = 0 ) const; 492 private:493 Expression * arg1;494 Expression * arg2;495 514 }; 496 515 … … 498 517 class TypeExpr : public Expression { 499 518 public: 519 Type * type; 520 500 521 TypeExpr( Type * type ); 501 522 TypeExpr( const TypeExpr & other ); … … 509 530 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 510 531 virtual void print( std::ostream & os, int indent = 0 ) const; 511 private:512 Type * type;513 532 }; 514 533 … … 516 535 class AsmExpr : public Expression { 517 536 public: 537 Expression * inout; 538 ConstantExpr * constraint; 539 Expression * operand; 540 518 541 AsmExpr( Expression * inout, ConstantExpr * constraint, Expression * operand ) : inout( inout ), constraint( constraint ), operand( operand ) {} 519 542 AsmExpr( const AsmExpr & other ); … … 533 556 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 534 557 virtual void print( std::ostream & os, int indent = 0 ) const; 535 private: 558 536 559 // https://gcc.gnu.org/onlinedocs/gcc-4.7.1/gcc/Machine-Constraints.html#Machine-Constraints 537 Expression * inout;538 ConstantExpr * constraint;539 Expression * operand;540 560 }; 541 561 … … 544 564 class ImplicitCopyCtorExpr : public Expression { 545 565 public: 546 ImplicitCopyCtorExpr( ApplicationExpr * callExpr );547 ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other );548 virtual ~ImplicitCopyCtorExpr();549 550 ApplicationExpr * get_callExpr() const { return callExpr; }551 void set_callExpr( ApplicationExpr * newValue ) { callExpr = newValue; }552 553 std::list< ObjectDecl * > & get_tempDecls() { return tempDecls; }554 std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; }555 std::list< Expression * > & get_dtors() { return dtors; }556 557 virtual ImplicitCopyCtorExpr * clone() const { return new ImplicitCopyCtorExpr( * this ); }558 virtual void accept( Visitor & v ) { v.visit( this ); }559 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); }560 virtual void print( std::ostream & os, int indent = 0 ) const;561 private:562 566 ApplicationExpr * callExpr; 563 567 std::list< ObjectDecl * > tempDecls; 564 568 std::list< ObjectDecl * > returnDecls; 565 569 std::list< Expression * > dtors; 570 571 ImplicitCopyCtorExpr( ApplicationExpr * callExpr ); 572 ImplicitCopyCtorExpr( const ImplicitCopyCtorExpr & other ); 573 virtual ~ImplicitCopyCtorExpr(); 574 575 ApplicationExpr * get_callExpr() const { return callExpr; } 576 void set_callExpr( ApplicationExpr * newValue ) { callExpr = newValue; } 577 578 std::list< ObjectDecl * > & get_tempDecls() { return tempDecls; } 579 std::list< ObjectDecl * > & get_returnDecls() { return returnDecls; } 580 std::list< Expression * > & get_dtors() { return dtors; } 581 582 virtual ImplicitCopyCtorExpr * clone() const { return new ImplicitCopyCtorExpr( * this ); } 583 virtual void accept( Visitor & v ) { v.visit( this ); } 584 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 585 virtual void print( std::ostream & os, int indent = 0 ) const; 566 586 }; 567 587 … … 569 589 class ConstructorExpr : public Expression { 570 590 public: 591 Expression * callExpr; 592 571 593 ConstructorExpr( Expression * callExpr ); 572 594 ConstructorExpr( const ConstructorExpr & other ); … … 580 602 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 581 603 virtual void print( std::ostream & os, int indent = 0 ) const; 582 private:583 Expression * callExpr;584 604 }; 585 605 … … 587 607 class CompoundLiteralExpr : public Expression { 588 608 public: 609 Initializer * initializer; 610 589 611 CompoundLiteralExpr( Type * type, Initializer * initializer ); 590 612 CompoundLiteralExpr( const CompoundLiteralExpr & other ); … … 598 620 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 599 621 virtual void print( std::ostream & os, int indent = 0 ) const; 600 private:601 Initializer * initializer;602 622 }; 603 623 … … 605 625 class RangeExpr : public Expression { 606 626 public: 627 Expression * low, * high; 628 607 629 RangeExpr( Expression * low, Expression * high ); 608 630 RangeExpr( const RangeExpr & other ); … … 617 639 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 618 640 virtual void print( std::ostream & os, int indent = 0 ) const; 619 private:620 Expression * low, * high;621 641 }; 622 642 … … 624 644 class UntypedTupleExpr : public Expression { 625 645 public: 646 std::list<Expression*> exprs; 647 626 648 UntypedTupleExpr( const std::list< Expression * > & exprs, Expression *_aname = nullptr ); 627 649 UntypedTupleExpr( const UntypedTupleExpr & other ); … … 634 656 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 635 657 virtual void print( std::ostream & os, int indent = 0 ) const; 636 private:637 std::list<Expression*> exprs;638 658 }; 639 659 … … 641 661 class TupleExpr : public Expression { 642 662 public: 663 std::list<Expression*> exprs; 664 643 665 TupleExpr( const std::list< Expression * > & exprs, Expression *_aname = nullptr ); 644 666 TupleExpr( const TupleExpr & other ); … … 651 673 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 652 674 virtual void print( std::ostream & os, int indent = 0 ) const; 653 private:654 std::list<Expression*> exprs;655 675 }; 656 676 … … 658 678 class TupleIndexExpr : public Expression { 659 679 public: 680 Expression * tuple; 681 unsigned int index; 682 660 683 TupleIndexExpr( Expression * tuple, unsigned int index ); 661 684 TupleIndexExpr( const TupleIndexExpr & other ); … … 671 694 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 672 695 virtual void print( std::ostream & os, int indent = 0 ) const; 673 private:674 Expression * tuple;675 unsigned int index;676 696 }; 677 697 … … 679 699 class TupleAssignExpr : public Expression { 680 700 public: 701 StmtExpr * stmtExpr = nullptr; 702 681 703 TupleAssignExpr( const std::list< Expression * > & assigns, const std::list< ObjectDecl * > & tempDecls, Expression * _aname = nullptr ); 682 704 TupleAssignExpr( const TupleAssignExpr & other ); … … 690 712 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 691 713 virtual void print( std::ostream & os, int indent = 0 ) const; 692 private:693 StmtExpr * stmtExpr = nullptr;694 714 }; 695 715 … … 697 717 class StmtExpr : public Expression { 698 718 public: 719 CompoundStmt * statements; 720 std::list< ObjectDecl * > returnDecls; // return variable(s) for stmt expression 721 std::list< Expression * > dtors; // destructor(s) for return variable(s) 722 699 723 StmtExpr( CompoundStmt * statements ); 700 724 StmtExpr( const StmtExpr & other ); … … 711 735 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 712 736 virtual void print( std::ostream & os, int indent = 0 ) const; 713 private:714 CompoundStmt * statements;715 std::list< ObjectDecl * > returnDecls; // return variable(s) for stmt expression716 std::list< Expression * > dtors; // destructor(s) for return variable(s)717 737 }; 718 738 719 739 class UniqueExpr : public Expression { 720 740 public: 741 Expression * expr; 742 ObjectDecl * object; 743 VariableExpr * var; 744 721 745 UniqueExpr( Expression * expr, long long idVal = -1 ); 722 746 UniqueExpr( const UniqueExpr & other ); … … 738 762 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 739 763 virtual void print( std::ostream & os, int indent = 0 ) const; 764 740 765 private: 741 Expression * expr;742 ObjectDecl * object;743 VariableExpr * var;744 766 int id; 745 767 static long long count; … … 758 780 class UntypedInitExpr : public Expression { 759 781 public: 782 Expression * expr; 783 std::list<InitAlternative> initAlts; 784 760 785 UntypedInitExpr( Expression * expr, const std::list<InitAlternative> & initAlts ); 761 786 UntypedInitExpr( const UntypedInitExpr & other ); … … 771 796 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 772 797 virtual void print( std::ostream & os, int indent = 0 ) const; 773 private:774 Expression * expr;775 std::list<InitAlternative> initAlts;776 798 }; 777 799 778 800 class InitExpr : public Expression { 779 801 public: 802 Expression * expr; 803 Designation * designation; 804 780 805 InitExpr( Expression * expr, Designation * designation ); 781 806 InitExpr( const InitExpr & other ); … … 792 817 virtual Expression * acceptMutator( Mutator & m ) { return m.mutate( this ); } 793 818 virtual void print( std::ostream & os, int indent = 0 ) const; 794 private:795 Expression * expr;796 Designation * designation;797 819 }; 798 820 799 821 800 822 std::ostream & operator<<( std::ostream & out, const Expression * expr ); 801 802 #endif // EXPRESSION_H803 823 804 824 // Local Variables: // -
src/SynTree/Initializer.cc
rfd344aa r9236060 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri May 13 13:23:03201613 // Update Count : 2 811 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Aug 3 11:33:00 2016 13 // Update Count : 29 14 14 // 15 15 … … 74 74 } 75 75 } 76 assertf( initializers.size() == designations.size(), "Created ListInit with mismatching initializers (% d) and designations (%d)", initializers.size(), designations.size() );76 assertf( initializers.size() == designations.size(), "Created ListInit with mismatching initializers (%lu) and designations (%lu)", initializers.size(), designations.size() ); 77 77 } 78 78 -
src/SynTree/Initializer.h
rfd344aa r9236060 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Mar 23 16:12:42201713 // Update Count : 2 011 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Aug 9 10:19:00 2017 13 // Update Count : 22 14 14 // 15 15 16 #ifndef INITIALIZER_H 17 #define INITIALIZER_H 16 #pragma once 18 17 19 18 #include <cassert> … … 28 27 class Designation : public BaseSyntaxNode { 29 28 public: 29 std::list< Expression * > designators; 30 30 31 Designation( const std::list< Expression * > & designators ); 31 32 Designation( const Designation & other ); … … 38 39 virtual Designation * acceptMutator( Mutator &m ) { return m.mutate( this ); } 39 40 virtual void print( std::ostream &os, int indent = 0 ) const; 40 private:41 std::list< Expression * > designators;42 41 }; 43 42 … … 64 63 class SingleInit : public Initializer { 65 64 public: 65 //Constant *value; 66 Expression *value; // has to be a compile-time constant 67 66 68 SingleInit( Expression *value, bool maybeConstructed = false ); 67 69 SingleInit( const SingleInit &other ); … … 75 77 virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); } 76 78 virtual void print( std::ostream &os, int indent = 0 ) const; 77 private:78 //Constant *value;79 Expression *value; // has to be a compile-time constant80 79 }; 81 80 … … 84 83 class ListInit : public Initializer { 85 84 public: 85 std::list<Initializer *> initializers; // order *is* important 86 std::list<Designation *> designations; // order/length is consistent with initializers 87 86 88 ListInit( const std::list<Initializer*> &initializers, 87 89 const std::list<Designation *> &designators = {}, bool maybeConstructed = false ); … … 103 105 virtual Initializer *acceptMutator( Mutator &m ) { return m.mutate( this ); } 104 106 virtual void print( std::ostream &os, int indent = 0 ) const; 105 private:106 std::list<Initializer *> initializers; // order *is* important107 std::list<Designation *> designations; // order/length is consistent with initializers108 107 }; 109 108 … … 114 113 class ConstructorInit : public Initializer { 115 114 public: 115 Statement * ctor; 116 Statement * dtor; 117 116 118 ConstructorInit( Statement * ctor, Statement * dtor, Initializer * init ); 117 119 ConstructorInit( const ConstructorInit &other ); … … 131 133 132 134 private: 133 Statement * ctor;134 Statement * dtor;135 135 // C-style initializer made up of SingleInit and ListInit nodes to use as a fallback 136 136 // if an appropriate constructor definition is not found by the resolver … … 141 141 std::ostream & operator<<( std::ostream & out, const Designation * des ); 142 142 143 #endif // INITIALIZER_H144 145 143 // Local Variables: // 146 144 // tab-width: 4 // -
src/SynTree/Label.h
rfd344aa r9236060 10 10 // Created On : Wed Jun 8 12:53:12 2016 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : S un Aug 7 14:44:29 201613 // Update Count : 212 // Last Modified On : Sat Jul 22 09:52:44 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef LABEL_H 17 #define LABEL_H 16 #pragma once 18 17 19 18 #include <string> … … 51 50 static const std::list< Label > noLabels; 52 51 53 #endif // LABEL_H54 55 52 // Local Variables: // 56 53 // tab-width: 4 // -
src/SynTree/Mutator.cc
rfd344aa r9236060 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Jun 22 13:43:00 201713 // Update Count : 2 412 // Last Modified On : Mon Jul 24 16:32:00 2017 13 // Update Count : 25 14 14 // 15 15 … … 235 235 } 236 236 237 Expression *Mutator::mutate( VirtualCastExpr *castExpr ) { 238 castExpr->set_env( maybeMutate( castExpr->get_env(), *this ) ); 239 castExpr->set_result( maybeMutate( castExpr->get_result(), *this ) ); 240 castExpr->set_arg( maybeMutate( castExpr->get_arg(), *this ) ); 241 return castExpr; 242 } 243 237 244 Expression *Mutator::mutate( UntypedMemberExpr *memberExpr ) { 238 245 memberExpr->set_env( maybeMutate( memberExpr->get_env(), *this ) ); -
src/SynTree/Mutator.h
rfd344aa r9236060 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Jun 8 15:45:00 201713 // Update Count : 1 412 // Last Modified On : Mon Jul 24 16:31:00 2017 13 // Update Count : 16 14 14 // 15 15 #include <cassert> … … 18 18 #include "Common/SemanticError.h" 19 19 20 #ifndef MUTATOR_H 21 #define MUTATOR_H 20 #pragma once 22 21 23 22 class Mutator { … … 60 59 virtual Expression* mutate( LabelAddressExpr *labAddressExpr ); 61 60 virtual Expression* mutate( CastExpr *castExpr ); 61 virtual Expression* mutate( VirtualCastExpr *castExpr ); 62 62 virtual Expression* mutate( UntypedMemberExpr *memberExpr ); 63 63 virtual Expression* mutate( MemberExpr *memberExpr ); … … 151 151 } 152 152 153 #endif // MUTATOR_H154 155 153 // Local Variables: // 156 154 // tab-width: 4 // -
src/SynTree/NamedTypeDecl.cc
rfd344aa r9236060 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Mar 16 07:49:44201713 // Update Count : 1 311 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Aug 9 13:28:00 2017 13 // Update Count : 14 14 14 // 15 15 … … 38 38 if ( get_name() != "" ) { 39 39 os << get_name() << ": "; 40 } // if 41 if ( get_linkage() != LinkageSpec::Cforall ) { 42 os << LinkageSpec::linkageName( get_linkage() ) << " "; 40 43 } // if 41 44 get_storageClasses().print( os ); -
src/SynTree/Statement.h
rfd344aa r9236060 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Mon Jun 12 13:35:00 201713 // Update Count : 6 712 // Last Modified On : Thr Aug 3 14:08:00 2017 13 // Update Count : 69 14 14 // 15 15 16 #ifndef STATEMENT_H 17 #define STATEMENT_H 16 #pragma once 18 17 19 18 #include "BaseSyntaxNode.h" … … 27 26 class Statement : public BaseSyntaxNode { 28 27 public: 28 std::list<Label> labels; 29 29 30 Statement( std::list<Label> labels ); 30 31 virtual ~Statement(); … … 37 38 virtual Statement *acceptMutator( Mutator &m ) = 0; 38 39 virtual void print( std::ostream &os, int indent = 0 ) const; 39 protected:40 std::list<Label> labels;41 40 }; 42 41 43 42 class CompoundStmt : public Statement { 44 43 public: 44 std::list<Statement*> kids; 45 45 46 CompoundStmt( std::list<Label> labels ); 46 47 CompoundStmt( const CompoundStmt &other ); … … 55 56 virtual CompoundStmt *acceptMutator( Mutator &m ) { return m.mutate( this ); } 56 57 virtual void print( std::ostream &os, int indent = 0 ) const; 57 private:58 std::list<Statement*> kids;59 58 }; 60 59 … … 68 67 virtual NullStmt *acceptMutator( Mutator &m ) { return m.mutate( this ); } 69 68 virtual void print( std::ostream &os, int indent = 0 ) const; 70 71 private:72 69 }; 73 70 74 71 class ExprStmt : public Statement { 75 72 public: 73 Expression *expr; 74 76 75 ExprStmt( std::list<Label> labels, Expression *expr ); 77 76 ExprStmt( const ExprStmt &other ); … … 85 84 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 86 85 virtual void print( std::ostream &os, int indent = 0 ) const; 87 private:88 Expression *expr;89 86 }; 90 87 91 88 class AsmStmt : public Statement { 92 89 public: 90 bool voltile; 91 ConstantExpr *instruction; 92 std::list<Expression *> output, input; 93 std::list<ConstantExpr *> clobber; 94 std::list<Label> gotolabels; 95 93 96 AsmStmt( std::list<Label> labels, bool voltile, ConstantExpr *instruction, std::list<Expression *> input, std::list<Expression *> output, std::list<ConstantExpr *> clobber, std::list<Label> gotolabels ); 94 97 AsmStmt( const AsmStmt &other ); … … 112 115 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 113 116 virtual void print( std::ostream &os, int indent = 0 ) const; 114 private:115 bool voltile;116 ConstantExpr *instruction;117 std::list<Expression *> output, input;118 std::list<ConstantExpr *> clobber;119 std::list<Label> gotolabels;120 117 }; 121 118 122 119 class IfStmt : public Statement { 123 120 public: 121 Expression *condition; 122 Statement *thenPart; 123 Statement *elsePart; 124 124 125 IfStmt( std::list<Label> labels, Expression *condition, Statement *thenPart, Statement *elsePart ); 125 126 IfStmt( const IfStmt &other ); … … 137 138 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 138 139 virtual void print( std::ostream &os, int indent = 0 ) const; 139 private:140 Expression *condition;141 Statement *thenPart;142 Statement *elsePart;143 140 }; 144 141 145 142 class SwitchStmt : public Statement { 146 143 public: 144 Expression * condition; 145 147 146 SwitchStmt( std::list<Label> labels, Expression *condition, std::list<Statement *> &statements ); 148 147 SwitchStmt( const SwitchStmt &other ); … … 160 159 virtual void print( std::ostream &os, int indent = 0 ) const; 161 160 private: 161 std::list<Statement *> statements; 162 }; 163 164 class CaseStmt : public Statement { 165 public: 162 166 Expression * condition; 163 std::list<Statement *> statements; 164 }; 165 166 class CaseStmt : public Statement { 167 public: 167 std::list<Statement *> stmts; 168 168 169 CaseStmt( std::list<Label> labels, Expression *conditions, std::list<Statement *> &stmts, bool isdef = false ) throw(SemanticError); 169 170 CaseStmt( const CaseStmt &other ); … … 187 188 virtual void print( std::ostream &os, int indent = 0 ) const; 188 189 private: 189 Expression * condition;190 std::list<Statement *> stmts;191 190 bool _isDefault; 192 191 }; … … 194 193 class WhileStmt : public Statement { 195 194 public: 195 Expression *condition; 196 Statement *body; 197 bool isDoWhile; 198 196 199 WhileStmt( std::list<Label> labels, Expression *condition, 197 200 Statement *body, bool isDoWhile = false ); … … 210 213 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 211 214 virtual void print( std::ostream &os, int indent = 0 ) const; 212 private: 215 }; 216 217 class ForStmt : public Statement { 218 public: 219 std::list<Statement *> initialization; 213 220 Expression *condition; 221 Expression *increment; 214 222 Statement *body; 215 bool isDoWhile; 216 }; 217 218 class ForStmt : public Statement { 219 public: 223 220 224 ForStmt( std::list<Label> labels, std::list<Statement *> initialization, 221 225 Expression *condition = 0, Expression *increment = 0, Statement *body = 0 ); … … 236 240 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 237 241 virtual void print( std::ostream &os, int indent = 0 ) const; 238 private:239 std::list<Statement *> initialization;240 Expression *condition;241 Expression *increment;242 Statement *body;243 242 }; 244 243 … … 246 245 public: 247 246 enum Type { Goto = 0, Break, Continue }; 247 248 // originalTarget kept for error messages. 249 const Label originalTarget; 250 Label target; 251 Expression *computedTarget; 252 Type type; 248 253 249 254 BranchStmt( std::list<Label> labels, Label target, Type ) throw (SemanticError); … … 266 271 private: 267 272 static const char *brType[]; 268 Label originalTarget; // can give better error messages if we remember the label name that the user entered269 Label target;270 Expression *computedTarget;271 Type type;272 273 }; 273 274 274 275 class ReturnStmt : public Statement { 275 276 public: 277 Expression *expr; 278 276 279 ReturnStmt( std::list<Label> labels, Expression *expr ); 277 280 ReturnStmt( const ReturnStmt &other ); … … 285 288 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 286 289 virtual void print( std::ostream &os, int indent = 0 ) const; 287 private:288 Expression *expr;289 290 }; 290 291 … … 292 293 public: 293 294 enum Kind { Terminate, Resume }; 295 296 const Kind kind; 297 Expression * expr; 298 Expression * target; 294 299 295 300 ThrowStmt( std::list<Label> labels, Kind kind, Expression * expr, Expression * target = nullptr ); … … 307 312 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 308 313 virtual void print( std::ostream &os, int indent = 0 ) const; 309 private:310 Kind kind;311 Expression * expr;312 Expression * target;313 314 }; 314 315 315 316 class TryStmt : public Statement { 316 317 public: 318 CompoundStmt *block; 319 std::list<CatchStmt *> handlers; 320 FinallyStmt *finallyBlock; 321 317 322 TryStmt( std::list<Label> labels, CompoundStmt *tryBlock, std::list<CatchStmt *> &handlers, FinallyStmt *finallyBlock = 0 ); 318 323 TryStmt( const TryStmt &other ); … … 330 335 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 331 336 virtual void print( std::ostream &os, int indent = 0 ) const; 332 333 private:334 CompoundStmt *block;335 std::list<CatchStmt *> handlers;336 FinallyStmt *finallyBlock;337 337 }; 338 338 … … 340 340 public: 341 341 enum Kind { Terminate, Resume }; 342 343 const Kind kind; 344 Declaration *decl; 345 Expression *cond; 346 Statement *body; 342 347 343 348 CatchStmt( std::list<Label> labels, Kind kind, Declaration *decl, … … 358 363 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 359 364 virtual void print( std::ostream &os, int indent = 0 ) const; 360 361 private:362 Kind kind;363 Declaration *decl;364 Expression *cond;365 Statement *body;366 365 }; 367 366 368 367 class FinallyStmt : public Statement { 369 368 public: 369 CompoundStmt *block; 370 370 371 FinallyStmt( std::list<Label> labels, CompoundStmt *block ); 371 372 FinallyStmt( const FinallyStmt &other ); … … 379 380 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 380 381 virtual void print( std::ostream &os, int indent = 0 ) const; 381 private:382 CompoundStmt *block;383 382 }; 384 383 … … 387 386 class DeclStmt : public Statement { 388 387 public: 388 Declaration *decl; 389 389 390 DeclStmt( std::list<Label> labels, Declaration *decl ); 390 391 DeclStmt( const DeclStmt &other ); … … 398 399 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 399 400 virtual void print( std::ostream &os, int indent = 0 ) const; 400 private:401 Declaration *decl;402 401 }; 403 402 … … 408 407 class ImplicitCtorDtorStmt : public Statement { 409 408 public: 409 // Non-owned pointer to the constructor/destructor statement 410 Statement * callStmt; 411 410 412 ImplicitCtorDtorStmt( Statement * callStmt ); 411 413 ImplicitCtorDtorStmt( const ImplicitCtorDtorStmt & other ); … … 419 421 virtual Statement *acceptMutator( Mutator &m ) { return m.mutate( this ); } 420 422 virtual void print( std::ostream &os, int indent = 0 ) const; 421 422 private:423 // Non-owned pointer to the constructor/destructor statement424 Statement * callStmt;425 423 }; 426 424 427 425 428 426 std::ostream & operator<<( std::ostream & out, const Statement * statement ); 429 430 #endif // STATEMENT_H431 427 432 428 // Local Variables: // -
src/SynTree/SynTree.h
rfd344aa r9236060 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Jun 8 17:00:00 201713 // Update Count : 912 // Last Modified On : Mon Jul 24 16:54:00 2017 13 // Update Count : 11 14 14 // 15 15 16 #ifndef SYNTREE_H 17 #define SYNTREE_H 16 #pragma once 18 17 19 18 #include <string> … … 67 66 class LabelAddressExpr; 68 67 class CastExpr; 68 class VirtualCastExpr; 69 69 class MemberExpr; 70 70 class UntypedMemberExpr; … … 136 136 class Attribute; 137 137 138 #endif // SYNTREE_H139 140 138 // Local Variables: // 141 139 // tab-width: 4 // -
src/SynTree/Type.cc
rfd344aa r9236060 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Fri Mar 17 08:42:47201713 // Update Count : 2 811 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Aug 2 11:11:00 2017 13 // Update Count : 29 14 14 // 15 15 … … 98 98 } 99 99 100 // Empty Variable declarations: 101 const Type::FuncSpecifiers noFuncSpecifiers; 102 const Type::StorageClasses noStorageClasses; 103 const Type::Qualifiers noQualifiers; 104 100 105 std::ostream & operator<<( std::ostream & out, const Type * type ) { 101 106 if ( type ) { -
src/SynTree/Type.h
rfd344aa r9236060 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Mar 23 16:16:36201713 // Update Count : 1 4911 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Aug 9 14:25:00 2017 13 // Update Count : 152 14 14 // 15 15 16 #ifndef TYPE_H 17 #define TYPE_H 16 #pragma once 18 17 19 18 #include "BaseSyntaxNode.h" … … 128 127 }; // Qualifiers 129 128 129 typedef std::list<TypeDecl *> ForallList; 130 131 Qualifiers tq; 132 ForallList forall; 133 std::list< Attribute * > attributes; 134 130 135 Type( const Qualifiers & tq, const std::list< Attribute * > & attributes ); 131 136 Type( const Type & other ); … … 146 151 void set_atomic( bool newValue ) { tq.is_atomic = newValue; } 147 152 148 typedef std::list<TypeDecl *> ForallList;149 153 ForallList& get_forall() { return forall; } 150 154 … … 172 176 virtual Type *acceptMutator( Mutator & m ) = 0; 173 177 virtual void print( std::ostream & os, int indent = 0 ) const; 174 private: 175 Qualifiers tq; 176 ForallList forall; 177 std::list< Attribute * > attributes; 178 }; 179 180 extern Type::Qualifiers emptyQualifiers; // no qualifiers on constants 178 }; 179 180 extern const Type::FuncSpecifiers noFuncSpecifiers; 181 extern const Type::StorageClasses noStorageClasses; 182 extern const Type::Qualifiers noQualifiers; // no qualifiers on constants 181 183 182 184 class VoidType : public Type { … … 218 220 LongDoubleImaginary, 219 221 NUMBER_OF_BASIC_TYPES 220 } ;222 } kind; 221 223 222 224 static const char *typeNames[]; // string names for basic types, MUST MATCH with Kind … … 233 235 234 236 bool isInteger() const; 235 private:236 Kind kind;237 237 }; 238 238 239 239 class PointerType : public Type { 240 240 public: 241 Type *base; 242 243 // In C99, pointer types can be qualified in many ways e.g., int f( int a[ static 3 ] ) 244 Expression *dimension; 245 bool isVarLen; 246 bool isStatic; 247 241 248 PointerType( const Type::Qualifiers & tq, Type *base, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 242 249 PointerType( const Type::Qualifiers & tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); … … 261 268 virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); } 262 269 virtual void print( std::ostream & os, int indent = 0 ) const; 263 private: 270 }; 271 272 class ArrayType : public Type { 273 public: 264 274 Type *base; 265 266 // In C99, pointer types can be qualified in many ways e.g., int f( int a[ static 3 ] )267 275 Expression *dimension; 268 276 bool isVarLen; 269 277 bool isStatic; 270 }; 271 272 class ArrayType : public Type { 273 public: 278 274 279 ArrayType( const Type::Qualifiers & tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 275 280 ArrayType( const ArrayType& ); … … 291 296 virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); } 292 297 virtual void print( std::ostream & os, int indent = 0 ) const; 293 private:294 Type *base;295 Expression *dimension;296 bool isVarLen;297 bool isStatic;298 298 }; 299 299 300 300 class ReferenceType : public Type { 301 301 public: 302 Type *base; 303 302 304 ReferenceType( const Type::Qualifiers & tq, Type *base, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 303 305 ReferenceType( const ReferenceType & ); … … 313 315 virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); } 314 316 virtual void print( std::ostream & os, int indent = 0 ) const; 315 private:316 Type *base;317 317 }; 318 318 319 319 class FunctionType : public Type { 320 320 public: 321 std::list<DeclarationWithType*> returnVals; 322 std::list<DeclarationWithType*> parameters; 323 324 // Does the function accept a variable number of arguments following the arguments specified in the parameters list. 325 // This could be because of 326 // - an ellipsis in a prototype declaration 327 // - an unprototyped declaration 328 bool isVarArgs; 329 321 330 FunctionType( const Type::Qualifiers & tq, bool isVarArgs, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 322 331 FunctionType( const FunctionType& ); … … 333 342 virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); } 334 343 virtual void print( std::ostream & os, int indent = 0 ) const; 335 private:336 std::list<DeclarationWithType*> returnVals;337 std::list<DeclarationWithType*> parameters;338 339 // Does the function accept a variable number of arguments following the arguments specified in the parameters list.340 // This could be because of341 // - an ellipsis in a prototype declaration342 // - an unprototyped declaration343 bool isVarArgs;344 344 }; 345 345 346 346 class ReferenceToType : public Type { 347 347 public: 348 std::list< Expression* > parameters; 349 std::string name; 350 bool hoistType; 351 348 352 ReferenceToType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes ); 349 353 ReferenceToType( const ReferenceToType & other ); … … 364 368 protected: 365 369 virtual std::string typeString() const = 0; 366 std::list< Expression* > parameters;367 std::string name;368 private:369 bool hoistType;370 370 }; 371 371 … … 373 373 typedef ReferenceToType Parent; 374 374 public: 375 // this decl is not "owned" by the struct inst; it is merely a pointer to elsewhere in the tree, 376 // where the structure used in this type is actually defined 377 StructDecl *baseStruct; 378 375 379 StructInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >() ) : Parent( tq, name, attributes ), baseStruct( 0 ) {} 376 380 StructInstType( const Type::Qualifiers & tq, StructDecl * baseStruct, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); … … 396 400 private: 397 401 virtual std::string typeString() const; 398 399 // this decl is not "owned" by the struct inst; it is merely a pointer to elsewhere in the tree,400 // where the structure used in this type is actually defined401 StructDecl *baseStruct;402 402 }; 403 403 … … 405 405 typedef ReferenceToType Parent; 406 406 public: 407 // this decl is not "owned" by the union inst; it is merely a pointer to elsewhere in the tree, 408 // where the union used in this type is actually defined 409 UnionDecl *baseUnion; 410 407 411 UnionInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >() ) : Parent( tq, name, attributes ), baseUnion( 0 ) {} 408 412 UnionInstType( const Type::Qualifiers & tq, UnionDecl * baseUnion, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); … … 428 432 private: 429 433 virtual std::string typeString() const; 430 434 }; 435 436 class EnumInstType : public ReferenceToType { 437 typedef ReferenceToType Parent; 438 public: 431 439 // this decl is not "owned" by the union inst; it is merely a pointer to elsewhere in the tree, 432 440 // where the union used in this type is actually defined 433 UnionDecl *baseUnion; 434 }; 435 436 class EnumInstType : public ReferenceToType { 437 typedef ReferenceToType Parent; 438 public: 441 EnumDecl *baseEnum = nullptr; 442 439 443 EnumInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >() ) : Parent( tq, name, attributes ) {} 440 444 EnumInstType( const Type::Qualifiers & tq, EnumDecl * baseEnum, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); … … 451 455 private: 452 456 virtual std::string typeString() const; 453 454 // this decl is not "owned" by the union inst; it is merely a pointer to elsewhere in the tree,455 // where the union used in this type is actually defined456 EnumDecl *baseEnum = nullptr;457 457 }; 458 458 … … 460 460 typedef ReferenceToType Parent; 461 461 public: 462 // this member is filled in by the validate pass, which instantiates the members of the correponding 463 // aggregate with the actual type parameters specified for this use of the context 464 std::list< Declaration* > members; 465 462 466 TraitInstType( const Type::Qualifiers & tq, const std::string & name, const std::list< Attribute * > & attributes = std::list< Attribute * >() ) : Parent( tq, name, attributes ) {} 463 467 TraitInstType( const TraitInstType & other ); … … 473 477 private: 474 478 virtual std::string typeString() const; 475 476 // this member is filled in by the validate pass, which instantiates the members of the correponding477 // aggregate with the actual type parameters specified for this use of the context478 std::list< Declaration* > members;479 479 }; 480 480 … … 482 482 typedef ReferenceToType Parent; 483 483 public: 484 // this decl is not "owned" by the type inst; it is merely a pointer to elsewhere in the tree, 485 // where the type used here is actually defined 486 TypeDecl *baseType; 487 bool isFtype; 488 484 489 TypeInstType( const Type::Qualifiers & tq, const std::string & name, TypeDecl *baseType, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 485 490 TypeInstType( const Type::Qualifiers & tq, const std::string & name, bool isFtype, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); … … 500 505 private: 501 506 virtual std::string typeString() const; 502 // this decl is not "owned" by the type inst; it is merely a pointer to elsewhere in the tree,503 // where the type used here is actually defined504 TypeDecl *baseType;505 bool isFtype;506 507 }; 507 508 508 509 class TupleType : public Type { 509 510 public: 511 std::list<Type *> types; 512 std::list<Declaration *> members; 513 510 514 TupleType( const Type::Qualifiers & tq, const std::list< Type * > & types, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 511 515 TupleType( const TupleType& ); … … 536 540 virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); } 537 541 virtual void print( std::ostream & os, int indent = 0 ) const; 538 private:539 std::list<Type *> types;540 std::list<Declaration *> members;541 542 }; 542 543 543 544 class TypeofType : public Type { 544 545 public: 546 Expression *expr; 547 545 548 TypeofType( const Type::Qualifiers & tq, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 546 549 TypeofType( const TypeofType& ); … … 556 559 virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); } 557 560 virtual void print( std::ostream & os, int indent = 0 ) const; 558 private: 561 }; 562 563 class AttrType : public Type { 564 public: 565 std::string name; 559 566 Expression *expr; 560 }; 561 562 class AttrType : public Type { 563 public: 567 Type *type; 568 bool isType; 569 564 570 AttrType( const Type::Qualifiers & tq, const std::string & name, Expression *expr, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); 565 571 AttrType( const Type::Qualifiers & tq, const std::string & name, Type *type, const std::list< Attribute * > & attributes = std::list< Attribute * >() ); … … 582 588 virtual Type *acceptMutator( Mutator & m ) { return m.mutate( this ); } 583 589 virtual void print( std::ostream & os, int indent = 0 ) const; 584 private:585 std::string name;586 Expression *expr;587 Type *type;588 bool isType;589 590 }; 590 591 … … 628 629 629 630 std::ostream & operator<<( std::ostream & out, const Type * type ); 630 631 #endif // TYPE_H632 631 633 632 // Local Variables: // -
src/SynTree/TypeDecl.cc
rfd344aa r9236060 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Thu Mar 16 07:49:58201713 // Update Count : 511 // Last Modified By : Andrew Beach 12 // Last Modified On : Wed Aug 9 14:35:00 2017 13 // Update Count : 6 14 14 // 15 15 … … 18 18 #include "Common/utility.h" 19 19 20 TypeDecl::TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, Type * init ) : Parent( name, scs, type ), kind( kind ), init( init ), sized( kind == Any || kind == Ttype) {20 TypeDecl::TypeDecl( const std::string &name, Type::StorageClasses scs, Type *type, Kind kind, Type * init ) : Parent( name, scs, type ), init( init ), sized( kind == Any || kind == Ttype ), kind( kind ) { 21 21 } 22 22 23 TypeDecl::TypeDecl( const TypeDecl &other ) : Parent( other ), kind( other.kind ), init( maybeClone( other.init ) ), sized( other.sized ) {23 TypeDecl::TypeDecl( const TypeDecl &other ) : Parent( other ), init( maybeClone( other.init ) ), sized( other.sized ), kind( other.kind ) { 24 24 } 25 25 -
src/SynTree/TypeSubstitution.h
rfd344aa r9236060 9 9 // Author : Richard C. Bilson 10 10 // Created On : Mon May 18 07:44:20 2015 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri Apr 29 15:00:20 201613 // Update Count : 211 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:52:24 2017 13 // Update Count : 3 14 14 // 15 15 16 #ifndef TYPESUBSTITUTION_H 17 #define TYPESUBSTITUTION_H 16 #pragma once 18 17 19 18 #include <map> … … 180 179 std::ostream & operator<<( std::ostream & out, const TypeSubstitution & sub ); 181 180 182 #endif // TYPESUBSTITUTION_H183 184 181 // Local Variables: // 185 182 // tab-width: 4 // -
src/SynTree/VarExprReplacer.h
rfd344aa r9236060 9 9 // Author : Rob Schluntz 10 10 // Created On : Wed Jan 13 16:29:30 2016 11 // Last Modified By : Rob Schluntz12 // Last Modified On : Fri May 13 11:27:52 201613 // Update Count : 511 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Sat Jul 22 09:53:41 2017 13 // Update Count : 6 14 14 // 15 15 16 #ifndef VAR_EXPR_REPLACER_H 17 #define VAR_EXPR_REPLACER_H 16 #pragma once 18 17 19 18 #include <map> … … 35 34 }; 36 35 37 #endif // VAR_EXPR_REPLACER_H38 39 36 // Local Variables: // 40 37 // tab-width: 4 // -
src/SynTree/Visitor.cc
rfd344aa r9236060 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Jun 22 13:41:00 201713 // Update Count : 2 612 // Last Modified On : Mon Jul 24 16:30:00 2017 13 // Update Count : 27 14 14 // 15 15 … … 192 192 } 193 193 194 void Visitor::visit( VirtualCastExpr *castExpr ) { 195 maybeAccept( castExpr->get_result(), *this ); 196 maybeAccept( castExpr->get_arg(), *this ); 197 } 198 194 199 void Visitor::visit( UntypedMemberExpr *memberExpr ) { 195 200 maybeAccept( memberExpr->get_result(), *this ); -
src/SynTree/Visitor.h
rfd344aa r9236060 10 10 // Created On : Mon May 18 07:44:20 2015 11 11 // Last Modified By : Andrew Beach 12 // Last Modified On : Thr Jun 08 15:45:00 201713 // Update Count : 1 112 // Last Modified On : Mon Jul 24 16:28:00 2017 13 // Update Count : 13 14 14 // 15 15 16 #ifndef VISITOR_H 17 #define VISITOR_H 16 #pragma once 18 17 19 18 #include "SynTree.h" … … 61 60 virtual void visit( NameExpr *nameExpr ); 62 61 virtual void visit( CastExpr *castExpr ); 62 virtual void visit( VirtualCastExpr *castExpr ); 63 63 virtual void visit( AddressExpr *addressExpr ); 64 64 virtual void visit( LabelAddressExpr *labAddressExpr ); … … 175 175 } 176 176 177 #endif // VISITOR_H178 179 177 // Local Variables: // 180 178 // tab-width: 4 //
Note:
See TracChangeset
for help on using the changeset viewer.