source: src/SynTree/ReferenceType.cc @ 35f730f

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumwith_gc
Last change on this file since 35f730f was 9bfc9da, checked in by Rob Schluntz <rschlunt@…>, 7 years ago

Refactor makeSub into genericSubstitution

  • Property mode set to 100644
File size: 1.3 KB
Line 
1//
2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
3//
4// The contents of this file are covered under the licence agreement in the
5// file "LICENCE" distributed with Cforall.
6//
7// PointerType.cc --
8//
9// Author           : Rob Schluntz
10// Created On       : Fri May 12 18:12:15 2017
11// Last Modified By : Rob Schluntz
12// Last Modified On : Fri May 12 18:12:15 2017
13// Update Count     : 1
14//
15
16#include "Type.h"
17#include "Expression.h"
18#include "TypeSubstitution.h"
19#include "Common/utility.h"
20
21ReferenceType::ReferenceType( const Type::Qualifiers &tq, Type *base, const std::list< Attribute * > & attributes )
22        : Type( tq, attributes ), base( base ) {
23        assertf( base, "Reference Type with a null base created." );
24}
25
26ReferenceType::ReferenceType( const ReferenceType &other )
27        : Type( other ), base( maybeClone( other.base ) ) {
28}
29
30ReferenceType::~ReferenceType() {
31        delete base;
32}
33
34int ReferenceType::referenceDepth() const {
35        return base->referenceDepth()+1;
36}
37
38TypeSubstitution ReferenceType::genericSubstitution() const { return base->genericSubstitution(); }
39
40void ReferenceType::print( std::ostream &os, Indenter indent ) const {
41        Type::print( os, indent );
42        os << "reference to ";
43        if ( base ) {
44                base->print( os, indent );
45        } // if
46}
47
48// Local Variables: //
49// tab-width: 4 //
50// mode: c++ //
51// compile-command: "make install" //
52// End: //
Note: See TracBrowser for help on using the repository browser.