source: src/SynTree/BasicType.cc@ 1189946

ADT aaron-thesis arm-eh ast-experimental cleanup-dtors deferred_resn demangler enum forall-pointer-decay jacob/cs343-translation jenkins-sandbox new-ast new-ast-unique-expr new-env no_list persistent-indexer pthread-emulation qualifiedEnum resolv-new with_gc
Last change on this file since 1189946 was 201aeb9, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

first attempt at new basic-type int128, and length suffix with explicit size

  • Property mode set to 100644
File size: 1.7 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 : Mon Sep 25 14:14:03 2017
13// Update Count : 11
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 Type::print( os, indent );
28 os << BasicType::typeNames[ kind ];
29}
30
31bool BasicType::isInteger() const {
32 switch ( kind ) {
33 case Bool:
34 case Char:
35 case SignedChar:
36 case UnsignedChar:
37 case ShortSignedInt:
38 case ShortUnsignedInt:
39 case SignedInt:
40 case UnsignedInt:
41 case LongSignedInt:
42 case LongUnsignedInt:
43 case LongLongSignedInt:
44 case LongLongUnsignedInt:
45 case SignedInt128:
46 case UnsignedInt128:
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.