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 643a2e1 was 17cd4eb, checked in by Peter A. Buhr <pabuhr@…>, 11 years ago |
fixed restrict, fixed parameter copy, introduced name table for types, changed variable after to string
|
-
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 |
|
---|
7 | const 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 |
|
---|
31 | Type::Type( const Qualifiers &tq ) : tq( tq ) {}
|
---|
32 |
|
---|
33 | Type::Type( const Type &other ) : tq( other.tq ) {
|
---|
34 | cloneAll( other.forall, forall );
|
---|
35 | }
|
---|
36 |
|
---|
37 | Type::~Type() {
|
---|
38 | deleteAll( forall );
|
---|
39 | }
|
---|
40 |
|
---|
41 | void 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 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.