Changeset 2d019af for src/SynTree


Ignore:
Timestamp:
Mar 12, 2021, 11:14:29 PM (5 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
41ca6fa, e867b44d
Parents:
6083392
Message:

parser global pragmas, fixes #241

Location:
src/SynTree
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Declaration.cc

    r6083392 r2d019af  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed Dec 11 16:39:56 2019
    13 // Update Count     : 36
     12// Last Modified On : Fri Mar 12 18:35:39 2021
     13// Update Count     : 37
    1414//
    1515
     
    6666
    6767
     68DirectiveDecl::DirectiveDecl( DirectiveStmt *stmt ) : Declaration( "", Type::StorageClasses(), LinkageSpec::C ), stmt( stmt ) {
     69}
     70
     71DirectiveDecl::DirectiveDecl( const DirectiveDecl &other ) : Declaration( other ), stmt( maybeClone( other.stmt ) ) {
     72}
     73
     74DirectiveDecl::~DirectiveDecl() {
     75        delete stmt;
     76}
     77
     78void DirectiveDecl::print( std::ostream &os, Indenter indent ) const {
     79        stmt->print( os, indent );
     80}
     81
     82void DirectiveDecl::printShort( std::ostream &os, Indenter indent ) const {
     83        stmt->print( os, indent );
     84}
     85
     86
    6887StaticAssertDecl::StaticAssertDecl( Expression * condition, ConstantExpr * message ) : Declaration( "", Type::StorageClasses(), LinkageSpec::C ), condition( condition ), message( message )  {
    6988}
  • src/SynTree/Declaration.h

    r6083392 r2d019af  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Mon Jan 11 20:48:39 2021
    13 // Update Count     : 158
     12// Last Modified On : Fri Mar 12 18:35:36 2021
     13// Update Count     : 159
    1414//
    1515
     
    400400};
    401401
     402class DirectiveDecl : public Declaration {
     403  public:
     404        DirectiveStmt * stmt;
     405
     406        DirectiveDecl( DirectiveStmt * stmt );
     407        DirectiveDecl( const DirectiveDecl & other );
     408        virtual ~DirectiveDecl();
     409
     410        DirectiveStmt * get_stmt() { return stmt; }
     411        void set_stmt( DirectiveStmt * newValue ) { stmt = newValue; }
     412
     413        virtual DirectiveDecl * clone() const override { return new DirectiveDecl( *this ); }
     414        virtual void accept( Visitor & v ) override { v.visit( this ); }
     415        virtual void accept( Visitor & v ) const override { v.visit( this ); }
     416        virtual DirectiveDecl * acceptMutator( Mutator & m )  override { return m.mutate( this ); }
     417        virtual void print( std::ostream & os, Indenter indent = {} ) const override;
     418        virtual void printShort( std::ostream & os, Indenter indent = {} ) const override;
     419};
     420
    402421class StaticAssertDecl : public Declaration {
    403422public:
  • src/SynTree/Mutator.h

    r6083392 r2d019af  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 25 22:37:46 2019
    13 // Update Count     : 17
     12// Last Modified On : Fri Mar 12 18:35:36 2021
     13// Update Count     : 18
    1414//
    1515#pragma once
     
    3434        virtual Declaration * mutate( TypedefDecl * typeDecl ) = 0;
    3535        virtual AsmDecl * mutate( AsmDecl * asmDecl ) = 0;
     36        virtual DirectiveDecl * mutate( DirectiveDecl * directiveDecl ) = 0;
    3637        virtual StaticAssertDecl * mutate( StaticAssertDecl * assertDecl ) = 0;
    3738
  • src/SynTree/SynTree.h

    r6083392 r2d019af  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 25 22:37:45 2019
    13 // Update Count     : 12
     12// Last Modified On : Fri Mar 12 18:56:44 2021
     13// Update Count     : 13
    1414//
    1515
     
    3636class TypedefDecl;
    3737class AsmDecl;
     38class DirectiveDecl;
    3839class StaticAssertDecl;
    3940
  • src/SynTree/Visitor.h

    r6083392 r2d019af  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Thu Jul 25 22:21:49 2019
    13 // Update Count     : 14
     12// Last Modified On : Fri Mar 12 18:35:35 2021
     13// Update Count     : 15
    1414//
    1515
     
    4545        virtual void visit( AsmDecl * node ) { visit( const_cast<const AsmDecl *>(node) ); }
    4646        virtual void visit( const AsmDecl * asmDecl ) = 0;
     47        virtual void visit( DirectiveDecl * node ) { visit( const_cast<const DirectiveDecl *>(node) ); }
     48        virtual void visit( const DirectiveDecl * directiveDecl ) = 0;
    4749        virtual void visit( StaticAssertDecl * node ) { visit( const_cast<const StaticAssertDecl *>(node) ); }
    4850        virtual void visit( const StaticAssertDecl * assertDecl ) = 0;
Note: See TracChangeset for help on using the changeset viewer.