source: translator/SymTab/FixFunction.cc @ 0b8cd722

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 0b8cd722 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
7namespace SymTab {
8
9FixFunction::FixFunction()
10  : isVoid( false )
11{
12}
13
14DeclarationWithType* 
15FixFunction::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
22Type* 
23FixFunction::mutate(VoidType *voidType)
24{
25  isVoid = true;
26  return voidType;
27}
28
29Type* 
30FixFunction::mutate(BasicType *basicType)
31{
32  return basicType;
33}
34
35Type* 
36FixFunction::mutate(PointerType *pointerType)
37{
38  return pointerType;
39}
40
41Type* 
42FixFunction::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
49Type* 
50FixFunction::mutate(StructInstType *aggregateUseType)
51{
52  return aggregateUseType;
53}
54
55Type* 
56FixFunction::mutate(UnionInstType *aggregateUseType)
57{
58  return aggregateUseType;
59}
60
61Type* 
62FixFunction::mutate(EnumInstType *aggregateUseType)
63{
64  return aggregateUseType;
65}
66
67Type* 
68FixFunction::mutate(ContextInstType *aggregateUseType)
69{
70  return aggregateUseType;
71}
72
73Type* 
74FixFunction::mutate(TypeInstType *aggregateUseType)
75{
76  return aggregateUseType;
77}
78
79Type* 
80FixFunction::mutate(TupleType *tupleType)
81{
82  return tupleType;
83}
84
85
86} // namespace SymTab
Note: See TracBrowser for help on using the repository browser.