source: translator/SynTree/BasicType.cc @ 134b86a

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 134b86a was 51b7345, checked in by Peter A. Buhr <pabuhr@…>, 10 years ago

initial commit

  • Property mode set to 100644
File size: 1.4 KB
Line 
1/*
2 * This file is part of the Cforall project
3 *
4 * $Id: BasicType.cc,v 1.10 2005/08/29 20:59:25 rcbilson Exp $
5 *
6 */
7
8#include <cassert>
9
10#include "Type.h"
11
12
13BasicType::BasicType( const Type::Qualifiers &tq, Kind bt )
14    : Type( tq ), kind( bt )
15{
16}
17
18void
19BasicType::print( std::ostream &os, int indent ) const
20{
21    static const char *kindNames[] = { 
22        "bool", "char", "signed char", "unsigned char", "short signed int", "short unsigned int",
23        "signed int", "unsigned int", "long signed int", "long unsigned int", "long long signed int",
24        "long long unsigned int", "float", "double", "long double", "float complex", "double complex",
25        "long double complex", "float imaginary", "double imaginary", "long double imaginary"
26    };
27
28    Type::print( os, indent );
29    os << kindNames[ kind ] << ' ';
30}
31
32bool 
33BasicType::isInteger() const
34{
35    switch( kind ) {
36    case Bool:
37    case Char:
38    case SignedChar:
39    case UnsignedChar:
40    case ShortSignedInt:
41    case ShortUnsignedInt:
42    case SignedInt:
43    case UnsignedInt:
44    case LongSignedInt:
45    case LongUnsignedInt:
46    case LongLongSignedInt:
47    case LongLongUnsignedInt:
48        return true;
49
50    case Float:
51    case Double:
52    case LongDouble:
53    case FloatComplex:
54    case DoubleComplex:
55    case LongDoubleComplex:
56    case FloatImaginary:
57    case DoubleImaginary:
58    case LongDoubleImaginary:
59        return false;
60
61    case NUMBER_OF_BASIC_TYPES:
62        assert( false );
63    }
64    assert( false );
65    return false;
66}
67
68
Note: See TracBrowser for help on using the repository browser.