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 17cd4eb, checked in by Peter A. Buhr <pabuhr@…>, 11 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
|
| Line | |
|---|
| 1 | #include <cassert>
|
|---|
| 2 |
|
|---|
| 3 | #include "Type.h"
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 | BasicType::BasicType( const Type::Qualifiers &tq, Kind bt ) : Type( tq ), kind( bt ) {}
|
|---|
| 7 |
|
|---|
| 8 | void BasicType::print( std::ostream &os, int indent ) const {
|
|---|
| 9 | static const char *kindNames[] = {
|
|---|
| 10 | "_Bool", "char", "signed char", "unsigned char", "short signed int", "short unsigned int",
|
|---|
| 11 | "signed int", "unsigned int", "long signed int", "long unsigned int", "long long signed int",
|
|---|
| 12 | "long long unsigned int", "float", "double", "long double", "float _Complex", "double _Complex",
|
|---|
| 13 | "long double _Complex", "float _Imaginary", "double _Imaginary", "long double _Imaginary"
|
|---|
| 14 | };
|
|---|
| 15 |
|
|---|
| 16 | Type::print( os, indent );
|
|---|
| 17 | os << kindNames[ kind ] << ' ';
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | bool BasicType::isInteger() const {
|
|---|
| 21 | switch( kind ) {
|
|---|
| 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:
|
|---|
| 34 | return true;
|
|---|
| 35 |
|
|---|
| 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:
|
|---|
| 45 | return false;
|
|---|
| 46 |
|
|---|
| 47 | case NUMBER_OF_BASIC_TYPES:
|
|---|
| 48 | assert( false );
|
|---|
| 49 | }
|
|---|
| 50 | assert( false );
|
|---|
| 51 | return false;
|
|---|
| 52 | }
|
|---|
| 53 |
|
|---|
| 54 |
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.