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