Changeset 923d25a for src/AST/Type.cpp


Ignore:
Timestamp:
Jul 23, 2020, 2:42:23 PM (3 years ago)
Author:
Andrew Beach <ajbeach@…>
Branches:
arm-eh, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
d1ee9ec
Parents:
a8ed717
Message:

SueInstType? is a template that replaces {Struct,Union,Enum}InstType?, with using declarations keeping the interface the same.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/AST/Type.cpp

    ra8ed717 r923d25a  
    99// Author           : Aaron B. Moss
    1010// Created On       : Mon May 13 15:00:00 2019
    11 // Last Modified By : Peter A. Buhr
    12 // Last Modified On : Sun Dec 15 16:56:28 2019
    13 // Update Count     : 4
     11// Last Modified By : Andrew Beach
     12// Last Modified On : Thu Jul 23 14:16:00 2020
     13// Update Count     : 5
    1414//
    1515
     
    148148}
    149149
    150 // --- StructInstType
    151 
    152 StructInstType::StructInstType(
    153         const StructDecl * b, CV::Qualifiers q, std::vector<ptr<Attribute>>&& as )
     150// --- SueInstType (StructInstType, UnionInstType, EnumInstType)
     151
     152template<typename decl_t>
     153SueInstType<decl_t>::SueInstType(
     154        const decl_t * b, CV::Qualifiers q, std::vector<ptr<Attribute>>&& as )
    154155: ReferenceToType( b->name, q, move(as) ), base( b ) {}
    155156
    156 bool StructInstType::isComplete() const { return base ? base->body : false; }
    157 
    158 // --- UnionInstType
    159 
    160 UnionInstType::UnionInstType(
    161         const UnionDecl * b, CV::Qualifiers q, std::vector<ptr<Attribute>>&& as )
    162 : ReferenceToType( b->name, q, move(as) ), base( b ) {}
    163 
    164 bool UnionInstType::isComplete() const { return base ? base->body : false; }
    165 
    166 // --- EnumInstType
    167 
    168 EnumInstType::EnumInstType(
    169         const EnumDecl * b, CV::Qualifiers q, std::vector<ptr<Attribute>>&& as )
    170 : ReferenceToType( b->name, q, move(as) ), base( b ) {}
    171 
    172 bool EnumInstType::isComplete() const { return base ? base->body : false; }
     157template<typename decl_t>
     158bool SueInstType<decl_t>::isComplete() const {
     159        return base ? base->body : false;
     160}
     161
     162template class SueInstType<StructDecl>;
     163template class SueInstType<UnionDecl>;
     164template class SueInstType<EnumDecl>;
    173165
    174166// --- TraitInstType
Note: See TracChangeset for help on using the changeset viewer.