source: src/SynTree/ArrayType.cc @ cfaa2873

ADTarm-ehast-experimentalenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprpthread-emulationqualifiedEnum
Last change on this file since cfaa2873 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
RevLine 
[0dd3a2f]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//
[bb8ea30]7// ArrayType.cc --
[0dd3a2f]8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
[c0aa336]11// Last Modified By : Peter A. Buhr
[615a096]12// Last Modified On : Fri Mar 17 09:40:30 2017
13// Update Count     : 13
[0dd3a2f]14//
[51b7345]15
[ea6332d]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;
[51b7345]24
25
[c0aa336]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 ) {
[51b7345]28}
29
30ArrayType::ArrayType( const ArrayType &other )
[cf0941d]31                : Type( other ), base( maybeClone( other.base ) ), dimension( maybeClone( other.dimension ) ),
32                  isVarLen( other.isVarLen ), isStatic( other.isStatic ) {
[51b7345]33}
34
[0dd3a2f]35ArrayType::~ArrayType() {
36        delete base;
37        delete dimension;
[51b7345]38}
39
[50377a4]40void ArrayType::print( std::ostream &os, Indenter indent ) const {
[0dd3a2f]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
[cf0941d]55        if ( dimension ) {
[d58ebf3]56                os << " with dimension of ";
[bb8ea30]57                dimension->print( os, indent );
[cf0941d]58        } // if
[51b7345]59}
60
[0dd3a2f]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.