Changeset b0845f9 for src/SymTab/FixFunction.cc
- Timestamp:
- Nov 17, 2023, 10:40:21 AM (9 months ago)
- Branches:
- master
- Children:
- 0f6d2884
- Parents:
- e580aa5
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/SymTab/FixFunction.cc
re580aa5 rb0845f9 26 26 27 27 namespace { 28 struct FixFunction final : public ast::WithShortCircuiting {29 bool isVoid = false;30 28 31 void previsit( const ast::FunctionDecl * ) { visit_children = false; } 29 struct FixFunction final : public ast::WithShortCircuiting { 30 bool isVoid = false; 32 31 33 const ast::DeclWithType * postvisit( const ast::FunctionDecl * func ) { 34 // Cannot handle cases with asserions. 35 assert( func->assertions.empty() ); 36 return new ast::ObjectDecl{ 37 func->location, func->name, new ast::PointerType( func->type ), nullptr, 38 func->storage, func->linkage, nullptr, copy( func->attributes ) }; 39 } 32 void previsit( const ast::FunctionDecl * ) { visit_children = false; } 40 33 41 void previsit( const ast::ArrayType * ) { visit_children = false; } 34 const ast::DeclWithType * postvisit( const ast::FunctionDecl * func ) { 35 // Cannot handle cases with asserions. 36 assert( func->assertions.empty() ); 37 return new ast::ObjectDecl{ 38 func->location, func->name, new ast::PointerType( func->type ), nullptr, 39 func->storage, func->linkage, nullptr, copy( func->attributes ) }; 40 } 42 41 43 const ast::Type * postvisit( const ast::ArrayType * array ) { 44 return new ast::PointerType{ 45 array->base, array->dimension, array->isVarLen, array->isStatic, 46 array->qualifiers }; 47 } 42 void previsit( const ast::ArrayType * ) { visit_children = false; } 48 43 49 void previsit( const ast::FunctionType * ) { visit_children = false; } 44 const ast::Type * postvisit( const ast::ArrayType * array ) { 45 return new ast::PointerType{ 46 array->base, array->dimension, array->isVarLen, array->isStatic, 47 array->qualifiers }; 48 } 50 49 51 const ast::Type * postvisit( const ast::FunctionType * type ) { 52 return new ast::PointerType( type ); 53 } 50 void previsit( const ast::FunctionType * ) { visit_children = false; } 54 51 55 void previsit( const ast::VoidType * ) { isVoid = true; } 52 const ast::Type * postvisit( const ast::FunctionType * type ) { 53 return new ast::PointerType( type ); 54 } 56 55 57 void previsit( const ast::BasicType * ) { visit_children = false; } 58 void previsit( const ast::PointerType * ) { visit_children = false; } 59 void previsit( const ast::StructInstType * ) { visit_children = false; } 60 void previsit( const ast::UnionInstType * ) { visit_children = false; } 61 void previsit( const ast::EnumInstType * ) { visit_children = false; } 62 void previsit( const ast::TraitInstType * ) { visit_children = false; } 63 void previsit( const ast::TypeInstType * ) { visit_children = false; } 64 void previsit( const ast::TupleType * ) { visit_children = false; } 65 void previsit( const ast::VarArgsType * ) { visit_children = false; } 66 void previsit( const ast::ZeroType * ) { visit_children = false; } 67 void previsit( const ast::OneType * ) { visit_children = false; } 68 }; 56 void previsit( const ast::VoidType * ) { isVoid = true; } 57 58 void previsit( const ast::BasicType * ) { visit_children = false; } 59 void previsit( const ast::PointerType * ) { visit_children = false; } 60 void previsit( const ast::StructInstType * ) { visit_children = false; } 61 void previsit( const ast::UnionInstType * ) { visit_children = false; } 62 void previsit( const ast::EnumInstType * ) { visit_children = false; } 63 void previsit( const ast::TraitInstType * ) { visit_children = false; } 64 void previsit( const ast::TypeInstType * ) { visit_children = false; } 65 void previsit( const ast::TupleType * ) { visit_children = false; } 66 void previsit( const ast::VarArgsType * ) { visit_children = false; } 67 void previsit( const ast::ZeroType * ) { visit_children = false; } 68 void previsit( const ast::OneType * ) { visit_children = false; } 69 }; 70 69 71 } // anonymous namespace 70 72
Note: See TracChangeset
for help on using the changeset viewer.