#include "FixFunction.h" #include "SynTree/Declaration.h" #include "SynTree/Type.h" #include "SynTree/Expression.h" #include "utility.h" namespace SymTab { FixFunction::FixFunction() : isVoid( false ) { } DeclarationWithType* FixFunction::mutate(FunctionDecl *functionDecl) { ObjectDecl *pointer = new ObjectDecl( functionDecl->get_name(), functionDecl->get_storageClass(), functionDecl->get_linkage(), 0, new PointerType( Type::Qualifiers(), functionDecl->get_type()->clone() ), 0 ); delete functionDecl; return pointer; } Type* FixFunction::mutate(VoidType *voidType) { isVoid = true; return voidType; } Type* FixFunction::mutate(BasicType *basicType) { return basicType; } Type* FixFunction::mutate(PointerType *pointerType) { return pointerType; } Type* FixFunction::mutate(ArrayType *arrayType) { PointerType *pointerType = new PointerType( arrayType->get_qualifiers(), maybeClone( arrayType->get_base()->clone() ), maybeClone( arrayType->get_dimension() ), arrayType->get_isVarLen(), arrayType->get_isStatic() ); delete arrayType; return pointerType; } Type* FixFunction::mutate(StructInstType *aggregateUseType) { return aggregateUseType; } Type* FixFunction::mutate(UnionInstType *aggregateUseType) { return aggregateUseType; } Type* FixFunction::mutate(EnumInstType *aggregateUseType) { return aggregateUseType; } Type* FixFunction::mutate(ContextInstType *aggregateUseType) { return aggregateUseType; } Type* FixFunction::mutate(TypeInstType *aggregateUseType) { return aggregateUseType; } Type* FixFunction::mutate(TupleType *tupleType) { return tupleType; } } // namespace SymTab