- Timestamp:
- Nov 10, 2022, 8:21:54 PM (3 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 7491f97, e4d7c1c
- Parents:
- 639e4fc
- Location:
- src
- Files:
-
- 17 edited
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r639e4fc r71806e0 236 236 } 237 237 238 // Inline ValueDecl vanish after EnumAndPointerDecay pass so no necessary to implement NewToOld239 const ast::DeclWithType * visit( const ast::Inline ValueDecl * 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 { 240 240 assert( false ); 241 241 (void) node; … … 1869 1869 } 1870 1870 1871 virtual void visit( const Inline ValueDecl * old ) override final {1871 virtual void visit( const InlineMemberDecl * old ) override final { 1872 1872 if ( inCache( old ) ) { 1873 1873 return; … … 1876 1876 auto&& attr = GET_ACCEPT_V(attributes, Attribute); 1877 1877 1878 auto decl = new ast::Inline ValueDecl(1878 auto decl = new ast::InlineMemberDecl( 1879 1879 old->location, 1880 1880 old->name, -
src/AST/Decl.hpp
r639e4fc r71806e0 411 411 }; 412 412 413 class Inline ValueDecl final : public DeclWithType {413 class InlineMemberDecl final : public DeclWithType { 414 414 public: 415 415 ptr<Type> type; 416 416 417 Inline ValueDecl( const CodeLocation & loc, const std::string & name, const Type * type,417 InlineMemberDecl( const CodeLocation & loc, const std::string & name, const Type * type, 418 418 Storage::Classes storage = {}, Linkage::Spec linkage = Linkage::Cforall, 419 419 std::vector< ptr<Attribute> > && attrs = {}, Function::Specs fs = {} ) … … 425 425 const DeclWithType * accept( Visitor& v ) const override { return v.visit( this ); } 426 426 private: 427 Inline ValueDecl * clone() const override { return new InlineValueDecl{ *this }; }427 InlineMemberDecl * clone() const override { return new InlineMemberDecl{ *this }; } 428 428 MUTATE_FRIEND 429 429 }; -
src/AST/Fwd.hpp
r639e4fc r71806e0 37 37 class DirectiveDecl; 38 38 class StaticAssertDecl; 39 class Inline ValueDecl;39 class InlineMemberDecl; 40 40 41 41 class Stmt; -
src/AST/Pass.hpp
r639e4fc r71806e0 141 141 const ast::DirectiveDecl * visit( const ast::DirectiveDecl * ) override final; 142 142 const ast::StaticAssertDecl * visit( const ast::StaticAssertDecl * ) override final; 143 const ast::DeclWithType * visit( const ast::Inline ValueDecl * ) override final;143 const ast::DeclWithType * visit( const ast::InlineMemberDecl * ) override final; 144 144 const ast::CompoundStmt * visit( const ast::CompoundStmt * ) override final; 145 145 const ast::Stmt * visit( const ast::ExprStmt * ) override final; -
src/AST/Pass.impl.hpp
r639e4fc r71806e0 805 805 // DeclWithType 806 806 template< typename core_t > 807 const ast::DeclWithType * ast::Pass< core_t >::visit( const ast::Inline ValueDecl * node ) {808 VISIT_START( node ); 809 810 if ( __visit_children() ) { 811 { 812 guard_symtab guard { *this }; 813 maybe_accept( node, &Inline ValueDecl::type );807 const 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 ); 814 814 } 815 815 } -
src/AST/Print.cpp
r639e4fc r71806e0 401 401 } 402 402 403 virtual const ast::DeclWithType * visit( const ast::Inline ValueDecl * node ) override final {403 virtual const ast::DeclWithType * visit( const ast::InlineMemberDecl * node ) override final { 404 404 os << "inline "; 405 405 if ( ! node->name.empty() ) os << node->name; -
src/AST/Visitor.hpp
r639e4fc r71806e0 33 33 virtual const ast::DirectiveDecl * visit( const ast::DirectiveDecl * ) = 0; 34 34 virtual const ast::StaticAssertDecl * visit( const ast::StaticAssertDecl * ) = 0; 35 virtual const ast::DeclWithType * visit( const ast::Inline ValueDecl * ) = 0;35 virtual const ast::DeclWithType * visit( const ast::InlineMemberDecl * ) = 0; 36 36 virtual const ast::CompoundStmt * visit( const ast::CompoundStmt * ) = 0; 37 37 virtual const ast::Stmt * visit( const ast::ExprStmt * ) = 0; -
src/Common/CodeLocationTools.cpp
r639e4fc r71806e0 111 111 macro(DirectiveDecl, DirectiveDecl) \ 112 112 macro(StaticAssertDecl, StaticAssertDecl) \ 113 macro(Inline ValueDecl, DeclWithType) \113 macro(InlineMemberDecl, DeclWithType) \ 114 114 macro(CompoundStmt, CompoundStmt) \ 115 115 macro(ExprStmt, Stmt) \ -
src/Common/PassVisitor.h
r639e4fc r71806e0 81 81 virtual void visit( StaticAssertDecl * assertDecl ) override final; 82 82 virtual void visit( const StaticAssertDecl * assertDecl ) override final; 83 virtual void visit( Inline ValueDecl * valueDecl ) override final;84 virtual void visit( const Inline ValueDecl * valueDecl ) override final;83 virtual void visit( InlineMemberDecl * valueDecl ) override final; 84 virtual void visit( const InlineMemberDecl * valueDecl ) override final; 85 85 86 86 virtual void visit( CompoundStmt * compoundStmt ) override final; … … 275 275 virtual DirectiveDecl * mutate( DirectiveDecl * directiveDecl ) override final; 276 276 virtual StaticAssertDecl * mutate( StaticAssertDecl * assertDecl ) override final; 277 virtual DeclarationWithType * mutate( Inline ValueDecl * valueDecl ) override final;277 virtual DeclarationWithType * mutate( InlineMemberDecl * valueDecl ) override final; 278 278 279 279 virtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) override final; -
src/Common/PassVisitor.impl.h
r639e4fc r71806e0 1047 1047 1048 1048 //-------------------------------------------------------------------------- 1049 // Inline ValueDecl1050 template< typename pass_type > 1051 void PassVisitor< pass_type >::visit( Inline ValueDecl * node ) {1049 // InlineMemberDecl 1050 template< typename pass_type > 1051 void PassVisitor< pass_type >::visit( InlineMemberDecl * node ) { 1052 1052 VISIT_START( node ); 1053 1053 … … 1058 1058 1059 1059 template< typename pass_type > 1060 void PassVisitor< pass_type >::visit( const Inline ValueDecl * node ) {1060 void PassVisitor< pass_type >::visit( const InlineMemberDecl * node ) { 1061 1061 VISIT_START( node ); 1062 1062 … … 1067 1067 1068 1068 template< typename pass_type > 1069 DeclarationWithType * PassVisitor< pass_type >::mutate( Inline ValueDecl * node ) {1069 DeclarationWithType * PassVisitor< pass_type >::mutate( InlineMemberDecl * node ) { 1070 1070 MUTATE_START( node ); 1071 1071 -
src/Parser/DeclarationNode.cc
r639e4fc r71806e0 27 27 #include "SynTree/LinkageSpec.h" // for Spec, linkageName, Cforall 28 28 #include "SynTree/Attribute.h" // for Attribute 29 #include "SynTree/Declaration.h" // for TypeDecl, ObjectDecl, Inline ValueDecl, Declaration29 #include "SynTree/Declaration.h" // for TypeDecl, ObjectDecl, InlineMemberDecl, Declaration 30 30 #include "SynTree/Expression.h" // for Expression, ConstantExpr 31 31 #include "SynTree/Statement.h" // for AsmStmt … … 1166 1166 } // if 1167 1167 if ( enumInLine ) { 1168 return new Inline ValueDecl( *name, storageClasses, linkage, nullptr );1168 return new InlineMemberDecl( *name, storageClasses, linkage, nullptr ); 1169 1169 } // if 1170 1170 assertf( name, "ObjectDecl must a have name\n" ); -
src/SynTree/Declaration.h
r639e4fc r71806e0 450 450 451 451 452 class Inline ValueDecl : public DeclarationWithType {452 class InlineMemberDecl : public DeclarationWithType { 453 453 typedef DeclarationWithType Parent; 454 454 public: 455 455 Type * type; 456 456 457 Inline ValueDecl( 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, 458 458 const std::list< Attribute * > attributes = std::list< Attribute * >(), Type::FuncSpecifiers fs = Type::FuncSpecifiers() ); 459 Inline ValueDecl( const InlineValueDecl & other );460 virtual ~Inline ValueDecl();459 InlineMemberDecl( const InlineMemberDecl & other ); 460 virtual ~InlineMemberDecl(); 461 461 462 462 virtual Type * get_type() const override { return type; } 463 463 virtual void set_type(Type * newType) override { type = newType; } 464 464 465 static Inline ValueDecl * newInlineValueDecl( const std::string & name, Type * type );466 467 virtual Inline ValueDecl * 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 ); } 468 468 virtual void accept( Visitor & v ) override { v.visit( this ); } 469 469 virtual void accept( Visitor & v ) const override { v.visit( this ); } -
src/SynTree/InlineMemberDecl.cc
r639e4fc r71806e0 9 9 #include "Type.h" // for Type, Type::StorageClasses, Type::Fu... 10 10 11 Inline ValueDecl::InlineValueDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage,11 InlineMemberDecl::InlineMemberDecl( const std::string &name, Type::StorageClasses scs, LinkageSpec::Spec linkage, 12 12 Type * type, const std::list< Attribute * >attributes, Type::FuncSpecifiers fs) 13 13 : Parent( name, scs, linkage, attributes, fs ), type( type ) {} 14 14 15 Inline ValueDecl::InlineValueDecl( const InlineValueDecl &other)15 InlineMemberDecl::InlineMemberDecl( const InlineMemberDecl &other) 16 16 : Parent( other), type( maybeClone( other.type ) ) {} 17 17 18 Inline ValueDecl::~InlineValueDecl() { delete type; }18 InlineMemberDecl::~InlineMemberDecl() { delete type; } 19 19 20 Inline ValueDecl * InlineValueDecl::newInlineValueDecl( const std::string &name, Type * type ) {21 return new Inline ValueDecl( name, Type::StorageClasses(), LinkageSpec::C, type );20 InlineMemberDecl * InlineMemberDecl::newInlineMemberDecl( const std::string &name, Type * type ) { 21 return new InlineMemberDecl( name, Type::StorageClasses(), LinkageSpec::C, type ); 22 22 } 23 23 24 void Inline ValueDecl::print( std::ostream &os, Indenter indent ) const {24 void InlineMemberDecl::print( std::ostream &os, Indenter indent ) const { 25 25 if ( name != "" ) os << name << ": "; 26 26 … … 44 44 } 45 45 46 void Inline ValueDecl::printShort( std::ostream &os, Indenter indent ) const {46 void InlineMemberDecl::printShort( std::ostream &os, Indenter indent ) const { 47 47 if ( name != "" ) os << name << ": "; 48 48 -
src/SynTree/Mutator.h
r639e4fc r71806e0 36 36 virtual DirectiveDecl * mutate( DirectiveDecl * directiveDecl ) = 0; 37 37 virtual StaticAssertDecl * mutate( StaticAssertDecl * assertDecl ) = 0; 38 virtual DeclarationWithType * mutate( Inline ValueDecl * inlineValueDecl ) = 0;38 virtual DeclarationWithType * mutate( InlineMemberDecl * InlineMemberDecl ) = 0; 39 39 40 40 virtual CompoundStmt * mutate( CompoundStmt * compoundStmt ) = 0; -
src/SynTree/SynTree.h
r639e4fc r71806e0 38 38 class DirectiveDecl; 39 39 class StaticAssertDecl; 40 class Inline ValueDecl;40 class InlineMemberDecl; 41 41 42 42 class Statement; -
src/SynTree/Visitor.h
r639e4fc r71806e0 49 49 virtual void visit( StaticAssertDecl * node ) { visit( const_cast<const StaticAssertDecl *>(node) ); } 50 50 virtual void visit( const StaticAssertDecl * assertDecl ) = 0; 51 virtual void visit( Inline ValueDecl * node ) { visit( const_cast<const InlineValueDecl *>(node) ); }52 virtual void visit( const Inline ValueDecl * valueDecl ) = 0;51 virtual void visit( InlineMemberDecl * node ) { visit( const_cast<const InlineMemberDecl *>(node) ); } 52 virtual void visit( const InlineMemberDecl * valueDecl ) = 0; 53 53 54 54 virtual void visit( CompoundStmt * node ) { visit( const_cast<const CompoundStmt *>(node) ); } -
src/SynTree/module.mk
r639e4fc r71806e0 42 42 SynTree/Initializer.cc \ 43 43 SynTree/Initializer.h \ 44 SynTree/Inline ValueDecl.cc \44 SynTree/InlineMemberDecl.cc \ 45 45 SynTree/Label.h \ 46 46 SynTree/LinkageSpec.cc \ -
src/Validate/EnumAndPointerDecay.cpp
r639e4fc r71806e0 44 44 if ( ast::ObjectDecl const * object = (*it).as<ast::ObjectDecl>() ) { 45 45 buffer.push_back( ast::mutate_field( object, &ast::ObjectDecl::type, new ast::EnumInstType( decl, ast::CV::Const ) ) ); 46 } else if ( ast::Inline ValueDecl const * value = (*it).as<ast::InlineValueDecl>() ) {46 } else if ( ast::InlineMemberDecl const * value = (*it).as<ast::InlineMemberDecl>() ) { 47 47 if ( auto targetEnum = symtab.lookupEnum( value->name ) ) { 48 48 for ( auto singleMember : targetEnum->members ) {
Note:
See TracChangeset
for help on using the changeset viewer.