source: src/SynTree/BasicType.cc @ ea6332d

aaron-thesisarm-ehcleanup-dtorsdeferred_resndemanglerjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerresolv-newwith_gc
Last change on this file since ea6332d was ea6332d, checked in by Thierry Delisle <tdelisle@…>, 4 years ago

Big header cleaning pass - commit 3

  • Property mode set to 100644
File size: 2.0 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>  // for assert
17#include <list>     // for list
18#include <ostream>  // for operator<<, ostream
19
20#include "Type.h"   // for BasicType, Type, BasicType::Kind, BasicType::Kind...
21
22class Attribute;
23
24BasicType::BasicType( const Type::Qualifiers &tq, Kind bt, const std::list< Attribute * > & attributes ) : Type( tq, attributes ), kind( bt ) {}
25
26void BasicType::print( std::ostream &os, int indent ) const {
27        static const char *kindNames[] = {     
28                "_Bool", "char", "signed char", "unsigned char", "short signed int", "short unsigned int",
29                "signed int", "unsigned int", "long signed int", "long unsigned int", "long long signed int",
30                "long long unsigned int", "float", "double", "long double", "float _Complex", "double _Complex",
31                "long double _Complex", "float _Imaginary", "double _Imaginary", "long double _Imaginary"
32        };
33
34        Type::print( os, indent );
35        os << kindNames[ kind ];
36}
37
38bool BasicType::isInteger() const {
39        switch ( kind ) {
40          case Bool:
41          case Char:
42          case SignedChar:
43          case UnsignedChar:
44          case ShortSignedInt:
45          case ShortUnsignedInt:
46          case SignedInt:
47          case UnsignedInt:
48          case LongSignedInt:
49          case LongUnsignedInt:
50          case LongLongSignedInt:
51          case LongLongUnsignedInt:
52                return true;
53          case Float:
54          case Double:
55          case LongDouble:
56          case FloatComplex:
57          case DoubleComplex:
58          case LongDoubleComplex:
59          case FloatImaginary:
60          case DoubleImaginary:
61          case LongDoubleImaginary:
62                return false;
63          case NUMBER_OF_BASIC_TYPES:
64                assert( false );
65        } // switch
66        assert( false );
67        return false;
68}
69
70
71// Local Variables: //
72// tab-width: 4 //
73// mode: c++ //
74// compile-command: "make install" //
75// End: //
Note: See TracBrowser for help on using the repository browser.