Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/Parser/ParseNode.h

    r7305915 r630a82a  
    55// file "LICENCE" distributed with Cforall.
    66//
    7 // ParseNode.h --
     7// ParseNode.h -- 
    88//
    99// Author           : Rodolfo G. Esteves
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jun 27 23:28:10 2016
    13 // Update Count     : 242
     12// Last Modified On : Fri Apr  8 16:27:20 2016
     13// Update Count     : 205
    1414//
    1515
     
    2020#include <list>
    2121#include <iterator>
    22 #include <memory>
    2322
    2423#include "Common/utility.h"
    2524#include "Parser/LinkageSpec.h"
    2625#include "SynTree/Type.h"
    27 #include "SynTree/Expression.h"
    2826//#include "SynTree/Declaration.h"
    2927#include "Common/UniqueName.h"
     
    8179        ExpressionNode *set_argName( const std::string *aName );
    8280        ExpressionNode *set_argName( ExpressionNode *aDesignator );
    83         bool get_extension() const { return extension; }
    84         ExpressionNode *set_extension( bool exten ) { extension = exten; return this; }
    8581
    8682        virtual void print( std::ostream &, int indent = 0) const = 0;
     
    9187        void printDesignation ( std::ostream &, int indent = 0) const;
    9288  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;
    10890};
    10991
     
    126108
    127109        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 ) ) {};
    129111        ~ConstantNode() { delete &value; }
    130112
     
    195177        enum Type { TupleC, Comma, TupleFieldSel, // n-adic
    196178                                // triadic
    197                                 Cond, NCond,
     179                                Cond, NCond, 
    198180                                // 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, 
    201183                                Assign, MulAssn, DivAssn, ModAssn, PlusAssn, MinusAssn, LSAssn, RSAssn, AndAssn, ERAssn, OrAssn,
    202184                                Index, FieldSel, PFieldSel, Range,
    203185                                // monadic
    204186                                UnPlus, UnMinus, AddressOf, PointTo, Neg, BitNeg, Incr, IncrPost, Decr, DecrPost, LabelAddress,
    205                                 Ctor, Dtor,
    206187        };
    207188
     
    328309        ValofExprNode( const ValofExprNode &other );
    329310        ~ValofExprNode();
    330 
     311 
    331312        virtual ValofExprNode *clone() const { return new ValofExprNode( *this ); }
    332313
     
    352333        enum BuiltinType { Valist };
    353334
    354         static const char *storageName[];
     335        static const char *storageName[]; 
    355336        static const char *qualifierName[];
    356337        static const char *basicTypeName[];
     
    425406        ExpressionNode *get_enumeratorValue() const { return enumeratorValue; }
    426407
    427         bool get_extension() const { return extension; }
    428         DeclarationNode *set_extension( bool exten ) { extension = exten; return this; }
    429 
    430408        DeclarationNode();
    431409        ~DeclarationNode();
     
    443421        bool hasEllipsis;
    444422        LinkageSpec::Type linkage;
    445         bool extension = false;
    446423
    447424        static UniqueName anonymous;
     
    450427class StatementNode : public ParseNode {
    451428  public:
    452         enum Type { Exp,   If,        Switch,  Case,    Default,  Choose,   Fallthru,
     429        enum Type { Exp,   If,        Switch,  Case,    Default,  Choose,   Fallthru, 
    453430                                While, Do,        For,
    454431                                Goto,  Continue,  Break,   Return,  Throw,
     
    480457        void addDeclaration( DeclarationNode *newDecl ) { decl = newDecl; }
    481458        void setCatchRest( bool newVal ) { isCatchRest = newVal; }
    482 
    483         bool get_extension() const { return extension; }
    484         StatementNode *set_extension( bool exten ) { extension = exten; return this; }
    485459
    486460        std::string get_target() const;
     
    502476        DeclarationNode *decl;
    503477        bool isCatchRest;
    504         bool extension = false;
    505478}; // StatementNode
    506479
     
    552525        ExpressionNode *get_designators() const { return designator; }
    553526
    554         InitializerNode *set_maybeConstructed( bool value ) { maybeConstructed = value; return this; }
    555         bool get_maybeConstructed() const { return maybeConstructed; }
    556 
    557527        InitializerNode *next_init() const { return kids; }
    558528
     
    566536        ExpressionNode *designator; // may be list
    567537        InitializerNode *kids;
    568         bool maybeConstructed;
    569538};
    570539
     
    600569        while ( cur ) {
    601570                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() );
    604572                        if ( result ) {
    605573                                *out++ = result;
Note: See TracChangeset for help on using the changeset viewer.