Changes in / [41ca6fa:df65c0c]


Ignore:
Location:
src
Files:
21 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    r41ca6fa rdf65c0c  
    99// Author           : Thierry Delisle
    1010// Created On       : Thu May 09 15::37::05 2019
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 18:43:51 2021
    13 // Update Count     : 36
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Nov 12 10:07:00 2020
     13// Update Count     : 34
    1414//
    1515
     
    327327        const ast::AsmDecl * visit( const ast::AsmDecl * node ) override final {
    328328                auto decl = new AsmDecl( get<AsmStmt>().accept1( node->stmt ) );
    329                 declPostamble( decl, node );
    330                 return nullptr;
    331         }
    332 
    333         const ast::DirectiveDecl * visit( const ast::DirectiveDecl * node ) override final {
    334                 auto decl = new DirectiveDecl( get<DirectiveStmt>().accept1( node->stmt ) );
    335329                declPostamble( decl, node );
    336330                return nullptr;
     
    17751769        }
    17761770
    1777         virtual void visit( const DirectiveDecl * old ) override final {
    1778                 auto decl = new ast::DirectiveDecl{
    1779                         old->location,
    1780                         GET_ACCEPT_1(stmt, DirectiveStmt)
    1781                 };
    1782                 decl->extension  = old->extension;
    1783                 decl->uniqueId   = old->uniqueId;
    1784                 decl->storage    = { old->storageClasses.val };
    1785 
    1786                 this->node = decl;
    1787         }
    1788 
    17891771        virtual void visit( const StaticAssertDecl * old ) override final {
    17901772                auto decl = new ast::StaticAssertDecl{
  • src/AST/Decl.hpp

    r41ca6fa rdf65c0c  
    1010// Created On       : Thu May 9 10:00:00 2019
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 18:25:05 2021
    13 // Update Count     : 32
     12// Last Modified On : Mon Jan 11 20:48:38 2021
     13// Update Count     : 30
    1414//
    1515
     
    365365};
    366366
    367 /// C-preprocessor directive `#...`
    368 class DirectiveDecl : public Decl {
    369 public:
    370         ptr<DirectiveStmt> stmt;
    371 
    372         DirectiveDecl( const CodeLocation & loc, DirectiveStmt * stmt )
    373         : Decl( loc, "", {}, {} ), stmt(stmt) {}
    374 
    375         const DirectiveDecl * accept( Visitor & v ) const override { return v.visit( this ); }
    376 private:
    377         DirectiveDecl * clone() const override { return new DirectiveDecl( *this ); }
    378         MUTATE_FRIEND
    379 };
    380 
    381367class StaticAssertDecl : public Decl {
    382368public:
  • src/AST/Fwd.hpp

    r41ca6fa rdf65c0c  
    99// Author           : Andrew Beach
    1010// Created On       : Wed May  8 16:05:00 2019
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 18:37:39 2021
    13 // Update Count     : 4
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr Jul 23 14:15:00 2020
     13// Update Count     : 2
    1414//
    1515
     
    3535class TypedefDecl;
    3636class AsmDecl;
    37 class DirectiveDecl;
    3837class StaticAssertDecl;
    3938
  • src/AST/Node.cpp

    r41ca6fa rdf65c0c  
    99// Author           : Thierry Delisle
    1010// Created On       : Thu May 16 14:16:00 2019
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 18:25:06 2021
    13 // Update Count     : 2
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Fri Jun  5 10:21:00 2020
     13// Update Count     : 1
    1414//
    1515
     
    130130template class ast::ptr_base< ast::AsmDecl, ast::Node::ref_type::weak >;
    131131template class ast::ptr_base< ast::AsmDecl, ast::Node::ref_type::strong >;
    132 template class ast::ptr_base< ast::DirectiveDecl, ast::Node::ref_type::weak >;
    133 template class ast::ptr_base< ast::DirectiveDecl, ast::Node::ref_type::strong >;
    134132template class ast::ptr_base< ast::StaticAssertDecl, ast::Node::ref_type::weak >;
    135133template class ast::ptr_base< ast::StaticAssertDecl, ast::Node::ref_type::strong >;
  • src/AST/Pass.hpp

    r41ca6fa rdf65c0c  
    139139        const ast::Decl *             visit( const ast::TypedefDecl          * ) override final;
    140140        const ast::AsmDecl *          visit( const ast::AsmDecl              * ) override final;
    141         const ast::DirectiveDecl *    visit( const ast::DirectiveDecl        * ) override final;
    142141        const ast::StaticAssertDecl * visit( const ast::StaticAssertDecl     * ) override final;
    143142        const ast::CompoundStmt *     visit( const ast::CompoundStmt         * ) override final;
  • src/AST/Pass.impl.hpp

    r41ca6fa rdf65c0c  
    646646
    647647//--------------------------------------------------------------------------
    648 // DirectiveDecl
    649 template< typename core_t >
    650 const ast::DirectiveDecl * ast::Pass< core_t >::visit( const ast::DirectiveDecl * node ) {
    651         VISIT_START( node );
    652 
    653         VISIT(
    654                 maybe_accept( node, &DirectiveDecl::stmt );
    655         )
    656 
    657         VISIT_END( DirectiveDecl, node );
    658 }
    659 
    660 //--------------------------------------------------------------------------
    661648// StaticAssertDecl
    662649template< typename core_t >
  • src/AST/Print.cpp

    r41ca6fa rdf65c0c  
    387387
    388388        virtual const ast::AsmDecl * visit( const ast::AsmDecl * node ) override final {
    389                 safe_print( node->stmt );
    390                 return node;
    391         }
    392 
    393         virtual const ast::DirectiveDecl * visit( const ast::DirectiveDecl * node ) override final {
    394389                safe_print( node->stmt );
    395390                return node;
  • src/AST/Visitor.hpp

    r41ca6fa rdf65c0c  
    99// Author           : Andrew Beach
    1010// Created On       : Thr May 9 15:28:00 2019
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 18:25:07 2021
    13 // Update Count     : 1
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thr May 9 15:33:00 2019
     13// Update Count     : 0
    1414//
    1515
     
    3131    virtual const ast::Decl *             visit( const ast::TypedefDecl          * ) = 0;
    3232    virtual const ast::AsmDecl *          visit( const ast::AsmDecl              * ) = 0;
    33     virtual const ast::DirectiveDecl *    visit( const ast::DirectiveDecl        * ) = 0;
    3433    virtual const ast::StaticAssertDecl * visit( const ast::StaticAssertDecl     * ) = 0;
    3534    virtual const ast::CompoundStmt *     visit( const ast::CompoundStmt         * ) = 0;
  • src/CodeGen/CodeGenerator.cc

    r41ca6fa rdf65c0c  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 19:00:42 2021
    13 // Update Count     : 536
     12// Last Modified On : Sun Feb 16 08:32:48 2020
     13// Update Count     : 532
    1414//
    1515#include "CodeGenerator.h"
     
    935935                if ( asmStmt->get_instruction() ) asmStmt->get_instruction()->accept( *visitor );
    936936                output << " )";
    937         }
    938 
    939         void CodeGenerator::postvisit( DirectiveDecl * directiveDecl ) {
    940                 output << endl << directiveDecl->get_stmt()->directive; // endl prevents spaces before directive
    941937        }
    942938
  • src/CodeGen/CodeGenerator.h

    r41ca6fa rdf65c0c  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 18:35:38 2021
    13 // Update Count     : 63
     12// Last Modified On : Sun Feb 16 03:58:31 2020
     13// Update Count     : 62
    1414//
    1515
     
    105105                void postvisit( DirectiveStmt * );
    106106                void postvisit( AsmDecl * );                                    // special: statement in declaration context
    107                 void postvisit( DirectiveDecl * );                              // special: statement in declaration context
    108107                void postvisit( IfStmt * );
    109108                void postvisit( SwitchStmt * );
  • src/Common/CodeLocationTools.cpp

    r41ca6fa rdf65c0c  
    99// Author           : Andrew Beach
    1010// Created On       : Fri Dec  4 15:42:00 2020
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 18:35:37 2021
    13 // Update Count     : 2
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Wed Dec  9  9:42:00 2020
     13// Update Count     : 1
    1414//
    1515
     
    102102    macro(TypedefDecl, Decl) \
    103103    macro(AsmDecl, AsmDecl) \
    104     macro(DirectiveDecl, DirectiveDecl) \
    105104    macro(StaticAssertDecl, StaticAssertDecl) \
    106105    macro(CompoundStmt, CompoundStmt) \
  • src/Common/PassVisitor.h

    r41ca6fa rdf65c0c  
    7777        virtual void visit( AsmDecl * asmDecl ) override final;
    7878        virtual void visit( const AsmDecl * asmDecl ) override final;
    79         virtual void visit( DirectiveDecl * directiveDecl ) override final;
    80         virtual void visit( const DirectiveDecl * directiveDecl ) override final;
    8179        virtual void visit( StaticAssertDecl * assertDecl ) override final;
    8280        virtual void visit( const StaticAssertDecl * assertDecl ) override final;
     
    263261        virtual Declaration * mutate( TypedefDecl * typeDecl ) override final;
    264262        virtual AsmDecl * mutate( AsmDecl * asmDecl ) override final;
    265         virtual DirectiveDecl * mutate( DirectiveDecl * directiveDecl ) override final;
    266263        virtual StaticAssertDecl * mutate( StaticAssertDecl * assertDecl ) override final;
    267264
  • src/Common/PassVisitor.impl.h

    r41ca6fa rdf65c0c  
    973973
    974974//--------------------------------------------------------------------------
    975 // DirectiveDecl
    976 template< typename pass_type >
    977 void PassVisitor< pass_type >::visit( DirectiveDecl * node ) {
    978         VISIT_START( node );
    979 
    980         maybeAccept_impl( node->stmt, *this );
    981 
    982         VISIT_END( node );
    983 }
    984 
    985 template< typename pass_type >
    986 void PassVisitor< pass_type >::visit( const DirectiveDecl * node ) {
    987         VISIT_START( node );
    988 
    989         maybeAccept_impl( node->stmt, *this );
    990 
    991         VISIT_END( node );
    992 }
    993 
    994 template< typename pass_type >
    995 DirectiveDecl * PassVisitor< pass_type >::mutate( DirectiveDecl * node ) {
    996         MUTATE_START( node );
    997 
    998         maybeMutate_impl( node->stmt, *this );
    999 
    1000         MUTATE_END( DirectiveDecl, node );
    1001 }
    1002 
    1003 //--------------------------------------------------------------------------
    1004975// StaticAssertDecl
    1005976template< typename pass_type >
  • src/Parser/DeclarationNode.cc

    r41ca6fa rdf65c0c  
    1010// Created On       : Sat May 16 12:34:05 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 18:35:37 2021
    13 // Update Count     : 1141
     12// Last Modified On : Mon Jan 11 20:58:07 2021
     13// Update Count     : 1137
    1414//
    1515
     
    424424        newnode->attributes.push_back( new Attribute( *name, exprs ) );
    425425        delete name;
    426         return newnode;
    427 }
    428 
    429 DeclarationNode * DeclarationNode::newDirectiveStmt( StatementNode * stmt ) {
    430         DeclarationNode * newnode = new DeclarationNode;
    431         newnode->directiveStmt = stmt;
    432426        return newnode;
    433427}
     
    10781072                return new AsmDecl( strict_dynamic_cast<AsmStmt *>( asmStmt->build() ) );
    10791073        } // if
    1080         if ( directiveStmt ) {
    1081                 return new DirectiveDecl( strict_dynamic_cast<DirectiveStmt *>( directiveStmt->build() ) );
    1082         } // if
    10831074
    10841075        if ( variable.tyClass != TypeDecl::NUMBER_OF_KINDS ) {
  • src/Parser/ParseNode.h

    r41ca6fa rdf65c0c  
    1010// Created On       : Sat May 16 13:28:16 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 15:19:04 2021
    13 // Update Count     : 897
     12// Last Modified On : Sun Jan  3 18:23:01 2021
     13// Update Count     : 896
    1414//
    1515
     
    249249        static DeclarationNode * newTypeof( ExpressionNode * expr, bool basetypeof = false );
    250250        static DeclarationNode * newAttribute( const std::string *, ExpressionNode * expr = nullptr ); // gcc attributes
    251         static DeclarationNode * newDirectiveStmt( StatementNode * stmt ); // gcc external directive statement
    252251        static DeclarationNode * newAsmStmt( StatementNode * stmt ); // gcc external asm statement
    253252        static DeclarationNode * newStaticAssert( ExpressionNode * condition, Expression * message );
     
    346345        std::string error;
    347346        StatementNode * asmStmt = nullptr;
    348         StatementNode * directiveStmt = nullptr;
    349347
    350348        static UniqueName anonymous;
  • src/Parser/parser.yy

    r41ca6fa rdf65c0c  
    1010// Created On       : Sat Sep  1 20:22:55 2001
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 15:21:02 2021
    13 // Update Count     : 4728
     12// Last Modified On : Wed Feb 17 09:03:07 2021
     13// Update Count     : 4722
    1414//
    1515
     
    26392639
    26402640external_definition:
    2641         DIRECTIVE
    2642                 { $$ = DeclarationNode::newDirectiveStmt( new StatementNode( build_directive( $1 ) ) ); }
    2643         | declaration
     2641        declaration
    26442642        | external_function_definition
    26452643        | EXTENSION external_definition                                         // GCC, multiple __extension__ allowed, meaning unknown
  • src/SynTree/Declaration.cc

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

    r41ca6fa rdf65c0c  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 18:35:36 2021
    13 // Update Count     : 159
     12// Last Modified On : Mon Jan 11 20:48:39 2021
     13// Update Count     : 158
    1414//
    1515
     
    400400};
    401401
    402 class 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 
    421402class StaticAssertDecl : public Declaration {
    422403public:
  • src/SynTree/Mutator.h

    r41ca6fa rdf65c0c  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 18:35:36 2021
    13 // Update Count     : 18
     12// Last Modified On : Thu Jul 25 22:37:46 2019
     13// Update Count     : 17
    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;
    3736        virtual StaticAssertDecl * mutate( StaticAssertDecl * assertDecl ) = 0;
    3837
  • src/SynTree/SynTree.h

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

    r41ca6fa rdf65c0c  
    1010// Created On       : Mon May 18 07:44:20 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Fri Mar 12 18:35:35 2021
    13 // Update Count     : 15
     12// Last Modified On : Thu Jul 25 22:21:49 2019
     13// Update Count     : 14
    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;
    4947        virtual void visit( StaticAssertDecl * node ) { visit( const_cast<const StaticAssertDecl *>(node) ); }
    5048        virtual void visit( const StaticAssertDecl * assertDecl ) = 0;
Note: See TracChangeset for help on using the changeset viewer.