ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change
on this file since 42e2ad7 was
51b7345,
checked in by Peter A. Buhr <pabuhr@…>, 10 years ago
|
initial commit
|
-
Property mode set to
100644
|
File size:
1.6 KB
|
Line | |
---|
1 | #include "FixFunction.h" |
---|
2 | #include "SynTree/Declaration.h" |
---|
3 | #include "SynTree/Type.h" |
---|
4 | #include "SynTree/Expression.h" |
---|
5 | #include "utility.h" |
---|
6 | |
---|
7 | namespace SymTab { |
---|
8 | |
---|
9 | FixFunction::FixFunction() |
---|
10 | : isVoid( false ) |
---|
11 | { |
---|
12 | } |
---|
13 | |
---|
14 | DeclarationWithType* |
---|
15 | FixFunction::mutate(FunctionDecl *functionDecl) |
---|
16 | { |
---|
17 | ObjectDecl *pointer = new ObjectDecl( functionDecl->get_name(), functionDecl->get_storageClass(), functionDecl->get_linkage(), 0, new PointerType( Type::Qualifiers(), functionDecl->get_type()->clone() ), 0 ); |
---|
18 | delete functionDecl; |
---|
19 | return pointer; |
---|
20 | } |
---|
21 | |
---|
22 | Type* |
---|
23 | FixFunction::mutate(VoidType *voidType) |
---|
24 | { |
---|
25 | isVoid = true; |
---|
26 | return voidType; |
---|
27 | } |
---|
28 | |
---|
29 | Type* |
---|
30 | FixFunction::mutate(BasicType *basicType) |
---|
31 | { |
---|
32 | return basicType; |
---|
33 | } |
---|
34 | |
---|
35 | Type* |
---|
36 | FixFunction::mutate(PointerType *pointerType) |
---|
37 | { |
---|
38 | return pointerType; |
---|
39 | } |
---|
40 | |
---|
41 | Type* |
---|
42 | FixFunction::mutate(ArrayType *arrayType) |
---|
43 | { |
---|
44 | PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), maybeClone( arrayType->get_base()->clone() ), maybeClone( arrayType->get_dimension() ), arrayType->get_isVarLen(), arrayType->get_isStatic() ); |
---|
45 | delete arrayType; |
---|
46 | return pointerType; |
---|
47 | } |
---|
48 | |
---|
49 | Type* |
---|
50 | FixFunction::mutate(StructInstType *aggregateUseType) |
---|
51 | { |
---|
52 | return aggregateUseType; |
---|
53 | } |
---|
54 | |
---|
55 | Type* |
---|
56 | FixFunction::mutate(UnionInstType *aggregateUseType) |
---|
57 | { |
---|
58 | return aggregateUseType; |
---|
59 | } |
---|
60 | |
---|
61 | Type* |
---|
62 | FixFunction::mutate(EnumInstType *aggregateUseType) |
---|
63 | { |
---|
64 | return aggregateUseType; |
---|
65 | } |
---|
66 | |
---|
67 | Type* |
---|
68 | FixFunction::mutate(ContextInstType *aggregateUseType) |
---|
69 | { |
---|
70 | return aggregateUseType; |
---|
71 | } |
---|
72 | |
---|
73 | Type* |
---|
74 | FixFunction::mutate(TypeInstType *aggregateUseType) |
---|
75 | { |
---|
76 | return aggregateUseType; |
---|
77 | } |
---|
78 | |
---|
79 | Type* |
---|
80 | FixFunction::mutate(TupleType *tupleType) |
---|
81 | { |
---|
82 | return tupleType; |
---|
83 | } |
---|
84 | |
---|
85 | |
---|
86 | } // namespace SymTab |
---|
Note: See
TracBrowser
for help on using the repository browser.