- Timestamp:
- Oct 28, 2022, 3:11:57 PM (2 years ago)
- Branches:
- ADT, ast-experimental, master
- Children:
- 93d2219
- Parents:
- 77de429
- Location:
- src/AST
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Convert.cpp
r77de429 re874605 234 234 } 235 235 return declWithTypePostamble( decl, node ); 236 } 237 238 // InlineValueDecl vanish after EnumAndPointerDecay pass so no necessary to implement NewToOld 239 const ast::DeclWithType * visit( const ast::InlineValueDecl * node ) override final { 240 assert( false ); 241 (void) node; 242 return nullptr; 236 243 } 237 244 … … 1863 1870 } 1864 1871 1872 virtual void visit( const InlineValueDecl * old ) override final { 1873 if ( inCache( old ) ) { 1874 return; 1875 } 1876 auto&& type = GET_ACCEPT_1(type, Type); 1877 auto&& attr = GET_ACCEPT_V(attributes, Attribute); 1878 1879 auto decl = new ast::InlineValueDecl( 1880 old->location, 1881 old->name, 1882 type, 1883 { old->get_storageClasses().val }, 1884 { old->linkage.val }, 1885 std::move(attr), 1886 { old->get_funcSpec().val } 1887 ); 1888 cache.emplace(old, decl); 1889 assert(cache.find( old ) != cache.end()); 1890 decl->scopeLevel = old->scopeLevel; 1891 decl->mangleName = old->mangleName; 1892 decl->isDeleted = old->isDeleted; 1893 decl->asmName = GET_ACCEPT_1(asmName, Expr); 1894 decl->uniqueId = old->uniqueId; 1895 decl->extension = old->extension; 1896 1897 this->node = decl; 1898 } 1899 1865 1900 virtual void visit( const CompoundStmt * old ) override final { 1866 1901 if ( inCache( old ) ) return; -
src/AST/Decl.hpp
r77de429 re874605 414 414 }; 415 415 416 class InlineValueDecl final : public DeclWithType { 417 public: 418 ptr<Type> type; 419 420 InlineValueDecl( const CodeLocation & loc, const std::string & name, const Type * type, 421 Storage::Classes storage = {}, Linkage::Spec linkage = Linkage::Cforall, 422 std::vector< ptr<Attribute> > && attrs = {}, Function::Specs fs = {} ) 423 : DeclWithType( loc, name, storage, linkage, std::move(attrs), fs ), type( type ) {} 424 425 const Type * get_type() const override { return type; } 426 void set_type( const Type * ty ) override { type = ty; } 427 428 const DeclWithType * accept( Visitor& v ) const override { return v.visit( this ); } 429 private: 430 InlineValueDecl * clone() const override { return new InlineValueDecl{ *this }; } 431 MUTATE_FRIEND 432 }; 416 433 } 417 434 -
src/AST/Fwd.hpp
r77de429 re874605 37 37 class DirectiveDecl; 38 38 class StaticAssertDecl; 39 class InlineValueDecl; 39 40 40 41 class Stmt; -
src/AST/Pass.hpp
r77de429 re874605 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::InlineValueDecl * ) override final; 143 144 const ast::CompoundStmt * visit( const ast::CompoundStmt * ) override final; 144 145 const ast::Stmt * visit( const ast::ExprStmt * ) override final; -
src/AST/Pass.impl.hpp
r77de429 re874605 803 803 804 804 //-------------------------------------------------------------------------- 805 // DeclWithType 806 template< 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 ); 814 } 815 } 816 817 VISIT_END( DeclWithType, node ); 818 } 819 820 //-------------------------------------------------------------------------- 805 821 // CompoundStmt 806 822 template< typename core_t > -
src/AST/Print.cpp
r77de429 re874605 398 398 virtual const ast::Decl * visit( const ast::StructDecl * node ) override final { 399 399 print(node); 400 return node; 401 } 402 403 virtual const ast::DeclWithType * visit( const ast::InlineValueDecl * node ) override final { 404 os << "inline "; 405 if ( ! node->name.empty() ) os << node->name; 406 400 407 return node; 401 408 } -
src/AST/Visitor.hpp
r77de429 re874605 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::InlineValueDecl * ) = 0; 35 36 virtual const ast::CompoundStmt * visit( const ast::CompoundStmt * ) = 0; 36 37 virtual const ast::Stmt * visit( const ast::ExprStmt * ) = 0;
Note: See TracChangeset
for help on using the changeset viewer.