source: src/SynTree/ReferenceType.cc @ e6cee92

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since e6cee92 was e6cee92, checked in by Rob Schluntz <rschlunt@…>, 4 years ago

Fix TupleAssignment? code for references

  • Property mode set to 100644
File size: 1.2 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 "Common/utility.h"
19
20ReferenceType::ReferenceType( const Type::Qualifiers &tq, Type *base, const std::list< Attribute * > & attributes )
21        : Type( tq, attributes ), base( base ) {
22        assertf( base, "Reference Type with a null base created." );
23}
24
25ReferenceType::ReferenceType( const ReferenceType &other )
26        : Type( other ), base( maybeClone( other.base ) ) {
27}
28
29ReferenceType::~ReferenceType() {
30        delete base;
31}
32
33int ReferenceType::referenceDepth() const {
34        return base->referenceDepth()+1;
35}
36
37void ReferenceType::print( std::ostream &os, int indent ) const {
38        Type::print( os, indent );
39        os << "reference to ";
40        if ( base ) {
41                base->print( os, indent );
42        } // if
43}
44
45// Local Variables: //
46// tab-width: 4 //
47// mode: c++ //
48// compile-command: "make install" //
49// End: //
Note: See TracBrowser for help on using the repository browser.