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 | // FixFunction.cc --
|
---|
8 | //
|
---|
9 | // Author : Richard C. Bilson
|
---|
10 | // Created On : Sun May 17 16:19:49 2015
|
---|
11 | // Last Modified By : Peter A. Buhr
|
---|
12 | // Last Modified On : Wed Mar 2 17:31:10 2016
|
---|
13 | // Update Count : 3
|
---|
14 | //
|
---|
15 |
|
---|
16 | #include "FixFunction.h"
|
---|
17 | #include "SynTree/Declaration.h"
|
---|
18 | #include "SynTree/Type.h"
|
---|
19 | #include "SynTree/Expression.h"
|
---|
20 | #include "Common/utility.h"
|
---|
21 |
|
---|
22 | namespace SymTab {
|
---|
23 | FixFunction::FixFunction() : isVoid( false ) {
|
---|
24 | }
|
---|
25 |
|
---|
26 | DeclarationWithType * FixFunction::mutate(FunctionDecl *functionDecl) {
|
---|
27 | ObjectDecl *pointer = new ObjectDecl( functionDecl->get_name(), functionDecl->get_storageClass(), functionDecl->get_linkage(), 0, new PointerType( Type::Qualifiers(), functionDecl->get_type()->clone() ), 0 );
|
---|
28 | delete functionDecl;
|
---|
29 | return pointer;
|
---|
30 | }
|
---|
31 |
|
---|
32 | Type * FixFunction::mutate(VoidType *voidType) {
|
---|
33 | isVoid = true;
|
---|
34 | return voidType;
|
---|
35 | }
|
---|
36 |
|
---|
37 | Type * FixFunction::mutate(BasicType *basicType) {
|
---|
38 | return basicType;
|
---|
39 | }
|
---|
40 |
|
---|
41 | Type * FixFunction::mutate(PointerType *pointerType) {
|
---|
42 | return pointerType;
|
---|
43 | }
|
---|
44 |
|
---|
45 | Type * FixFunction::mutate(ArrayType *arrayType) {
|
---|
46 | PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), maybeClone( arrayType->get_base()->clone() ), maybeClone( arrayType->get_dimension() ), arrayType->get_isVarLen(), arrayType->get_isStatic() );
|
---|
47 | delete arrayType;
|
---|
48 | return pointerType;
|
---|
49 | }
|
---|
50 |
|
---|
51 | Type * FixFunction::mutate(StructInstType *aggregateUseType) {
|
---|
52 | return aggregateUseType;
|
---|
53 | }
|
---|
54 |
|
---|
55 | Type * FixFunction::mutate(UnionInstType *aggregateUseType) {
|
---|
56 | return aggregateUseType;
|
---|
57 | }
|
---|
58 |
|
---|
59 | Type * FixFunction::mutate(EnumInstType *aggregateUseType) {
|
---|
60 | return aggregateUseType;
|
---|
61 | }
|
---|
62 |
|
---|
63 | Type * FixFunction::mutate(TraitInstType *aggregateUseType) {
|
---|
64 | return aggregateUseType;
|
---|
65 | }
|
---|
66 |
|
---|
67 | Type * FixFunction::mutate(TypeInstType *aggregateUseType) {
|
---|
68 | return aggregateUseType;
|
---|
69 | }
|
---|
70 |
|
---|
71 | Type * FixFunction::mutate(TupleType *tupleType) {
|
---|
72 | return tupleType;
|
---|
73 | }
|
---|
74 |
|
---|
75 | Type * FixFunction::mutate(VarArgsType *varArgsType) {
|
---|
76 | return varArgsType;
|
---|
77 | }
|
---|
78 | } // namespace SymTab
|
---|
79 |
|
---|
80 | // Local Variables: //
|
---|
81 | // tab-width: 4 //
|
---|
82 | // mode: c++ //
|
---|
83 | // compile-command: "make install" //
|
---|
84 | // End: //
|
---|