[flang-commits] [flang] [Flang][NFCI] Use abstraction for binary scalar data (PR #212956)
Krzysztof Parzyszek via flang-commits
flang-commits at lists.llvm.org
Tue Sep 1 07:56:32 PDT 2026
================
@@ -0,0 +1,88 @@
+//===-- include/flang/Evaluate/char.h ---------------------------*- C++ -*-===//
+//
+// 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
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef FORTRAN_EVALUATE_CHAR_H_
+#define FORTRAN_EVALUATE_CHAR_H_
+
+#include "flang/Evaluate/type.h"
+#include <string>
+
+namespace Fortran::evaluate::value {
+
+/// Simple wrapper around a std::string/std:u16string/std::u32string
+template <int KIND> class Character {
+ using Word = Scalar<Type<TypeCategory::Character, KIND>>;
+ using CharT = typename Word::value_type;
+
+public:
+ // rule-of-five
+ ~Character() = default;
+ Character(const Character &v) : word_(v) {}
+ Character(Character &&v) : word_(std::move(v)) {}
+ Character &operator=(const Character &v) {
+ word_ = v.word_;
+ return &this;
+ }
+ Character &operator=(Character &&v) {
+ word_ = std::move(v.word_);
+ return *this;
+ }
----------------
kparzysz wrote:
All of these could just be `= default`.
https://github.com/llvm/llvm-project/pull/212956
More information about the flang-commits
mailing list