Changeset 71806e0 for src


Ignore:
Timestamp:
Nov 10, 2022, 8:21:54 PM (3 years ago)
Author:
JiadaL <j82liang@…>
Branches:
ADT, ast-experimental, master
Children:
7491f97, e4d7c1c
Parents:
639e4fc
Message:

Rename InlineValueDecl to InlineMemberDecl

Location:
src
Files:
17 edited
1 moved

Legend:

Unmodified
Added
Removed
  • src/AST/Convert.cpp

    r639e4fc r71806e0  
    236236        }
    237237
    238         // InlineValueDecl vanish after EnumAndPointerDecay pass so no necessary to implement NewToOld
    239         const ast::DeclWithType * visit( const ast::InlineValueDecl * node ) override final {   
     238        // InlineMemberDecl vanish after EnumAndPointerDecay pass so no necessary to implement NewToOld
     239        const ast::DeclWithType * visit( const ast::InlineMemberDecl * node ) override final { 
    240240                assert( false );
    241241                (void) node;
     
    18691869        }
    18701870
    1871         virtual void visit( const InlineValueDecl * old ) override final {
     1871        virtual void visit( const InlineMemberDecl * old ) override final {
    18721872                if ( inCache( old ) ) {
    18731873                        return;
     
    18761876                auto&& attr = GET_ACCEPT_V(attributes, Attribute);
    18771877 
    1878                 auto decl = new ast::InlineValueDecl(
     1878                auto decl = new ast::InlineMemberDecl(
    18791879                        old->location,
    18801880                        old->name,
  • src/AST/Decl.hpp

    r639e4fc r71806e0  
    411411};
    412412
    413 class InlineValueDecl final : public DeclWithType {
     413class InlineMemberDecl final : public DeclWithType {
    414414public:
    415415        ptr<Type> type;
    416416
    417         InlineValueDecl( const CodeLocation & loc, const std::string & name, const Type * type,
     417        InlineMemberDecl( const CodeLocation & loc, const std::string & name, const Type * type,
    418418                Storage::Classes storage = {}, Linkage::Spec linkage = Linkage::Cforall,
    419419                std::vector< ptr<Attribute> > && attrs = {}, Function::Specs fs = {} )
     
    425425        const DeclWithType * accept( Visitor& v ) const override { return v.visit( this ); }
    426426private:
    427         InlineValueDecl * clone() const override { return new InlineValueDecl{ *this }; }
     427        InlineMemberDecl * clone() const override { return new InlineMemberDecl{ *this }; }
    428428        MUTATE_FRIEND
    429429};
  • src/AST/Fwd.hpp

    r639e4fc r71806e0  
    3737class DirectiveDecl;
    3838class StaticAssertDecl;
    39 class InlineValueDecl;
     39class InlineMemberDecl;
    4040
    4141class Stmt;
  • src/AST/Pass.hpp

    r639e4fc r71806e0  
    141141        const ast::DirectiveDecl *    visit( const ast::DirectiveDecl        * ) override final;
    142142        const ast::StaticAssertDecl * visit( const ast::StaticAssertDecl     * ) override final;
    143         const ast::DeclWithType *     visit( const ast::InlineValueDecl      * ) override final;
     143        const ast::DeclWithType *     visit( const ast::InlineMemberDecl      * ) override final;
    144144        const ast::CompoundStmt *     visit( const ast::CompoundStmt         * ) override final;
    145145        const ast::Stmt *             visit( const ast::ExprStmt             * ) override final;
  • src/AST/Pass.impl.hpp

    r639e4fc r71806e0  
    805805// DeclWithType
    806806template< typename core_t >
    807 const ast::DeclWithType * ast::Pass< core_t >::visit( const ast::InlineValueDecl * node ) {
    808         VISIT_START( node );
    809 
    810         if ( __visit_children() ) {
    811                 {
    812                         guard_symtab guard { *this };
    813                         maybe_accept( node, &InlineValueDecl::type );
     807const ast::DeclWithType * ast::Pass< core_t >::visit( const ast::InlineMemberDecl * node ) {
     808        VISIT_START( node );
     809
     810        if ( __visit_children() ) {
     811                {
     812                        guard_symtab guard { *this };
     813                        maybe_accept( node, &InlineMemberDecl::type );
    814814                }
    815815        }
  • src/AST/Print.cpp

    r639e4fc r71806e0  
    401401        }
    402402
    403         virtual const ast::DeclWithType * visit( const ast::InlineValueDecl * node ) override final {
     403        virtual const ast::DeclWithType * visit( const ast::InlineMemberDecl * node ) override final {
    404404                os << "inline ";
    405405                if ( ! node->name.empty() ) os << node->name;
  • src/AST/Visitor.hpp

    r639e4fc r71806e0  
    3333    virtual const ast::DirectiveDecl *    visit( const ast::DirectiveDecl        * ) = 0;
    3434    virtual const ast::StaticAssertDecl * visit( const ast::StaticAssertDecl     * ) = 0;
    35     virtual const ast::DeclWithType *     visit( const ast::InlineValueDecl      * ) = 0;
     35    virtual const ast::DeclWithType *     visit( const ast::InlineMemberDecl      * ) = 0;
    3636    virtual const ast::CompoundStmt *     visit( const ast::CompoundStmt         * ) = 0;
    3737    virtual const ast::Stmt *             visit( const ast::ExprStmt             * ) = 0;
  • src/Common/CodeLocationTools.cpp

    r639e4fc r71806e0  
    111111    macro(DirectiveDecl, DirectiveDecl) \
    112112    macro(StaticAssertDecl, StaticAssertDecl) \
    113     macro(InlineValueDecl, DeclWithType) \
     113    macro(InlineMemberDecl, DeclWithType) \
    114114    macro(CompoundStmt, CompoundStmt) \
    115115    macro(ExprStmt, Stmt) \
  • src/Common/PassVisitor.h

    r639e4fc r71806e0  
    8181        virtual void visit( StaticAssertDecl * assertDecl ) override final;
    8282        virtual void visit( const StaticAssertDecl * assertDecl ) override final;
    83         virtual void visit( InlineValueDecl * valueDecl ) override final;
    84         virtual void visit( const InlineValueDecl * valueDecl ) override final;
     83        virtual void visit( InlineMemberDecl * valueDecl ) override final;
     84        virtual void visit( const InlineMemberDecl * valueDecl ) override final;
    8585
    8686        virtual void visit( CompoundStmt * compoundStmt ) override final;
     
    275275        virtual DirectiveDecl * mutate( DirectiveDecl * directiveDecl ) override final;
    276276        virtual StaticAssertDecl * mutate( StaticAssertDecl * assertDecl ) override final;
    277         virtual DeclarationWithType * mutate( InlineValueDecl * valueDecl ) override final;
     277        virtual DeclarationWithType * mutate( InlineMemberDecl * valueDecl ) override final;
    278278
    279279        virtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) override final;
  • src/Common/PassVisitor.impl.h

    r639e4fc r71806e0  
    10471047
    10481048//--------------------------------------------------------------------------
    1049 // InlineValueDecl
    1050 template< typename pass_type >
    1051 void PassVisitor< pass_type >::visit( InlineValueDecl * node ) {
     1049// InlineMemberDecl
     1050template< typename pass_type >
     1051void PassVisitor< pass_type >::visit( InlineMemberDecl * node ) {
    10521052        VISIT_START( node );
    10531053
     
    10581058
    10591059template< typename pass_type >
    1060 void PassVisitor< pass_type >::visit( const InlineValueDecl * node ) {
     1060void PassVisitor< pass_type >::visit( const InlineMemberDecl * node ) {
    10611061        VISIT_START( node );
    10621062
     
    10671067
    10681068template< typename pass_type >
    1069 DeclarationWithType * PassVisitor< pass_type >::mutate( InlineValueDecl * node ) {
     1069DeclarationWithType * PassVisitor< pass_type >::mutate( InlineMemberDecl * node ) {
    10701070        MUTATE_START( node );
    10711071
  • src/Parser/DeclarationNode.cc

    r639e4fc r71806e0  
    2727#include "SynTree/LinkageSpec.h"   // for Spec, linkageName, Cforall
    2828#include "SynTree/Attribute.h"     // for Attribute
    29 #include "SynTree/Declaration.h"   // for TypeDecl, ObjectDecl, InlineValueDecl, Declaration
     29#include "SynTree/Declaration.h"   // for TypeDecl, ObjectDecl, InlineMemberDecl, Declaration
    3030#include "SynTree/Expression.h"    // for Expression, ConstantExpr
    3131#include "SynTree/Statement.h"     // for AsmStmt
     
    11661166        } // if
    11671167        if ( enumInLine ) {
    1168                 return new InlineValueDecl( *name, storageClasses, linkage, nullptr );
     1168                return new InlineMemberDecl( *name, storageClasses, linkage, nullptr );
    11691169        } // if
    11701170        assertf( name, "ObjectDecl must a have name\n" );
  • src/SynTree/Declaration.h

    r639e4fc r71806e0  
    450450
    451451
    452 class InlineValueDecl : public DeclarationWithType {
     452class InlineMemberDecl : public DeclarationWithType {
    453453        typedef DeclarationWithType Parent;
    454454  public:
    455455        Type * type;
    456456
    457         InlineValueDecl( const std::string & name, Type::StorageClasses scs, LinkageSpec::Spec linkage, Type * type,
     457        InlineMemberDecl( const std::string & name, Type::StorageClasses scs, LinkageSpec::Spec linkage, Type * type,
    458458                                const std::list< Attribute * > attributes = std::list< Attribute * >(), Type::FuncSpecifiers fs = Type::FuncSpecifiers() );
    459         InlineValueDecl( const InlineValueDecl & other );
    460         virtual ~InlineValueDecl();
     459        InlineMemberDecl( const InlineMemberDecl & other );
     460        virtual ~InlineMemberDecl();
    461461
    462462        virtual Type * get_type() const override { return type; }
    463463        virtual void set_type(Type * newType) override { type = newType; }
    464464
    465         static InlineValueDecl * newInlineValueDecl( const std::string & name, Type * type );
    466 
    467         virtual InlineValueDecl * clone() const override { return new InlineValueDecl( *this ); }
     465        static InlineMemberDecl * newInlineMemberDecl( const std::string & name, Type * type );
     466
     467        virtual InlineMemberDecl * clone() const override { return new InlineMemberDecl( *this ); }
    468468        virtual void accept( Visitor & v ) override { v.visit( this ); }
    469469        virtual void accept( Visitor & v ) const override { v.visit( this ); }
  • src/SynTree/InlineMemberDecl.cc

    r639e4fc r71806e0  
    99#include "Type.h"                // for Type, Type::StorageClasses, Type::Fu...
    1010
    11 InlineValueDecl::InlineValueDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage,
     11InlineMemberDecl::InlineMemberDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage,
    1212Type * type, const std::list< Attribute * >attributes, Type::FuncSpecifiers fs)
    1313    : Parent( name, scs, linkage, attributes, fs ), type( type ) {}
    1414
    15 InlineValueDecl::InlineValueDecl( const InlineValueDecl &other)
     15InlineMemberDecl::InlineMemberDecl( const InlineMemberDecl &other)
    1616    : Parent( other), type( maybeClone( other.type ) ) {}
    1717
    18 InlineValueDecl::~InlineValueDecl() { delete type; }
     18InlineMemberDecl::~InlineMemberDecl() { delete type; }
    1919
    20 InlineValueDecl * InlineValueDecl::newInlineValueDecl( const std::string &name, Type * type ) {
    21     return new InlineValueDecl( name, Type::StorageClasses(), LinkageSpec::C, type );
     20InlineMemberDecl * InlineMemberDecl::newInlineMemberDecl( const std::string &name, Type * type ) {
     21    return new InlineMemberDecl( name, Type::StorageClasses(), LinkageSpec::C, type );
    2222}
    2323
    24 void InlineValueDecl::print( std::ostream &os, Indenter indent ) const {
     24void InlineMemberDecl::print( std::ostream &os, Indenter indent ) const {
    2525    if ( name != "" ) os << name << ": ";
    2626
     
    4444}
    4545
    46 void InlineValueDecl::printShort( std::ostream &os, Indenter indent ) const {
     46void InlineMemberDecl::printShort( std::ostream &os, Indenter indent ) const {
    4747    if ( name != "" ) os << name << ": ";
    4848
  • src/SynTree/Mutator.h

    r639e4fc r71806e0  
    3636        virtual DirectiveDecl * mutate( DirectiveDecl * directiveDecl ) = 0;
    3737        virtual StaticAssertDecl * mutate( StaticAssertDecl * assertDecl ) = 0;
    38         virtual DeclarationWithType * mutate( InlineValueDecl * inlineValueDecl ) = 0;
     38        virtual DeclarationWithType * mutate( InlineMemberDecl * InlineMemberDecl ) = 0;
    3939
    4040        virtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) = 0;
  • src/SynTree/SynTree.h

    r639e4fc r71806e0  
    3838class DirectiveDecl;
    3939class StaticAssertDecl;
    40 class InlineValueDecl;
     40class InlineMemberDecl;
    4141
    4242class Statement;
  • src/SynTree/Visitor.h

    r639e4fc r71806e0  
    4949        virtual void visit( StaticAssertDecl * node ) { visit( const_cast<const StaticAssertDecl *>(node) ); }
    5050        virtual void visit( const StaticAssertDecl * assertDecl ) = 0;
    51         virtual void visit( InlineValueDecl * node ) { visit( const_cast<const InlineValueDecl *>(node) ); }
    52         virtual void visit( const InlineValueDecl * valueDecl ) = 0;
     51        virtual void visit( InlineMemberDecl * node ) { visit( const_cast<const InlineMemberDecl *>(node) ); }
     52        virtual void visit( const InlineMemberDecl * valueDecl ) = 0;
    5353
    5454        virtual void visit( CompoundStmt * node ) { visit( const_cast<const CompoundStmt *>(node) ); }
  • src/SynTree/module.mk

    r639e4fc r71806e0  
    4242      SynTree/Initializer.cc \
    4343      SynTree/Initializer.h \
    44       SynTree/InlineValueDecl.cc \
     44      SynTree/InlineMemberDecl.cc \
    4545      SynTree/Label.h \
    4646      SynTree/LinkageSpec.cc \
  • src/Validate/EnumAndPointerDecay.cpp

    r639e4fc r71806e0  
    4444                if ( ast::ObjectDecl const * object = (*it).as<ast::ObjectDecl>() ) {
    4545                        buffer.push_back( ast::mutate_field( object, &ast::ObjectDecl::type, new ast::EnumInstType( decl, ast::CV::Const ) ) );
    46                 } else if ( ast::InlineValueDecl const * value = (*it).as<ast::InlineValueDecl>() ) {
     46                } else if ( ast::InlineMemberDecl const * value = (*it).as<ast::InlineMemberDecl>() ) {
    4747                        if ( auto targetEnum = symtab.lookupEnum( value->name ) ) {
    4848                                for ( auto singleMember : targetEnum->members ) {
Note: See TracChangeset for help on using the changeset viewer.