ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
ctor
deferred_resn
demangler
enum
forall-pointer-decay
gc_noraii
jacob/cs343-translation
jenkins-sandbox
memory
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
string
with_gc
|
Last change
on this file since fe3b61b was 51b73452, checked in by Peter A. Buhr <pabuhr@…>, 11 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 |
|
|---|
| 13 | PointerType::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 |
|
|---|
| 19 | PointerType::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 |
|
|---|
| 25 | PointerType::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 |
|
|---|
| 31 | PointerType::~PointerType()
|
|---|
| 32 | {
|
|---|
| 33 | delete base;
|
|---|
| 34 | delete dimension;
|
|---|
| 35 | }
|
|---|
| 36 |
|
|---|
| 37 | void
|
|---|
| 38 | PointerType::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.