Changes in src/AST/Decl.hpp [87701b6:10a1225]
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.hpp
r87701b6 r10a1225 30 30 #include "Parser/ParseNode.h" // for DeclarationNode::Aggregate 31 31 32 // Must be included in *all* AST classes; should be #undef'd at the end of the file 33 #define MUTATE_FRIEND template<typename node_t> friend node_t * mutate(const node_t * node); 34 32 35 namespace ast { 33 36 … … 55 58 private: 56 59 Decl * clone() const override = 0; 60 MUTATE_FRIEND 57 61 }; 58 62 … … 87 91 private: 88 92 DeclWithType * clone() const override = 0; 93 MUTATE_FRIEND 89 94 }; 90 95 … … 96 101 ptr<Expr> bitfieldWidth; 97 102 98 ObjectDecl( const CodeLocation & loc, const std::string& name, Type* type, Init* init = nullptr,99 Storage::Classes storage = {}, Linkage::Spec linkage = Linkage::C, Expr * bitWd = nullptr,100 std::vector< ptr<Attribute>>&& attrs = {}, Function::Specs fs = {})103 ObjectDecl( const CodeLocation & loc, const std::string & name, const Type * type, Init * init = nullptr, 104 Storage::Classes storage = {}, Linkage::Spec linkage = Linkage::C, Expr * bitWd = nullptr, 105 std::vector< ptr<Attribute> > && attrs = {}, Function::Specs fs = {}) 101 106 : DeclWithType( loc, name, storage, linkage, std::move(attrs), fs ), type( type ), 102 107 init( init ), bitfieldWidth( bitWd ) {} … … 108 113 private: 109 114 ObjectDecl * clone() const override { return new ObjectDecl{ *this }; } 110 111 /// Must be copied in ALL derived classes 112 template<typename node_t> 113 friend node_t * mutate(const node_t * node); 115 MUTATE_FRIEND 114 116 }; 115 117 … … 135 137 private: 136 138 FunctionDecl * clone() const override { return new FunctionDecl( *this ); } 137 138 /// Must be copied in ALL derived classes 139 template<typename node_t> 140 friend node_t * mutate(const node_t * node); 139 MUTATE_FRIEND 141 140 }; 142 141 … … 157 156 private: 158 157 NamedTypeDecl* clone() const override = 0; 158 MUTATE_FRIEND 159 159 }; 160 160 … … 198 198 private: 199 199 TypeDecl * clone() const override { return new TypeDecl{ *this }; } 200 201 /// Must be copied in ALL derived classes 202 template<typename node_t> 203 friend node_t * mutate(const node_t * node); 200 MUTATE_FRIEND 204 201 }; 205 202 … … 216 213 private: 217 214 TypedefDecl * clone() const override { return new TypedefDecl{ *this }; } 218 219 /// Must be copied in ALL derived classes 220 template<typename node_t> 221 friend node_t * mutate(const node_t * node); 215 MUTATE_FRIEND 222 216 }; 223 217 … … 238 232 AggregateDecl* set_body( bool b ) { body = b; return this; } 239 233 234 private: 235 AggregateDecl * clone() const override = 0; 236 MUTATE_FRIEND 237 240 238 protected: 241 239 /// Produces a name for the kind of aggregate … … 260 258 private: 261 259 StructDecl * clone() const override { return new StructDecl{ *this }; } 262 263 /// Must be copied in ALL derived classes 264 template<typename node_t> 265 friend node_t * mutate(const node_t * node); 260 MUTATE_FRIEND 266 261 267 262 std::string typeString() const override { return "struct"; } … … 278 273 private: 279 274 UnionDecl * clone() const override { return new UnionDecl{ *this }; } 280 281 /// Must be copied in ALL derived classes 282 template<typename node_t> 283 friend node_t * mutate(const node_t * node); 275 MUTATE_FRIEND 284 276 285 277 std::string typeString() const override { return "union"; } … … 299 291 private: 300 292 EnumDecl * clone() const override { return new EnumDecl{ *this }; } 301 302 /// Must be copied in ALL derived classes 303 template<typename node_t> 304 friend node_t * mutate(const node_t * node); 293 MUTATE_FRIEND 305 294 306 295 std::string typeString() const override { return "enum"; } … … 320 309 private: 321 310 TraitDecl * clone() const override { return new TraitDecl{ *this }; } 322 323 /// Must be copied in ALL derived classes 324 template<typename node_t> 325 friend node_t * mutate(const node_t * node); 311 MUTATE_FRIEND 326 312 327 313 std::string typeString() const override { return "trait"; } … … 338 324 private: 339 325 AsmDecl *clone() const override { return new AsmDecl( *this ); } 340 341 /// Must be copied in ALL derived classes 342 template<typename node_t> 343 friend node_t * mutate(const node_t * node); 326 MUTATE_FRIEND 344 327 }; 345 328 … … 355 338 private: 356 339 StaticAssertDecl * clone() const override { return new StaticAssertDecl( *this ); } 357 358 /// Must be copied in ALL derived classes 359 template<typename node_t> 360 friend node_t * mutate(const node_t * node); 340 MUTATE_FRIEND 361 341 }; 362 342 363 343 } 344 345 #undef MUTATE_FRIEND 364 346 365 347 // Local Variables: //
Note: See TracChangeset
for help on using the changeset viewer.