Changes in src/Parser/ParseNode.h [1db21619:7f5566b]
- File:
-
- 1 edited
-
src/Parser/ParseNode.h (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ParseNode.h
r1db21619 r7f5566b 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T ue Jul 14 14:58:25201513 // Update Count : 9112 // Last Modified On : Thu Jul 30 15:11:39 2015 13 // Update Count : 141 14 14 // 15 15 … … 67 67 ExpressionNode( const std::string * ); 68 68 ExpressionNode( const ExpressionNode &other ); 69 virtual ~ExpressionNode() { } // cannot delete asArgName because it might be referenced elsewhere69 virtual ~ExpressionNode() { delete argName; } // cannot delete argName because it might be referenced elsewhere 70 70 71 71 virtual ExpressionNode *clone() const = 0; … … 74 74 75 75 ExpressionNode *get_argName() const { return argName; } 76 ExpressionNode *set_a sArgName( const std::string *aName );77 ExpressionNode *set_a sArgName( ExpressionNode *aDesignator );76 ExpressionNode *set_argName( const std::string *aName ); 77 ExpressionNode *set_argName( ExpressionNode *aDesignator ); 78 78 79 79 virtual void print( std::ostream &, int indent = 0) const = 0; … … 105 105 106 106 ConstantNode( Type, std::string * ); 107 ~ConstantNode() { delete &value; } 107 108 108 109 virtual ConstantNode *clone() const { return new ConstantNode( *this ); } … … 183 184 }; 184 185 185 186 186 class CompositeExprNode : public ExpressionNode { 187 187 public: … … 211 211 }; 212 212 213 class AsmExprNode : public ExpressionNode { 214 public: 215 AsmExprNode(); 216 AsmExprNode( ExpressionNode *inout, ConstantNode *constraint, ExpressionNode *operand ) : inout( inout ), constraint( constraint ), operand( operand ) {} 217 virtual ~AsmExprNode() { delete inout; delete constraint; delete operand; } 218 219 virtual AsmExprNode *clone() const { return new AsmExprNode( *this ); } 220 virtual Expression *build() const; 221 222 virtual void print( std::ostream &, int indent = 0) const; 223 virtual void printOneLine( std::ostream &, int indent = 0) const; 224 225 ExpressionNode *get_inout() const { return inout; }; 226 void set_inout( ExpressionNode *newValue ) { inout = newValue; } 227 228 ConstantNode *get_constraint() const { return constraint; }; 229 void set_constraint( ConstantNode *newValue ) { constraint = newValue; } 230 231 ExpressionNode *get_operand() const { return operand; }; 232 void set_operand( ExpressionNode *newValue ) { operand = newValue; } 233 private: 234 ExpressionNode *inout; 235 ConstantNode *constraint; 236 ExpressionNode *operand; 237 }; 238 239 class LabelNode : public ExpressionNode { 240 public: 241 virtual Expression *build() const { return NULL; } 242 virtual LabelNode *clone() const { return new LabelNode( *this ); } 243 244 virtual void print( std::ostream &, int indent = 0) const; 245 virtual void printOneLine( std::ostream &, int indent = 0) const; 246 247 const std::list< std::string > &get_labels() const { return labels; }; 248 void append_label( std::string *label ) { labels.push_back( *label ); delete label; } 249 private: 250 std::list< std::string > labels; 251 }; 252 213 253 class CommaExprNode : public CompositeExprNode { 214 254 public: … … 279 319 static const char *typeClassName[]; 280 320 281 static DeclarationNode *newFunction( std::string *name, DeclarationNode *ret, DeclarationNode *param, 282 StatementNode *body, bool newStyle = false ); 321 static DeclarationNode *newFunction( std::string *name, DeclarationNode *ret, DeclarationNode *param, StatementNode *body, bool newStyle = false ); 283 322 static DeclarationNode *newQualifier( Qualifier ); 284 323 static DeclarationNode *newStorageClass( StorageClass ); … … 371 410 372 411 StatementNode(); 373 StatementNode( const std::string * );374 StatementNode( Type , ExpressionNode *e = 0, StatementNode *s= 0 );375 StatementNode( Type , std::string *target );412 StatementNode( const std::string *name ); 413 StatementNode( Type t, ExpressionNode *control = 0, StatementNode *block = 0 ); 414 StatementNode( Type t, std::string *target ); 376 415 StatementNode( DeclarationNode *decl ); 377 378 416 379 417 ~StatementNode(); … … 402 440 403 441 void print( std::ostream &, int indent = 0) const; 404 405 442 virtual StatementNode *clone() const; 406 407 443 virtual Statement *build() const; 408 444 private: … … 414 450 std::string *target; // target label for jump statements 415 451 DeclarationNode *decl; 416 417 452 bool isCatchRest; 418 453 }; // StatementNode … … 428 463 429 464 void print( std::ostream &, int indent = 0 ) const; 430 431 465 virtual Statement *build() const; 432 466 private: … … 434 468 }; 435 469 470 class AsmStmtNode : public StatementNode { 471 public: 472 AsmStmtNode( Type, bool voltile, ConstantNode *instruction, ExpressionNode *output = 0, ExpressionNode *input = 0, ConstantNode *clobber = 0, LabelNode *gotolabels = 0 ); 473 ~AsmStmtNode(); 474 475 void print( std::ostream &, int indent = 0 ) const; 476 Statement *build() const; 477 private: 478 bool voltile; 479 ConstantNode *instruction; 480 ExpressionNode *output, *input; 481 ConstantNode *clobber; 482 std::list<std::string> gotolabels; 483 }; 484 436 485 class NullStmtNode : public CompoundStmtNode { 437 486 public: 438 487 Statement *build() const; 439 void print( std::ostream &, int indent = 0 ) const;488 void print( std::ostream &, int indent = 0 ) const; 440 489 }; 441 490 … … 463 512 InitializerNode *kids; 464 513 }; 465 466 467 514 468 515 template< typename SynTreeType, typename NodeType >
Note:
See TracChangeset
for help on using the changeset viewer.