Changeset 6d51bd7 for src/AST/Decl.hpp
- Timestamp:
- May 15, 2019, 10:15:44 AM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, cleanup-dtors, enum, forall-pointer-decay, jacob/cs343-translation, jenkins-sandbox, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- be567e9
- Parents:
- 712348a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Decl.hpp
r712348a r6d51bd7 57 57 static readonly<Decl> fromId( UniqueId id ); 58 58 59 virtual Decl* accept( Visitor& v )override = 0;60 private: 61 virtual Decl * clone() const override = 0;59 virtual const Decl * accept( Visitor & v ) const override = 0; 60 private: 61 virtual Decl * clone() const override = 0; 62 62 }; 63 63 … … 85 85 86 86 /// Get type of this declaration. May be generated by subclass 87 virtual const Type * get_type() const = 0;87 virtual const Type * get_type() const = 0; 88 88 /// Set type of this declaration. May be verified by subclass 89 89 virtual void set_type(Type*) = 0; 90 90 91 virtual DeclWithType* accept( Visitor& v )override = 0;92 private: 93 virtual DeclWithType * clone() const override = 0;91 virtual const DeclWithType * accept( Visitor & v ) const override = 0; 92 private: 93 virtual DeclWithType * clone() const override = 0; 94 94 }; 95 95 … … 110 110 void set_type( Type* ty ) override { type = ty; } 111 111 112 DeclWithType* accept( Visitor& v ) override { return v.visit( this ); } 113 private: 114 ObjectDecl* clone() const override { return new ObjectDecl{ *this }; } 112 virtual const DeclWithType * accept( Visitor& v ) const override { return v.visit( this ); } 113 private: 114 virtual ObjectDecl * clone() const override { return new ObjectDecl{ *this }; } 115 116 /// Must be copied in ALL derived classes 117 template<typename node_t> 118 friend auto mutate(const node_t * node); 115 119 }; 116 120 … … 166 170 std::string genTypeString() const; 167 171 168 Decl* accept( Visitor& v )override { return v.visit( this ); }169 private: 170 TypeDecl* clone() const override { return new TypeDecl{ *this }; }172 virtual const Decl * accept( Visitor & v ) const override { return v.visit( this ); } 173 private: 174 virtual TypeDecl * clone() const override { return new TypeDecl{ *this }; } 171 175 }; 172 176 … … 180 184 std::string typeString() const override { return "typedef"; } 181 185 182 Decl* accept( Visitor& v )override { return v.visit( this ); }183 private: 184 TypedefDecl* clone() const override { return new TypedefDecl{ *this }; }186 virtual const Decl * accept( Visitor & v ) const override { return v.visit( this ); } 187 private: 188 virtual TypedefDecl * clone() const override { return new TypedefDecl{ *this }; } 185 189 }; 186 190 … … 220 224 bool is_thread() { return kind == DeclarationNode::Thread; } 221 225 222 Decl* accept( Visitor& v )override { return v.visit( this ); }223 private: 224 StructDecl* clone() const override { return new StructDecl{ *this }; }226 virtual const Decl * accept( Visitor & v ) const override { return v.visit( this ); } 227 private: 228 virtual StructDecl * clone() const override { return new StructDecl{ *this }; } 225 229 226 230 std::string typeString() const override { return "struct"; } … … 234 238 : AggregateDecl( loc, name, std::move(attrs), linkage ) {} 235 239 236 Decl* accept( Visitor& v )override { return v.visit( this ); }237 private: 238 UnionDecl* clone() const override { return new UnionDecl{ *this }; }240 virtual const Decl * accept( Visitor& v ) const override { return v.visit( this ); } 241 private: 242 virtual UnionDecl * clone() const override { return new UnionDecl{ *this }; } 239 243 240 244 std::string typeString() const override { return "union"; } … … 251 255 bool valueOf( Decl* enumerator, long long& value ) const; 252 256 253 Decl* accept( Visitor& v )override { return v.visit( this ); }254 private: 255 EnumDecl* clone() const override { return new EnumDecl{ *this }; }257 virtual const Decl * accept( Visitor & v ) const override { return v.visit( this ); } 258 private: 259 virtual EnumDecl * clone() const override { return new EnumDecl{ *this }; } 256 260 257 261 std::string typeString() const override { return "enum"; } … … 268 272 : AggregateDecl( loc, name, std::move(attrs), linkage ) {} 269 273 270 Decl* accept( Visitor& v )override { return v.visit( this ); }271 private: 272 TraitDecl* clone() const override { return new TraitDecl{ *this }; }274 virtual const Decl * accept( Visitor & v ) const override { return v.visit( this ); } 275 private: 276 virtual TraitDecl * clone() const override { return new TraitDecl{ *this }; } 273 277 274 278 std::string typeString() const override { return "trait"; } … … 287 291 inline void increment( const class ObjectDecl * node, Node::ref_type ref ) { node->increment(ref); } 288 292 inline void decrement( const class ObjectDecl * node, Node::ref_type ref ) { node->decrement(ref); } 289 inline void increment( const class FunctionDecl * node, Node::ref_type ref ) { node->increment(ref); }290 inline void decrement( const class FunctionDecl * node, Node::ref_type ref ) { node->decrement(ref); }293 // inline void increment( const class FunctionDecl * node, Node::ref_type ref ) { node->increment(ref); } 294 // inline void decrement( const class FunctionDecl * node, Node::ref_type ref ) { node->decrement(ref); } 291 295 inline void increment( const class AggregateDecl * node, Node::ref_type ref ) { node->increment(ref); } 292 296 inline void decrement( const class AggregateDecl * node, Node::ref_type ref ) { node->decrement(ref); } … … 303 307 inline void increment( const class TypeDecl * node, Node::ref_type ref ) { node->increment(ref); } 304 308 inline void decrement( const class TypeDecl * node, Node::ref_type ref ) { node->decrement(ref); } 305 inline void increment( const class FtypeDecl * node, Node::ref_type ref ) { node->increment(ref); }306 inline void decrement( const class FtypeDecl * node, Node::ref_type ref ) { node->decrement(ref); }307 inline void increment( const class DtypeDecl * node, Node::ref_type ref ) { node->increment(ref); }308 inline void decrement( const class DtypeDecl * node, Node::ref_type ref ) { node->decrement(ref); }309 // inline void increment( const class FtypeDecl * node, Node::ref_type ref ) { node->increment(ref); } 310 // inline void decrement( const class FtypeDecl * node, Node::ref_type ref ) { node->decrement(ref); } 311 // inline void increment( const class DtypeDecl * node, Node::ref_type ref ) { node->increment(ref); } 312 // inline void decrement( const class DtypeDecl * node, Node::ref_type ref ) { node->decrement(ref); } 309 313 inline void increment( const class TypedefDecl * node, Node::ref_type ref ) { node->increment(ref); } 310 314 inline void decrement( const class TypedefDecl * node, Node::ref_type ref ) { node->decrement(ref); } 311 inline void increment( const class AsmDecl * node, Node::ref_type ref ) { node->increment(ref); }312 inline void decrement( const class AsmDecl * node, Node::ref_type ref ) { node->decrement(ref); }313 inline void increment( const class StaticAssertDecl * node, Node::ref_type ref ) { node->increment(ref); }314 inline void decrement( const class StaticAssertDecl * node, Node::ref_type ref ) { node->decrement(ref); }315 // inline void increment( const class AsmDecl * node, Node::ref_type ref ) { node->increment(ref); } 316 // inline void decrement( const class AsmDecl * node, Node::ref_type ref ) { node->decrement(ref); } 317 // inline void increment( const class StaticAssertDecl * node, Node::ref_type ref ) { node->increment(ref); } 318 // inline void decrement( const class StaticAssertDecl * node, Node::ref_type ref ) { node->decrement(ref); } 315 319 316 320 }
Note: See TracChangeset
for help on using the changeset viewer.