/* * This file is part of the Cforall project * * $Id: ArrayType.cc,v 1.6 2005/08/29 20:59:25 rcbilson Exp $ * */ #include "Type.h" #include "Expression.h" #include "utility.h" ArrayType::ArrayType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic ) : Type( tq ), base( base ), dimension( dimension ), isVarLen( isVarLen ), isStatic( isStatic ) { base->set_isLvalue( false ); } ArrayType::ArrayType( const ArrayType &other ) : Type( other ), base( maybeClone( other.base ) ), dimension( maybeClone( other.dimension ) ), isVarLen( other.isVarLen ), isStatic( other.isStatic ) { } ArrayType::~ArrayType() { delete base; delete dimension; } void ArrayType::print( std::ostream &os, int indent ) const { Type::print( os, indent ); if( isStatic ) { os << "static "; } if( isVarLen ) { os << "variable length array of "; } else if( dimension ) { os << "array of "; dimension->print( os, indent ); } else { os << "open array of "; } if( base ) { base->print( os, indent ); } }