12#ifndef FORTRAN_RUNTIME_POINTER_H_
13#define FORTRAN_RUNTIME_POINTER_H_
15#include "flang/Runtime/descriptor-consts.h"
16#include "flang/Runtime/entry-names.h"
17#include "flang/Runtime/freestanding-tools.h"
19namespace Fortran::runtime {
25void RTDECL(PointerNullifyIntrinsic)(
26 Descriptor &, TypeCategory,
int kind,
int rank = 0,
int corank = 0);
27void RTDECL(PointerNullifyCharacter)(Descriptor &, SubscriptValue length = 0,
28 int kind = 1,
int rank = 0,
int corank = 0);
29void RTDECL(PointerNullifyDerived)(
30 Descriptor &,
const typeInfo::DerivedType &,
int rank = 0,
int corank = 0);
34void RTDECL(PointerSetBounds)(
35 Descriptor &,
int zeroBasedDim, SubscriptValue lower, SubscriptValue upper);
36void RTDECL(PointerSetCoBounds)(Descriptor &,
int zeroBasedCoDim,
37 SubscriptValue lower, SubscriptValue upper = 0);
42void RTDECL(PointerSetDerivedLength)(Descriptor &,
int which, SubscriptValue);
46void RTDECL(PointerApplyMold)(
47 Descriptor &,
const Descriptor &mold,
int rank = 0);
52void RTDECL(PointerAssociateScalar)(Descriptor &,
void *);
56void RTDECL(PointerAssociate)(Descriptor &,
const Descriptor &target);
57void RTDECL(PointerAssociateLowerBounds)(
58 Descriptor &,
const Descriptor &target,
const Descriptor &lowerBounds);
65void RTDECL(PointerAssociateRemapping)(Descriptor &,
const Descriptor &target,
66 const Descriptor &bounds,
const char *sourceFile =
nullptr,
68void RTDECL(PointerAssociateRemappingMonomorphic)(Descriptor &,
69 const Descriptor &target,
const Descriptor &bounds,
70 const char *sourceFile =
nullptr,
int sourceLine = 0);
79int RTDECL(PointerCheckLengthParameter)(Descriptor &,
80 int which , SubscriptValue other,
81 bool hasStat =
false,
const Descriptor *errMsg =
nullptr,
82 const char *sourceFile =
nullptr,
int sourceLine = 0);
92#ifdef RT_DEVICE_COMPILATION
93int RTDECL(PointerAllocate)(Descriptor &,
bool hasStat =
false,
94 const Descriptor *errMsg =
nullptr,
const char *sourceFile =
nullptr,
95 int sourceLine = 0, MemcpyFct memcpyFct = &MemcpyWrapper);
97int RTDECL(PointerAllocate)(Descriptor &,
bool hasStat =
false,
98 const Descriptor *errMsg =
nullptr,
const char *sourceFile =
nullptr,
99 int sourceLine = 0, MemcpyFct memcpyFct = &Fortran::runtime::memcpy);
101int RTDECL(PointerAllocateSource)(Descriptor &,
const Descriptor &source,
102 bool hasStat =
false,
const Descriptor *errMsg =
nullptr,
103 const char *sourceFile =
nullptr,
int sourceLine = 0);
110int RTDECL(PointerDeallocate)(Descriptor &,
bool hasStat =
false,
111 const Descriptor *errMsg =
nullptr,
const char *sourceFile =
nullptr,
116int RTDECL(PointerDeallocatePolymorphic)(Descriptor &,
117 const typeInfo::DerivedType *,
bool hasStat =
false,
118 const Descriptor *errMsg =
nullptr,
const char *sourceFile =
nullptr,
124bool RTDECL(PointerIsAssociated)(
const Descriptor &);
127bool RTDECL(PointerIsAssociatedWith)(
128 const Descriptor &,
const Descriptor *target);
132RT_API_ATTRS
void *AllocateValidatedPointerPayload(
133 std::size_t,
int allocatorIdx = 0);
134RT_API_ATTRS
bool ValidatePointerPayload(
const ISO::CFI_cdesc_t &);