source: src/SymTab/FixFunction.cc @ 026bb82

ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsdeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxnew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change on this file since 026bb82 was a7c90d4, checked in by Peter A. Buhr <pabuhr@…>, 8 years ago

change StorageClass? to bitset, support _Thread_local as separate storage-class

  • Property mode set to 100644
File size: 2.5 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// 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 : Mon Mar  6 23:36:59 2017
13// Update Count     : 6
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
22namespace SymTab {
23        FixFunction::FixFunction() : isVoid( false ) {}
24
25        DeclarationWithType * FixFunction::mutate(FunctionDecl *functionDecl) {
26                ObjectDecl *pointer = new ObjectDecl( functionDecl->get_name(), functionDecl->get_storageClasses(), functionDecl->get_linkage(), 0, new PointerType( Type::Qualifiers(), functionDecl->get_type()->clone() ), 0, functionDecl->get_attributes() );
27                functionDecl->get_attributes().clear();
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                // need to recursively mutate the base type in order for multi-dimensional arrays to work.
47                PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), arrayType->get_base()->clone()->acceptMutator( *this ), maybeClone( arrayType->get_dimension() ), arrayType->get_isVarLen(), arrayType->get_isStatic() );
48                delete arrayType;
49                return pointerType;
50        }
51
52        Type * FixFunction::mutate(StructInstType *aggregateUseType) {
53                return aggregateUseType;
54        }
55
56        Type * FixFunction::mutate(UnionInstType *aggregateUseType) {
57                return aggregateUseType;
58        }
59
60        Type * FixFunction::mutate(EnumInstType *aggregateUseType) {
61                return aggregateUseType;
62        }
63
64        Type * FixFunction::mutate(TraitInstType *aggregateUseType) {
65                return aggregateUseType;
66        }
67
68        Type * FixFunction::mutate(TypeInstType *aggregateUseType) {
69                return aggregateUseType;
70        }
71
72        Type * FixFunction::mutate(TupleType *tupleType) {
73                return tupleType;
74        }
75
76        Type * FixFunction::mutate(VarArgsType *varArgsType) {
77                return varArgsType;
78        }
79
80        Type * FixFunction::mutate(ZeroType *zeroType) {
81                return zeroType;
82        }
83
84        Type * FixFunction::mutate(OneType *oneType) {
85                return oneType;
86        }
87} // namespace SymTab
88
89// Local Variables: //
90// tab-width: 4 //
91// mode: c++ //
92// compile-command: "make install" //
93// End: //
Note: See TracBrowser for help on using the repository browser.