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 ad17ba6a was
17cd4eb,
checked in by Peter A. Buhr <pabuhr@…>, 10 years ago
|
fixed restrict, fixed parameter copy, introduced name table for types, changed variable after to string
|
-
Property mode set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[51b7345] | 1 | #include <cassert> |
---|
| 2 | |
---|
| 3 | #include "Type.h" |
---|
| 4 | |
---|
| 5 | |
---|
[17cd4eb] | 6 | BasicType::BasicType( const Type::Qualifiers &tq, Kind bt ) : Type( tq ), kind( bt ) {} |
---|
[51b7345] | 7 | |
---|
[17cd4eb] | 8 | void BasicType::print( std::ostream &os, int indent ) const { |
---|
[51b7345] | 9 | static const char *kindNames[] = { |
---|
[17cd4eb] | 10 | "_Bool", "char", "signed char", "unsigned char", "short signed int", "short unsigned int", |
---|
[51b7345] | 11 | "signed int", "unsigned int", "long signed int", "long unsigned int", "long long signed int", |
---|
[17cd4eb] | 12 | "long long unsigned int", "float", "double", "long double", "float _Complex", "double _Complex", |
---|
| 13 | "long double _Complex", "float _Imaginary", "double _Imaginary", "long double _Imaginary" |
---|
[51b7345] | 14 | }; |
---|
| 15 | |
---|
| 16 | Type::print( os, indent ); |
---|
| 17 | os << kindNames[ kind ] << ' '; |
---|
| 18 | } |
---|
| 19 | |
---|
[17cd4eb] | 20 | bool BasicType::isInteger() const { |
---|
[51b7345] | 21 | switch( kind ) { |
---|
[17cd4eb] | 22 | case Bool: |
---|
| 23 | case Char: |
---|
| 24 | case SignedChar: |
---|
| 25 | case UnsignedChar: |
---|
| 26 | case ShortSignedInt: |
---|
| 27 | case ShortUnsignedInt: |
---|
| 28 | case SignedInt: |
---|
| 29 | case UnsignedInt: |
---|
| 30 | case LongSignedInt: |
---|
| 31 | case LongUnsignedInt: |
---|
| 32 | case LongLongSignedInt: |
---|
| 33 | case LongLongUnsignedInt: |
---|
[51b7345] | 34 | return true; |
---|
| 35 | |
---|
[17cd4eb] | 36 | case Float: |
---|
| 37 | case Double: |
---|
| 38 | case LongDouble: |
---|
| 39 | case FloatComplex: |
---|
| 40 | case DoubleComplex: |
---|
| 41 | case LongDoubleComplex: |
---|
| 42 | case FloatImaginary: |
---|
| 43 | case DoubleImaginary: |
---|
| 44 | case LongDoubleImaginary: |
---|
[51b7345] | 45 | return false; |
---|
| 46 | |
---|
[17cd4eb] | 47 | case NUMBER_OF_BASIC_TYPES: |
---|
[51b7345] | 48 | assert( false ); |
---|
| 49 | } |
---|
| 50 | assert( false ); |
---|
| 51 | return false; |
---|
| 52 | } |
---|
| 53 | |
---|
| 54 | |
---|
Note: See
TracBrowser
for help on using the repository browser.