source: src/SynTree/ArrayType.cc @ a254fa56

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since a254fa56 was b4f8808, checked in by Andrew Beach <ajbeach@…>, 5 years ago

Removed lvalue from types in the old ast.

  • Property mode set to 100644
File size: 1.7 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// ArrayType.cc --
8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
11// Last Modified By : Peter A. Buhr
12// Last Modified On : Fri Mar 17 09:40:30 2017
13// Update Count     : 13
14//
15
16#include <list>              // for list
17#include <ostream>           // for operator<<, ostream
18
19#include "Common/utility.h"  // for maybeClone
20#include "Expression.h"      // for Expression
21#include "Type.h"            // for ArrayType, Type, Type::Qualifiers
22
23class Attribute;
24
25
26ArrayType::ArrayType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic, const std::list< Attribute * > & attributes )
27        : Type( tq, attributes ), base( base ), dimension( dimension ), isVarLen( isVarLen ), isStatic( isStatic ) {
28}
29
30ArrayType::ArrayType( const ArrayType &other )
31                : Type( other ), base( maybeClone( other.base ) ), dimension( maybeClone( other.dimension ) ),
32                  isVarLen( other.isVarLen ), isStatic( other.isStatic ) {
33}
34
35ArrayType::~ArrayType() {
36        delete base;
37        delete dimension;
38}
39
40void ArrayType::print( std::ostream &os, Indenter indent ) const {
41        Type::print( os, indent );
42        if ( isStatic ) {
43                os << "static ";
44        } // if
45        if ( isVarLen ) {
46                os << "variable length array of ";
47        } else if ( dimension ) {
48                os << "array of ";
49        } else {
50                os << "open array of ";
51        } // if
52        if ( base ) {
53                base->print( os, indent );
54        } // if
55        if ( dimension ) {
56                os << " with dimension of ";
57                dimension->print( os, indent );
58        } // if
59}
60
61// Local Variables: //
62// tab-width: 4 //
63// mode: c++ //
64// compile-command: "make install" //
65// End: //
Note: See TracBrowser for help on using the repository browser.