source: translator/SynTree/Type.cc@ b87a5ed

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

fixed sizeof type variable, find lowest cost alternative for sizeof expression, removed unused classes, added compiler flag, remove temporary file for -CFA, formatting

  • Property mode set to 100644
File size: 1.2 KB
Line 
1#include "SynTree.h"
2#include "Visitor.h"
3#include "Type.h"
4#include "Declaration.h"
5#include "utility.h"
6
7const char *BasicType::typeNames[BasicType::NUMBER_OF_BASIC_TYPES] = {
8 "_Bool",
9 "char",
10 "char",
11 "unsigned char",
12 "short",
13 "short unsigned",
14 "int",
15 "unsigned int",
16 "long int",
17 "long unsigned int",
18 "long long int",
19 "long long unsigned int",
20 "float",
21 "double",
22 "long double",
23 "float _Complex",
24 "double _Complex",
25 "long double _Complex",
26 "float _Imaginary",
27 "double _Imaginary",
28 "long double _Imaginary",
29};
30
31Type::Type( const Qualifiers &tq ) : tq( tq ) {}
32
33Type::Type( const Type &other ) : tq( other.tq ) {
34 cloneAll( other.forall, forall );
35}
36
37Type::~Type() {
38 deleteAll( forall );
39}
40
41void Type::print( std::ostream &os, int indent ) const {
42 if ( !forall.empty() ) {
43 os << "forall" << std::endl;
44 printAll( forall, os, indent + 4 );
45 os << std::string( indent+2, ' ' );
46 } // if
47 if ( tq.isConst ) {
48 os << "const ";
49 } // if
50 if ( tq.isVolatile ) {
51 os << "volatile ";
52 } // if
53 if ( tq.isRestrict ) {
54 os << "restrict ";
55 } // if
56 if ( tq.isLvalue ) {
57 os << "lvalue ";
58 } // if
59 if ( tq.isAtomic ) {
60 os << "_Atomic ";
61 } // if
62}
Note: See TracBrowser for help on using the repository browser.