Changes in src/Parser/ParseNode.h [7305915:630a82a]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/Parser/ParseNode.h
r7305915 r630a82a 5 5 // file "LICENCE" distributed with Cforall. 6 6 // 7 // ParseNode.h -- 7 // ParseNode.h -- 8 8 // 9 9 // Author : Rodolfo G. Esteves 10 10 // Created On : Sat May 16 13:28:16 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Mon Jun 27 23:28:10 201613 // Update Count : 2 4212 // Last Modified On : Fri Apr 8 16:27:20 2016 13 // Update Count : 205 14 14 // 15 15 … … 20 20 #include <list> 21 21 #include <iterator> 22 #include <memory>23 22 24 23 #include "Common/utility.h" 25 24 #include "Parser/LinkageSpec.h" 26 25 #include "SynTree/Type.h" 27 #include "SynTree/Expression.h"28 26 //#include "SynTree/Declaration.h" 29 27 #include "Common/UniqueName.h" … … 81 79 ExpressionNode *set_argName( const std::string *aName ); 82 80 ExpressionNode *set_argName( ExpressionNode *aDesignator ); 83 bool get_extension() const { return extension; }84 ExpressionNode *set_extension( bool exten ) { extension = exten; return this; }85 81 86 82 virtual void print( std::ostream &, int indent = 0) const = 0; … … 91 87 void printDesignation ( std::ostream &, int indent = 0) const; 92 88 private: 93 ExpressionNode *argName = 0; 94 bool extension = false; 95 }; 96 97 template< typename T > 98 struct maybeBuild_t<Expression, T> { 99 static inline Expression * doit( const T *orig ) { 100 if ( orig ) { 101 Expression *p = orig->build(); 102 p->set_extension( orig->get_extension() ); 103 return p; 104 } else { 105 return 0; 106 } // if 107 } 89 ExpressionNode *argName; 108 90 }; 109 91 … … 126 108 127 109 ConstantNode( Type, std::string * ); 128 ConstantNode( const ConstantNode &other ) : type( other.type ), btype( other.btype),value( *new std::string( other.value ) ) {};110 ConstantNode( const ConstantNode &other ) : value( *new std::string( other.value ) ) {}; 129 111 ~ConstantNode() { delete &value; } 130 112 … … 195 177 enum Type { TupleC, Comma, TupleFieldSel, // n-adic 196 178 // triadic 197 Cond, NCond, 179 Cond, NCond, 198 180 // diadic 199 SizeOf, AlignOf, OffsetOf, Attr, Plus, Minus, Mul, Div, Mod, Or, And,200 BitOr, BitAnd, Xor, Cast, LShift, RShift, LThan, GThan, LEThan, GEThan, Eq, Neq, 181 SizeOf, AlignOf, OffsetOf, Attr, CompLit, Plus, Minus, Mul, Div, Mod, Or, And, 182 BitOr, BitAnd, Xor, Cast, LShift, RShift, LThan, GThan, LEThan, GEThan, Eq, Neq, 201 183 Assign, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, ERAssn, OrAssn, 202 184 Index, FieldSel, PFieldSel, Range, 203 185 // monadic 204 186 UnPlus, UnMinus, AddressOf, PointTo, Neg, BitNeg, Incr, IncrPost, Decr, DecrPost, LabelAddress, 205 Ctor, Dtor,206 187 }; 207 188 … … 328 309 ValofExprNode( const ValofExprNode &other ); 329 310 ~ValofExprNode(); 330 311 331 312 virtual ValofExprNode *clone() const { return new ValofExprNode( *this ); } 332 313 … … 352 333 enum BuiltinType { Valist }; 353 334 354 static const char *storageName[]; 335 static const char *storageName[]; 355 336 static const char *qualifierName[]; 356 337 static const char *basicTypeName[]; … … 425 406 ExpressionNode *get_enumeratorValue() const { return enumeratorValue; } 426 407 427 bool get_extension() const { return extension; }428 DeclarationNode *set_extension( bool exten ) { extension = exten; return this; }429 430 408 DeclarationNode(); 431 409 ~DeclarationNode(); … … 443 421 bool hasEllipsis; 444 422 LinkageSpec::Type linkage; 445 bool extension = false;446 423 447 424 static UniqueName anonymous; … … 450 427 class StatementNode : public ParseNode { 451 428 public: 452 enum Type { Exp, If, Switch, Case, Default, Choose, Fallthru, 429 enum Type { Exp, If, Switch, Case, Default, Choose, Fallthru, 453 430 While, Do, For, 454 431 Goto, Continue, Break, Return, Throw, … … 480 457 void addDeclaration( DeclarationNode *newDecl ) { decl = newDecl; } 481 458 void setCatchRest( bool newVal ) { isCatchRest = newVal; } 482 483 bool get_extension() const { return extension; }484 StatementNode *set_extension( bool exten ) { extension = exten; return this; }485 459 486 460 std::string get_target() const; … … 502 476 DeclarationNode *decl; 503 477 bool isCatchRest; 504 bool extension = false;505 478 }; // StatementNode 506 479 … … 552 525 ExpressionNode *get_designators() const { return designator; } 553 526 554 InitializerNode *set_maybeConstructed( bool value ) { maybeConstructed = value; return this; }555 bool get_maybeConstructed() const { return maybeConstructed; }556 557 527 InitializerNode *next_init() const { return kids; } 558 528 … … 566 536 ExpressionNode *designator; // may be list 567 537 InitializerNode *kids; 568 bool maybeConstructed;569 538 }; 570 539 … … 600 569 while ( cur ) { 601 570 try { 602 // SynTreeType *result = dynamic_cast< SynTreeType *>( maybeBuild<typename std::result_of<decltype(&NodeType::build)(NodeType)>::type>( cur ) ); 603 SynTreeType *result = dynamic_cast< SynTreeType *>( maybeBuild<typename std::pointer_traits<decltype(cur->build())>::element_type>( cur ) ); 571 SynTreeType *result = dynamic_cast< SynTreeType *>( cur->build() ); 604 572 if ( result ) { 605 573 *out++ = result;
Note:
See TracChangeset
for help on using the changeset viewer.