source: src/SynTree/BasicType.cc @ 8a3d5e7

ADTast-experimental
Last change on this file since 8a3d5e7 was f238fcc2, checked in by JiadaL <j82liang@…>, 3 years ago

Enable numeric type for typed enum

  • Property mode set to 100644
File size: 1.5 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 : Sun Aug  4 21:07:44 2019
13// Update Count     : 13
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, Indenter indent ) const {
27        Type::print( os, indent );
28        os << BasicType::typeNames[ kind ];
29}
30
31bool BasicType::isWholeNumber() const {
32        return kind == Bool || 
33                kind ==Char ||
34                kind == SignedChar ||
35                kind == UnsignedChar ||
36                kind == ShortSignedInt ||
37                kind == ShortUnsignedInt ||
38                kind == SignedInt ||
39                kind == UnsignedInt ||
40                kind == LongSignedInt ||
41                kind == LongUnsignedInt ||
42                kind == LongLongSignedInt ||
43                kind ==LongLongUnsignedInt ||
44                kind == SignedInt128 ||
45                kind == UnsignedInt128;
46}
47
48bool BasicType::isInteger() const {
49        return kind <= UnsignedInt128;
50}
51
52
53// Local Variables: //
54// tab-width: 4 //
55// mode: c++ //
56// compile-command: "make install" //
57// End: //
Note: See TracBrowser for help on using the repository browser.