Changeset cc32d83 for src/SynTree


Ignore:
Timestamp:
May 3, 2018, 4:10:05 PM (7 years ago)
Author:
Rob Schluntz <rschlunt@…>
Branches:
ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, deferred_resn, demangler, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, with_gc
Children:
b97ebf1
Parents:
637dd9c
Message:

Push pragma directives through the translator

Location:
src/SynTree
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • src/SynTree/Mutator.h

    r637dd9c rcc32d83  
    3939        virtual Statement * mutate( ExprStmt * exprStmt ) = 0;
    4040        virtual Statement * mutate( AsmStmt * asmStmt ) = 0;
     41        virtual Statement * mutate( DirectiveStmt * dirStmt ) = 0;
    4142        virtual Statement * mutate( IfStmt * ifStmt ) = 0;
    4243        virtual Statement * mutate( WhileStmt * whileStmt ) = 0;
  • src/SynTree/Statement.cc

    r637dd9c rcc32d83  
    9494
    9595
     96DirectiveStmt::DirectiveStmt( const std::string & directive ) : Statement(), directive( directive ) {}
     97
     98void DirectiveStmt::print( std::ostream &os, Indenter ) const {
     99        os << "GCC Directive:" << directive << endl;
     100}
     101
     102
    96103const char *BranchStmt::brType[] = { "Goto", "Break", "Continue" };
    97104
  • src/SynTree/Statement.h

    r637dd9c rcc32d83  
    126126};
    127127
     128class DirectiveStmt : public Statement {
     129        public:
     130        std::string directive;
     131
     132        DirectiveStmt( const std::string & );
     133        virtual ~DirectiveStmt(){}
     134
     135        virtual DirectiveStmt * clone() const { return new DirectiveStmt( *this ); }
     136        virtual void accept( Visitor & v ) { v.visit( this ); }
     137        virtual Statement * acceptMutator( Mutator & m ) { return m.mutate( this ); }
     138        virtual void print( std::ostream & os, Indenter indent = {} ) const;
     139};
     140
    128141class IfStmt : public Statement {
    129142  public:
  • src/SynTree/SynTree.h

    r637dd9c rcc32d83  
    4444class ExprStmt;
    4545class AsmStmt;
     46class DirectiveStmt;
    4647class IfStmt;
    4748class WhileStmt;
  • src/SynTree/Visitor.h

    r637dd9c rcc32d83  
    4141        virtual void visit( ExprStmt * exprStmt ) = 0;
    4242        virtual void visit( AsmStmt * asmStmt ) = 0;
     43        virtual void visit( DirectiveStmt * directiveStmt ) = 0;
    4344        virtual void visit( IfStmt * ifStmt ) = 0;
    4445        virtual void visit( WhileStmt * whileStmt ) = 0;
Note: See TracChangeset for help on using the changeset viewer.