1 //===-- include/flang/Runtime/derived-api.h ---------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 // API for lowering to use for operations on derived type objects. 10 // Initialiaztion and finalization are implied for pointer and allocatable 11 // ALLOCATE()/DEALLOCATE() respectively, so these APIs should be used only for 12 // local variables. Whole allocatable assignment should use AllocatableAssign() 13 // instead of this Assign(). 14 15 #ifndef FORTRAN_RUNTIME_DERIVED_API_H_ 16 #define FORTRAN_RUNTIME_DERIVED_API_H_ 17 18 #include "flang/Runtime/entry-names.h" 19 20 namespace Fortran::runtime { 21 class Descriptor; 22 23 extern "C" { 24 25 // Initializes and allocates an object's components, if it has a derived type 26 // with any default component initialization or automatic components. 27 // The descriptor must be initialized and non-null. 28 void RTNAME(Initialize)( 29 const Descriptor &, const char *sourceFile = nullptr, int sourceLine = 0); 30 31 // Finalizes an object and its components. Deallocates any 32 // allocatable/automatic components. Does not deallocate the descriptor's 33 // storage. 34 void RTNAME(Destroy)(const Descriptor &); 35 36 // Intrinsic or defined assignment, with scalar expansion but not type 37 // conversion. 38 void RTNAME(Assign)(const Descriptor &, const Descriptor &, 39 const char *sourceFile = nullptr, int sourceLine = 0); 40 41 } // extern "C" 42 } // namespace Fortran::runtime 43 #endif // FORTRAN_RUNTIME_DERIVED_API_H_ 44