source: src/SynTree/BasicType.cc @ 67fa9f9

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 67fa9f9 was c0aa336, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

third attempt at gcc attributes

  • Property mode set to 100644
File size: 1.9 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 : Peter A. Buhr
12// Last Modified On : Wed Feb  1 17:12:15 2017
13// Update Count     : 8
14//
15
16#include <cassert>
17#include "Type.h"
18
19BasicType::BasicType( const Type::Qualifiers &tq, Kind bt, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), 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.