source: src/SynTree/ArrayType.cc @ cdc4d43

new-envwith_gc
Last change on this file since cdc4d43 was 68f9c43, checked in by Aaron Moss <a3moss@…>, 6 years ago

First pass at delete removal

  • 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 ) {
[615a096]28        base->set_lvalue( false );
[51b7345]29}
30
31ArrayType::ArrayType( const ArrayType &other )
[cf0941d]32                : Type( other ), base( maybeClone( other.base ) ), dimension( maybeClone( other.dimension ) ),
33                  isVarLen( other.isVarLen ), isStatic( other.isStatic ) {
[51b7345]34}
35
[50377a4]36void ArrayType::print( std::ostream &os, Indenter indent ) const {
[0dd3a2f]37        Type::print( os, indent );
38        if ( isStatic ) {
39                os << "static ";
40        } // if
41        if ( isVarLen ) {
42                os << "variable length array of ";
43        } else if ( dimension ) {
44                os << "array of ";
45        } else {
46                os << "open array of ";
47        } // if
48        if ( base ) {
49                base->print( os, indent );
50        } // if
[cf0941d]51        if ( dimension ) {
[d58ebf3]52                os << " with dimension of ";
[bb8ea30]53                dimension->print( os, indent );
[cf0941d]54        } // if
[51b7345]55}
56
[0dd3a2f]57// Local Variables: //
58// tab-width: 4 //
59// mode: c++ //
60// compile-command: "make install" //
61// End: //
Note: See TracBrowser for help on using the repository browser.