Changeset 923d25a for src/AST/Type.hpp
- Timestamp:
- Jul 23, 2020, 2:42:23 PM (4 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- d1ee9ec
- Parents:
- a8ed717
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/AST/Type.hpp
ra8ed717 r923d25a 9 9 // Author : Aaron B. Moss 10 10 // Created On : Thu May 9 10:00:00 2019 11 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed Dec 11 21:56:46 201913 // Update Count : 511 // Last Modified By : Andrew Beach 12 // Last Modified On : Thu Jul 23 14:15:00 2020 13 // Update Count : 6 14 14 // 15 15 … … 354 354 }; 355 355 356 /// instance of struct type 357 class StructInstType final : public ReferenceToType { 358 public: 359 readonly<StructDecl> base; 360 361 StructInstType( 356 // Common implementation for the SUE instance types. Not to be used directly. 357 template<typename decl_t> 358 class SueInstType final : public ReferenceToType { 359 public: 360 using base_type = decl_t; 361 readonly<decl_t> base; 362 363 SueInstType( 362 364 const std::string& n, CV::Qualifiers q = {}, std::vector<ptr<Attribute>> && as = {} ) 363 365 : ReferenceToType( n, q, std::move(as) ), base() {} 364 366 365 S tructInstType(366 const StructDecl* b, CV::Qualifiers q = {}, std::vector<ptr<Attribute>> && as = {} );367 SueInstType( 368 const decl_t * b, CV::Qualifiers q = {}, std::vector<ptr<Attribute>> && as = {} ); 367 369 368 370 bool isComplete() const override; 369 371 370 const StructDecl * aggr() const override { return base; } 371 372 const Type * accept( Visitor & v ) const override { return v.visit( this ); } 373 private: 374 StructInstType * clone() const override { return new StructInstType{ *this }; } 375 MUTATE_FRIEND 376 }; 377 378 /// instance of union type 379 class UnionInstType final : public ReferenceToType { 380 public: 381 readonly<UnionDecl> base; 382 383 UnionInstType( 384 const std::string& n, CV::Qualifiers q = {}, std::vector<ptr<Attribute>> && as = {} ) 385 : ReferenceToType( n, q, std::move(as) ), base() {} 386 387 UnionInstType( 388 const UnionDecl * b, CV::Qualifiers q = {}, std::vector<ptr<Attribute>> && as = {} ); 389 390 bool isComplete() const override; 391 392 const UnionDecl * aggr() const override { return base; } 393 394 const Type * accept( Visitor & v ) const override { return v.visit( this ); } 395 private: 396 UnionInstType * clone() const override { return new UnionInstType{ *this }; } 397 MUTATE_FRIEND 398 }; 399 400 /// instance of enum type 401 class EnumInstType final : public ReferenceToType { 402 public: 403 readonly<EnumDecl> base; 404 405 EnumInstType( 406 const std::string& n, CV::Qualifiers q = {}, std::vector<ptr<Attribute>> && as = {} ) 407 : ReferenceToType( n, q, std::move(as) ), base() {} 408 409 EnumInstType( 410 const EnumDecl * b, CV::Qualifiers q = {}, std::vector<ptr<Attribute>> && as = {} ); 411 412 bool isComplete() const override; 413 414 const EnumDecl * aggr() const override { return base; } 415 416 const Type * accept( Visitor & v ) const override { return v.visit( this ); } 417 private: 418 EnumInstType * clone() const override { return new EnumInstType{ *this }; } 419 MUTATE_FRIEND 420 }; 421 422 /// instance of trait type 372 const decl_t * aggr() const override { return base; } 373 374 const Type * accept( Visitor & v ) const override { return v.visit( this ); } 375 private: 376 SueInstType<decl_t> * clone() const override { return new SueInstType<decl_t>{ *this }; } 377 MUTATE_FRIEND 378 }; 379 380 /// An instance of a struct type. 381 using StructInstType = SueInstType<StructDecl>; 382 383 /// An instance of a union type. 384 using UnionInstType = SueInstType<UnionDecl>; 385 386 /// An instance of an enum type. 387 using EnumInstType = SueInstType<EnumDecl>; 388 389 /// An instance of a trait type. 423 390 class TraitInstType final : public ReferenceToType { 424 391 public:
Note: See TracChangeset
for help on using the changeset viewer.