summaryrefslogtreecommitdiff
path: root/flang-rt/lib/runtime/temporary-stack.cpp
diff options
context:
space:
mode:
authorMingming Liu <mingmingl@google.com>2025-09-10 15:25:31 -0700
committerGitHub <noreply@github.com>2025-09-10 15:25:31 -0700
commit1417dafa1db9cb1b2b09438aa9f53ea5ab6e36e2 (patch)
tree57f4b1f313c8cf74eed8819870f39c36ea263c68 /flang-rt/lib/runtime/temporary-stack.cpp
parent898b813bc8a6d0276bf0f4769f5f2f64b34e632d (diff)
parentb8cefcb601ddaa18482555c4ff363c01a270c2fe (diff)
Merge branch 'main' into users/mingmingl-llvm/samplefdo-profile-formatusers/mingmingl-llvm/samplefdo-profile-format
Diffstat (limited to 'flang-rt/lib/runtime/temporary-stack.cpp')
-rw-r--r--flang-rt/lib/runtime/temporary-stack.cpp10
1 files changed, 8 insertions, 2 deletions
diff --git a/flang-rt/lib/runtime/temporary-stack.cpp b/flang-rt/lib/runtime/temporary-stack.cpp
index 3f6fd8ee15a8..4bc161f83b29 100644
--- a/flang-rt/lib/runtime/temporary-stack.cpp
+++ b/flang-rt/lib/runtime/temporary-stack.cpp
@@ -16,8 +16,11 @@
#include "flang/Common/ISO_Fortran_binding_wrapper.h"
#include "flang/Runtime/assign.h"
+RT_OFFLOAD_API_GROUP_BEGIN
+
namespace {
+using namespace Fortran;
using namespace Fortran::runtime;
// the number of elements to allocate when first creating the vector
@@ -97,7 +100,7 @@ void DescriptorStorage<COPY_VALUES>::resize(size_type newCapacity) {
// Avoid passing a null pointer, since it would result in an undefined
// behavior.
if (data_ != nullptr) {
- memcpy(newData, data_, capacity_ * sizeof(Descriptor *));
+ runtime::memcpy(newData, data_, capacity_ * sizeof(Descriptor *));
FreeMemory(data_);
}
data_ = newData;
@@ -181,8 +184,11 @@ inline static DescriptorStack *getDescriptorStorage(void *opaquePtr) {
return static_cast<DescriptorStack *>(opaquePtr);
}
+RT_OFFLOAD_API_GROUP_END
+
namespace Fortran::runtime {
extern "C" {
+RT_EXT_API_GROUP_BEGIN
void *RTNAME(CreateValueStack)(const char *sourceFile, int line) {
return ValueStack::allocate(sourceFile, line);
}
@@ -222,6 +228,6 @@ void RTNAME(DescriptorAt)(void *opaquePtr, uint64_t i, Descriptor &value) {
void RTNAME(DestroyDescriptorStack)(void *opaquePtr) {
DescriptorStack::destroy(getDescriptorStorage(opaquePtr));
}
-
+RT_EXT_API_GROUP_END
} // extern "C"
} // namespace Fortran::runtime