ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since b617e4b was
d3b7937,
checked in by Peter A. Buhr <pabuhr@…>, 9 years ago
|
building runtime library (first attempt)
|
-
Property mode set to
100644
|
File size:
1.5 KB
|
Rev | Line | |
---|
[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 | // |
---|
| 7 | // ArrayType.cc -- |
---|
| 8 | // |
---|
| 9 | // Author : Richard C. Bilson |
---|
| 10 | // Created On : Mon May 18 07:44:20 2015 |
---|
[d58ebf3] | 11 | // Last Modified By : Rob Schluntz |
---|
| 12 | // Last Modified On : Wed Aug 12 14:19:07 2015 |
---|
| 13 | // Update Count : 11 |
---|
[0dd3a2f] | 14 | // |
---|
[51b7345] | 15 | |
---|
| 16 | #include "Type.h" |
---|
| 17 | #include "Expression.h" |
---|
[d3b7937] | 18 | #include "Common/utility.h" |
---|
[51b7345] | 19 | |
---|
| 20 | |
---|
| 21 | ArrayType::ArrayType( const Type::Qualifiers &tq, Type *base, Expression *dimension, bool isVarLen, bool isStatic ) |
---|
[0dd3a2f] | 22 | : Type( tq ), base( base ), dimension( dimension ), isVarLen( isVarLen ), isStatic( isStatic ) { |
---|
| 23 | base->set_isLvalue( false ); |
---|
[51b7345] | 24 | } |
---|
| 25 | |
---|
| 26 | ArrayType::ArrayType( const ArrayType &other ) |
---|
[cf0941d] | 27 | : Type( other ), base( maybeClone( other.base ) ), dimension( maybeClone( other.dimension ) ), |
---|
| 28 | isVarLen( other.isVarLen ), isStatic( other.isStatic ) { |
---|
[51b7345] | 29 | } |
---|
| 30 | |
---|
[0dd3a2f] | 31 | ArrayType::~ArrayType() { |
---|
| 32 | delete base; |
---|
| 33 | delete dimension; |
---|
[51b7345] | 34 | } |
---|
| 35 | |
---|
[0dd3a2f] | 36 | void ArrayType::print( std::ostream &os, int indent ) const { |
---|
| 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 "; |
---|
| 53 | dimension->print( os, 0 ); |
---|
[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.