Changes in src/AST/Decl.hpp [99da267:e67991f]
- File:
-
- 1 edited
-
src/AST/Decl.hpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.hpp
r99da267 re67991f 32 32 33 33 // Must be included in *all* AST classes; should be #undef'd at the end of the file 34 #define MUTATE_FRIEND \ 35 template<typename node_t> friend node_t * mutate(const node_t * node); \ 36 template<typename node_t> friend node_t * shallowCopy(const node_t * node); 34 #define MUTATE_FRIEND template<typename node_t> friend node_t * mutate(const node_t * node); 37 35 38 36 namespace ast { … … 89 87 virtual const Type * get_type() const = 0; 90 88 /// Set type of this declaration. May be verified by subclass 91 virtual void set_type( const Type *) = 0;89 virtual void set_type(Type *) = 0; 92 90 93 91 const DeclWithType * accept( Visitor & v ) const override = 0; … … 104 102 ptr<Expr> bitfieldWidth; 105 103 106 ObjectDecl( const CodeLocation & loc, const std::string & name, const Type * type, 107 const Init * init = nullptr, Storage::Classes storage = {}, 108 Linkage::Spec linkage = Linkage::C, const Expr * bitWd = nullptr, 104 ObjectDecl( const CodeLocation & loc, const std::string & name, const Type * type, 105 const Init * init = nullptr, Storage::Classes storage = {}, 106 Linkage::Spec linkage = Linkage::C, const Expr * bitWd = nullptr, 109 107 std::vector< ptr<Attribute> > && attrs = {}, Function::Specs fs = {} ) 110 108 : DeclWithType( loc, name, storage, linkage, std::move(attrs), fs ), type( type ), … … 112 110 113 111 const Type* get_type() const override { return type; } 114 void set_type( constType * ty ) override { type = ty; }112 void set_type( Type * ty ) override { type = ty; } 115 113 116 114 const DeclWithType * accept( Visitor& v ) const override { return v.visit( this ); } … … 134 132 135 133 const Type * get_type() const override; 136 void set_type( const Type * t) override;134 void set_type(Type * t) override; 137 135 138 136 bool has_body() const { return stmts; } … … 151 149 std::vector<ptr<DeclWithType>> assertions; 152 150 153 NamedTypeDecl( 154 const CodeLocation & loc, const std::string & name, Storage::Classes storage, 155 const Type * b, Linkage::Spec spec = Linkage::Cforall ) 151 NamedTypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, 152 Type* b, Linkage::Spec spec = Linkage::Cforall ) 156 153 : Decl( loc, name, storage, spec ), base( b ), params(), assertions() {} 157 154 … … 188 185 }; 189 186 190 TypeDecl( 191 const CodeLocation & loc, const std::string & name, Storage::Classes storage, 192 const Type * b, TypeVar::Kind k, bool s, const Type * i = nullptr ) 187 TypeDecl( const CodeLocation& loc, const std::string& name, Storage::Classes storage, Type* b, 188 TypeVar::Kind k, bool s, Type* i = nullptr ) 193 189 : NamedTypeDecl( loc, name, storage, b ), kind( k ), sized( k == TypeVar::Ttype || s ), 194 190 init( i ) {} … … 325 321 }; 326 322 323 /// With statement `with (...) ...` 324 class WithStmt final : public Decl { 325 public: 326 std::vector<ptr<Expr>> exprs; 327 ptr<Stmt> stmt; 328 329 WithStmt( const CodeLocation & loc, std::vector<ptr<Expr>> && exprs, const Stmt * stmt ) 330 : Decl(loc, "", Storage::Auto, Linkage::Cforall), exprs(std::move(exprs)), stmt(stmt) {} 331 332 const Decl * accept( Visitor & v ) const override { return v.visit( this ); } 333 private: 334 WithStmt * clone() const override { return new WithStmt{ *this }; } 335 MUTATE_FRIEND 336 }; 337 327 338 class AsmDecl : public Decl { 328 339 public:
Note:
See TracChangeset
for help on using the changeset viewer.