// // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo // // The contents of this file are covered under the licence agreement in the // file "LICENCE" distributed with Cforall. // // FixFunction.cc -- // // Author : Richard C. Bilson // Created On : Sun May 17 16:19:49 2015 // Last Modified By : Peter A. Buhr // Last Modified On : Sun May 17 16:22:54 2015 // Update Count : 2 // #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 // Local Variables: // // tab-width: 4 // // mode: c++ // // compile-command: "make install" // // End: //