Changeset 2e9b59b for src/SynTree


Ignore:
Timestamp:
Apr 19, 2022, 3:00:04 PM (3 years ago)
Author:
m3zulfiq <m3zulfiq@…>
Branches:
ADT, ast-experimental, master, pthread-emulation, qualifiedEnum
Children:
5b84a321
Parents:
ba897d21 (diff), bb7c77d (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.
Message:

added benchmark and evaluations chapter to thesis

Location:
src/SynTree
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/AggregateDecl.cc

    rba897d21 r2e9b59b  
    5959        } // if
    6060        os << " with body " << has_body();
    61 
    6261        if ( ! parameters.empty() ) {
    6362                os << endl << indent << "... with parameters" << endl;
     
    106105const char * EnumDecl::typeString() const { return aggrString( Enum ); }
    107106
     107void EnumDecl::print( std::ostream & os, Indenter indent ) const {
     108        AggregateDecl::print(os, indent);
     109        os << " with base? " << (base? "True" : "False") << std::endl;
     110        if ( base ) {
     111                os << "Base Type of Enum:" << std::endl;
     112                base->print(os, indent);
     113        }
     114        os <<  std::endl << "End of EnumDecl::print" << std::endl;
     115}
     116
    108117const char * TraitDecl::typeString() const { return aggrString( Trait ); }
    109118
  • src/SynTree/BasicType.cc

    rba897d21 r2e9b59b  
    2929}
    3030
     31bool BasicType::isWholeNumber() const {
     32        return kind == Bool ||
     33                kind ==Char ||
     34                kind == SignedChar ||
     35                kind == UnsignedChar ||
     36                kind == ShortSignedInt ||
     37                kind == ShortUnsignedInt ||
     38                kind == SignedInt ||
     39                kind == UnsignedInt ||
     40                kind == LongSignedInt ||
     41                kind == LongUnsignedInt ||
     42                kind == LongLongSignedInt ||
     43                kind ==LongLongUnsignedInt ||
     44                kind == SignedInt128 ||
     45                kind == UnsignedInt128;
     46}
     47
    3148bool BasicType::isInteger() const {
    3249        return kind <= UnsignedInt128;
  • src/SynTree/Declaration.h

    rba897d21 r2e9b59b  
    144144        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    145145        virtual void printShort( std::ostream & os, Indenter indent = {} ) const override;
     146
     147        // TODO: Move to the right place
     148        void checkAssignedValue() const;
    146149};
    147150
     
    287290        AggregateDecl * set_body( bool body ) { AggregateDecl::body = body; return this; }
    288291
    289         virtual void print( std::ostream & os, Indenter indent = {} ) const override final;
     292        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    290293        virtual void printShort( std::ostream & os, Indenter indent = {} ) const override;
    291294  protected:
     
    335338        typedef AggregateDecl Parent;
    336339  public:
    337         EnumDecl( const std::string & name, const std::list< Attribute * > & attributes = std::list< class Attribute * >(), LinkageSpec::Spec linkage = LinkageSpec::Cforall ) : Parent( name, attributes, linkage ) {}
    338         EnumDecl( const EnumDecl & other ) : Parent( other ) {}
     340        EnumDecl( const std::string & name,
     341         const std::list< Attribute * > & attributes = std::list< class Attribute * >(),
     342          LinkageSpec::Spec linkage = LinkageSpec::Cforall,
     343          Type * baseType = nullptr ) : Parent( name, attributes, linkage ) , base( baseType ){}
     344        EnumDecl( const EnumDecl & other ) : Parent( other ), base( other.base ) {}
    339345
    340346        bool valueOf( Declaration * enumerator, long long int & value );
     
    344350        virtual void accept( Visitor & v ) const override { v.visit( this ); }
    345351        virtual Declaration * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
    346   private:
     352        Type * base;
    347353        std::unordered_map< std::string, long long int > enumValues;
     354        virtual void print( std::ostream & os, Indenter indent = {} ) const override final;
     355  private:
     356        // std::unordered_map< std::string, long long int > enumValues;
    348357        virtual const char * typeString() const override;
    349358};
  • src/SynTree/Type.h

    rba897d21 r2e9b59b  
    268268        virtual Type *acceptMutator( Mutator & m ) override { return m.mutate( this ); }
    269269        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
    270 
     270        bool isWholeNumber() const;
    271271        bool isInteger() const;
    272272};
  • src/SynTree/Visitor.h

    rba897d21 r2e9b59b  
    3535        virtual void visit( UnionDecl * node ) { visit( const_cast<const UnionDecl *>(node) ); }
    3636        virtual void visit( const UnionDecl * aggregateDecl ) = 0;
    37         virtual void visit( EnumDecl * node ) { visit( const_cast<const EnumDecl *>(node) ); }
     37        virtual void visit( EnumDecl * node ) { visit( const_cast<const EnumDecl *>(node) ); } // Marker 1
    3838        virtual void visit( const EnumDecl * aggregateDecl ) = 0;
    3939        virtual void visit( TraitDecl * node ) { visit( const_cast<const TraitDecl *>(node) ); }
     
    190190        virtual void visit( UnionInstType * node ) { visit( const_cast<const UnionInstType *>(node) ); }
    191191        virtual void visit( const UnionInstType * aggregateUseType ) = 0;
    192         virtual void visit( EnumInstType * node ) { visit( const_cast<const EnumInstType *>(node) ); }
     192        virtual void visit( EnumInstType * node ) { visit( const_cast<const EnumInstType *>(node) ); } // Marker 2
    193193        virtual void visit( const EnumInstType * aggregateUseType ) = 0;
    194194        virtual void visit( TraitInstType * node ) { visit( const_cast<const TraitInstType *>(node) ); }
Note: See TracChangeset for help on using the changeset viewer.