Changes in src/Parser/ParseNode.h [7f5566b:1db21619]
- File:
-
- 1 edited
-
src/Parser/ParseNode.h (modified) (13 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ParseNode.h
r7f5566b r1db21619 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : T hu Jul 30 15:11:39201513 // Update Count : 14112 // Last Modified On : Tue Jul 14 14:58:25 2015 13 // Update Count : 91 14 14 // 15 15 … … 67 67 ExpressionNode( const std::string * ); 68 68 ExpressionNode( const ExpressionNode &other ); 69 virtual ~ExpressionNode() { delete argName; } // cannot delete argName because it might be referenced elsewhere69 virtual ~ExpressionNode() {} // cannot delete asArgName 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 rgName( const std::string *aName );77 ExpressionNode *set_a rgName( ExpressionNode *aDesignator );76 ExpressionNode *set_asArgName( const std::string *aName ); 77 ExpressionNode *set_asArgName( 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; }108 107 109 108 virtual ConstantNode *clone() const { return new ConstantNode( *this ); } … … 184 183 }; 185 184 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 253 213 class CommaExprNode : public CompositeExprNode { 254 214 public: … … 319 279 static const char *typeClassName[]; 320 280 321 static DeclarationNode *newFunction( std::string *name, DeclarationNode *ret, DeclarationNode *param, StatementNode *body, bool newStyle = false ); 281 static DeclarationNode *newFunction( std::string *name, DeclarationNode *ret, DeclarationNode *param, 282 StatementNode *body, bool newStyle = false ); 322 283 static DeclarationNode *newQualifier( Qualifier ); 323 284 static DeclarationNode *newStorageClass( StorageClass ); … … 410 371 411 372 StatementNode(); 412 StatementNode( const std::string * name);413 StatementNode( Type t, ExpressionNode *control = 0, StatementNode *block= 0 );414 StatementNode( Type t, std::string *target );373 StatementNode( const std::string * ); 374 StatementNode( Type, ExpressionNode *e = 0, StatementNode *s = 0 ); 375 StatementNode( Type, std::string *target ); 415 376 StatementNode( DeclarationNode *decl ); 377 416 378 417 379 ~StatementNode(); … … 440 402 441 403 void print( std::ostream &, int indent = 0) const; 404 442 405 virtual StatementNode *clone() const; 406 443 407 virtual Statement *build() const; 444 408 private: … … 450 414 std::string *target; // target label for jump statements 451 415 DeclarationNode *decl; 416 452 417 bool isCatchRest; 453 418 }; // StatementNode … … 463 428 464 429 void print( std::ostream &, int indent = 0 ) const; 430 465 431 virtual Statement *build() const; 466 432 private: … … 468 434 }; 469 435 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; 436 class NullStmtNode : public CompoundStmtNode { 437 public: 476 438 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 485 class NullStmtNode : public CompoundStmtNode { 486 public: 487 Statement *build() const; 488 void print( std::ostream &, int indent = 0 ) const; 439 void print( std::ostream &, int indent = 0) const; 489 440 }; 490 441 … … 512 463 InitializerNode *kids; 513 464 }; 465 466 514 467 515 468 template< typename SynTreeType, typename NodeType >
Note:
See TracChangeset
for help on using the changeset viewer.