[flang-commits] [flang] [Flang] KIND De-Templatization (PR #206907)
Michael Kruse via flang-commits
flang-commits at lists.llvm.org
Thu Aug 13 06:32:39 PDT 2026
================
@@ -0,0 +1,577 @@
+//===-- lib/Evaluate/character-value-impl.cpp -----------------------------===//
+//
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
+//
+//===----------------------------------------------------------------------===//
+
+#include "character-value-impl.h"
+#include "flang/Common/idioms.h"
+#include "flang/Evaluate/common.h"
+#include "llvm/Support/ErrorHandling.h"
+#include <algorithm>
+#include <cstring>
+
+namespace Fortran::evaluate::value {
+
+CharacterValueImpl::CharacterValueImpl(int kind, std::size_t n, char32_t c) {
+ withCharProto(kind, [this, n, c](auto ct) {
+ using CharT = std::decay_t<decltype(ct)>;
+ storage_ = std::basic_string<CharT>(n, static_cast<CharT>(c));
+ });
+}
+
+CharacterValueImpl CharacterValueImpl::Zero(int kind) {
+ return withCharProto(kind, [kind](auto c) {
+ using Char = std::decay_t<decltype(c)>;
+ return CharacterValueImpl{kind, std::basic_string<Char>{}};
+ });
+}
+
+CharacterValueImpl CharacterValueImpl::FromRawBytes(
+ int kind, const void *raw, size_t byteSize) {
+ return withCharProto(kind, [kind, raw, byteSize](auto charProto) {
+ using CharT = decltype(charProto);
+ std::basic_string<CharT> s;
+ if (byteSize > 0) {
+ s.assign(static_cast<const CharT *>(raw), byteSize);
----------------
Meinersbur wrote:
Thanks, I had already fixed it locally :-)
https://github.com/llvm/llvm-project/pull/206907
More information about the flang-commits
mailing list