source: translator/SynTree/PointerType.cc @ 51b7345

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change on this file since 51b7345 was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 9 years ago

initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1/*
2 * This file is part of the Cforall project
3 *
4 * $Id: PointerType.cc,v 1.8 2005/08/29 20:59:26 rcbilson Exp $
5 *
6 */
7
8#include "Type.h"
9#include "Expression.h"
10#include "utility.h"
11
12
13PointerType::PointerType( const Type::Qualifiers &tq, Type *base )
14    : Type( tq ), base( base ), dimension( 0 ), isVarLen( false ), isStatic( false )
15{
16    base->set_isLvalue( false );
17}
18
19PointerType::PointerType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic )
20    : Type( tq ), base( base ), dimension( dimension ), isVarLen( isVarLen ), isStatic( isStatic )
21{
22    base->set_isLvalue( false );
23}
24
25PointerType::PointerType( const PointerType &other )
26    : Type( other ), base( maybeClone( other.base ) ), dimension( maybeClone( other.dimension ) ),
27        isVarLen( other.isVarLen ), isStatic( other.isStatic )
28{
29}
30
31PointerType::~PointerType()
32{
33    delete base;
34    delete dimension;
35}
36
37void
38PointerType::print( std::ostream &os, int indent ) const
39{
40    Type::print( os, indent );
41    os << "pointer to ";
42    if( isStatic ) {
43        os << "static ";
44    }
45    if( isVarLen ) {
46        os << "variable length array of ";
47    } else if( dimension ) {
48        os << "array of ";
49        dimension->print( os, indent );
50    }
51    if( base ) {
52        base->print( os, indent );
53    }
54}
55
Note: See TracBrowser for help on using the repository browser.