source: src/SynTree/BasicType.cc @ f9cebb5

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 f9cebb5 was d58ebf3, checked in by Rob Schluntz <rschlunt@…>, 9 years ago

some print reformatting

  • Property mode set to 100644
File size: 1.8 KB
Line 
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// BasicType.cc --
8//
9// Author           : Richard C. Bilson
10// Created On       : Mon May 18 07:44:20 2015
11// Last Modified By : Rob Schluntz
12// Last Modified On : Wed Aug 12 14:15:45 2015
13// Update Count     : 6
14//
15
16#include <cassert>
17#include "Type.h"
18
19BasicType::BasicType( const Type::Qualifiers &tq, Kind bt ) : Type( tq ), kind( bt ) {}
20
21void BasicType::print( std::ostream &os, int indent ) const {
22        static const char *kindNames[] = {     
23                "_Bool", "char", "signed char", "unsigned char", "short signed int", "short unsigned int",
24                "signed int", "unsigned int", "long signed int", "long unsigned int", "long long signed int",
25                "long long unsigned int", "float", "double", "long double", "float _Complex", "double _Complex",
26                "long double _Complex", "float _Imaginary", "double _Imaginary", "long double _Imaginary"
27        };
28
29        Type::print( os, indent );
30        os << kindNames[ kind ];
31}
32
33bool BasicType::isInteger() const {
34        switch ( kind ) {
35          case Bool:
36          case Char:
37          case SignedChar:
38          case UnsignedChar:
39          case ShortSignedInt:
40          case ShortUnsignedInt:
41          case SignedInt:
42          case UnsignedInt:
43          case LongSignedInt:
44          case LongUnsignedInt:
45          case LongLongSignedInt:
46          case LongLongUnsignedInt:
47                return true;
48          case Float:
49          case Double:
50          case LongDouble:
51          case FloatComplex:
52          case DoubleComplex:
53          case LongDoubleComplex:
54          case FloatImaginary:
55          case DoubleImaginary:
56          case LongDoubleImaginary:
57                return false;
58          case NUMBER_OF_BASIC_TYPES:
59                assert( false );
60        } // switch
61        assert( false );
62        return false;
63}
64
65
66// Local Variables: //
67// tab-width: 4 //
68// mode: c++ //
69// compile-command: "make install" //
70// End: //
Note: See TracBrowser for help on using the repository browser.