Changeset 0dd3a2f for translator/SymTab/FixFunction.cc
- Timestamp:
- May 18, 2015, 11:20:23 AM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 51587aa
- Parents:
- a32b204
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/SymTab/FixFunction.cc
ra32b204 r0dd3a2f 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 : Sun May 17 16:22:54 2015 13 // Update Count : 2 14 // 15 1 16 #include "FixFunction.h" 2 17 #include "SynTree/Declaration.h" … … 6 21 7 22 namespace SymTab { 23 FixFunction::FixFunction() : isVoid( false ) { 24 } 8 25 9 FixFunction::FixFunction() 10 : isVoid( false ) 11 { 12 } 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 } 13 31 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 } 32 Type * FixFunction::mutate(VoidType *voidType) { 33 isVoid = true; 34 return voidType; 35 } 21 36 22 Type* 23 FixFunction::mutate(VoidType *voidType) 24 { 25 isVoid = true; 26 return voidType; 27 } 37 Type * FixFunction::mutate(BasicType *basicType) { 38 return basicType; 39 } 28 40 29 Type* 30 FixFunction::mutate(BasicType *basicType) 31 { 32 return basicType; 33 } 41 Type * FixFunction::mutate(PointerType *pointerType) { 42 return pointerType; 43 } 34 44 35 Type* 36 FixFunction::mutate(PointerType *pointerType) 37 { 38 39 }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 } 40 50 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 } 51 Type * FixFunction::mutate(StructInstType *aggregateUseType) { 52 return aggregateUseType; 53 } 48 54 49 Type* 50 FixFunction::mutate(StructInstType *aggregateUseType) 51 { 52 return aggregateUseType; 53 } 55 Type * FixFunction::mutate(UnionInstType *aggregateUseType) { 56 return aggregateUseType; 57 } 54 58 55 Type* 56 FixFunction::mutate(UnionInstType *aggregateUseType) 57 { 58 return aggregateUseType; 59 } 59 Type * FixFunction::mutate(EnumInstType *aggregateUseType) { 60 return aggregateUseType; 61 } 60 62 61 Type* 62 FixFunction::mutate(EnumInstType *aggregateUseType) 63 { 64 return aggregateUseType; 65 } 63 Type * FixFunction::mutate(ContextInstType *aggregateUseType) { 64 return aggregateUseType; 65 } 66 66 67 Type* 68 FixFunction::mutate(ContextInstType *aggregateUseType) 69 { 70 return aggregateUseType; 71 } 67 Type * FixFunction::mutate(TypeInstType *aggregateUseType) { 68 return aggregateUseType; 69 } 72 70 73 Type* 74 FixFunction::mutate(TypeInstType *aggregateUseType) 75 { 76 return aggregateUseType; 77 } 71 Type * FixFunction::mutate(TupleType *tupleType) { 72 return tupleType; 73 } 74 } // namespace SymTab 78 75 79 Type* 80 FixFunction::mutate(TupleType *tupleType) 81 { 82 return tupleType; 83 } 84 85 86 } // namespace SymTab 76 // Local Variables: // 77 // tab-width: 4 // 78 // mode: c++ // 79 // compile-command: "make install" // 80 // End: //
Note: See TracChangeset
for help on using the changeset viewer.