ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since 76c7f65e was
f1b1e4c,
checked in by Rob Schluntz <rschlunt@…>, 8 years ago
|
can construct global const objects, except with intrinsic constructors
|
-
Property mode set to
100644
|
File size:
1.9 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 | // |
---|
[f1b1e4c] | 7 | // Type.cc -- |
---|
[0dd3a2f] | 8 | // |
---|
| 9 | // Author : Richard C. Bilson |
---|
| 10 | // Created On : Mon May 18 07:44:20 2015 |
---|
[baf7fee] | 11 | // Last Modified By : Rob Schluntz |
---|
| 12 | // Last Modified On : Wed Dec 09 14:08:48 2015 |
---|
| 13 | // Update Count : 4 |
---|
[0dd3a2f] | 14 | // |
---|
| 15 | |
---|
[51b7345] | 16 | #include "SynTree.h" |
---|
| 17 | #include "Visitor.h" |
---|
| 18 | #include "Type.h" |
---|
| 19 | #include "Declaration.h" |
---|
[d3b7937] | 20 | #include "Common/utility.h" |
---|
[51b7345] | 21 | |
---|
[17cd4eb] | 22 | const char *BasicType::typeNames[BasicType::NUMBER_OF_BASIC_TYPES] = { |
---|
[a08ba92] | 23 | "_Bool", |
---|
| 24 | "char", |
---|
| 25 | "char", |
---|
| 26 | "unsigned char", |
---|
| 27 | "short", |
---|
| 28 | "short unsigned", |
---|
| 29 | "int", |
---|
| 30 | "unsigned int", |
---|
| 31 | "long int", |
---|
| 32 | "long unsigned int", |
---|
| 33 | "long long int", |
---|
| 34 | "long long unsigned int", |
---|
| 35 | "float", |
---|
| 36 | "double", |
---|
| 37 | "long double", |
---|
| 38 | "float _Complex", |
---|
| 39 | "double _Complex", |
---|
| 40 | "long double _Complex", |
---|
| 41 | "float _Imaginary", |
---|
| 42 | "double _Imaginary", |
---|
| 43 | "long double _Imaginary", |
---|
[17cd4eb] | 44 | }; |
---|
[51b7345] | 45 | |
---|
[17cd4eb] | 46 | Type::Type( const Qualifiers &tq ) : tq( tq ) {} |
---|
[51b7345] | 47 | |
---|
[17cd4eb] | 48 | Type::Type( const Type &other ) : tq( other.tq ) { |
---|
[a08ba92] | 49 | cloneAll( other.forall, forall ); |
---|
[51b7345] | 50 | } |
---|
| 51 | |
---|
[17cd4eb] | 52 | Type::~Type() { |
---|
[a08ba92] | 53 | deleteAll( forall ); |
---|
[51b7345] | 54 | } |
---|
| 55 | |
---|
[f1b1e4c] | 56 | void Type::Qualifiers::print( std::ostream &os, int indent ) const { |
---|
| 57 | if ( isConst ) { |
---|
[0dd3a2f] | 58 | os << "const "; |
---|
[a08ba92] | 59 | } // if |
---|
[f1b1e4c] | 60 | if ( isVolatile ) { |
---|
[0dd3a2f] | 61 | os << "volatile "; |
---|
[a08ba92] | 62 | } // if |
---|
[f1b1e4c] | 63 | if ( isRestrict ) { |
---|
[0dd3a2f] | 64 | os << "restrict "; |
---|
[a08ba92] | 65 | } // if |
---|
[f1b1e4c] | 66 | if ( isLvalue ) { |
---|
[0dd3a2f] | 67 | os << "lvalue "; |
---|
[a08ba92] | 68 | } // if |
---|
[f1b1e4c] | 69 | if ( isAtomic ) { |
---|
[0dd3a2f] | 70 | os << "_Atomic "; |
---|
[a08ba92] | 71 | } // if |
---|
[f1b1e4c] | 72 | if ( isAttribute ) { |
---|
[1db21619] | 73 | os << "__attribute(( )) "; |
---|
| 74 | } // if |
---|
[51b7345] | 75 | } |
---|
[0dd3a2f] | 76 | |
---|
[f1b1e4c] | 77 | void Type::print( std::ostream &os, int indent ) const { |
---|
| 78 | if ( ! forall.empty() ) { |
---|
| 79 | os << "forall" << std::endl; |
---|
| 80 | printAll( forall, os, indent + 4 ); |
---|
| 81 | os << std::string( indent+2, ' ' ); |
---|
| 82 | } // if |
---|
| 83 | tq.print( os, indent ); |
---|
| 84 | } |
---|
| 85 | |
---|
[baf7fee] | 86 | std::ostream & operator<<( std::ostream & out, Type * type ) { |
---|
| 87 | type->print( out ); |
---|
| 88 | return out; |
---|
| 89 | } |
---|
| 90 | |
---|
[0dd3a2f] | 91 | // Local Variables: // |
---|
| 92 | // tab-width: 4 // |
---|
| 93 | // mode: c++ // |
---|
| 94 | // compile-command: "make install" // |
---|
| 95 | // End: // |
---|
Note: See
TracBrowser
for help on using the repository browser.