[flang-commits] [flang] [Flang][NFCI] Use abstraction for binary scalar data (PR #212956)
via flang-commits
flang-commits at lists.llvm.org
Thu Jul 30 02:46:44 PDT 2026
github-actions[bot] wrote:
<!--LLVM CODE FORMAT COMMENT: {clang-format}-->
:warning: C/C++ code formatter, clang-format found issues in your code. :warning:
<details>
<summary>
You can test this locally with the following command:
</summary>
``````````bash
git-clang-format --diff origin/main HEAD --extensions cpp,h -- flang/include/flang/Evaluate/character-value.h flang/include/flang/Evaluate/complex.h flang/include/flang/Evaluate/initial-image.h flang/include/flang/Evaluate/integer.h flang/include/flang/Evaluate/logical.h flang/include/flang/Evaluate/real.h flang/lib/Evaluate/character.h flang/lib/Evaluate/host.h flang/lib/Evaluate/initial-image.cpp --diff_from_common_commit
``````````
:warning:
The reproduction instructions above might return results for more than one PR
in a stack if you are using a stacked PR workflow. You can limit the results by
changing `origin/main` to the base branch/commit you want to compare against.
:warning:
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/flang/include/flang/Evaluate/character-value.h b/flang/include/flang/Evaluate/character-value.h
index 848e7fde6..79feef040 100644
--- a/flang/include/flang/Evaluate/character-value.h
+++ b/flang/include/flang/Evaluate/character-value.h
@@ -14,7 +14,6 @@
namespace Fortran::evaluate {
-
/// Simple wrapper around a std::string/std:u16string/std::u32string
template <int KIND> class CharacterValue {
using Character = Scalar<Type<TypeCategory::Character, KIND>>;
@@ -22,11 +21,11 @@ template <int KIND> class CharacterValue {
public:
CLASS_BOILERPLATE(CharacterValue)
- CharacterValue(const Character &v) : word_(v) {}
- CharacterValue( Character &&v) : word_( std::move(v)) {}
+ CharacterValue(const Character &v) : word_(v) {}
+ CharacterValue(Character &&v) : word_(std::move(v)) {}
- /// Returns the number of characters stored; not the number of bytes
- auto size () const { return word_.size(); }
+ /// Returns the number of characters stored; not the number of bytes
+ auto size() const { return word_.size(); }
/// Reads a string of characters from \p raw. \p is the number of bytes to
/// read; must be a multiple of the size of a single character.
@@ -45,8 +44,7 @@ public:
/// is shorter than size, only the first characters are written.
/// If \p changes points to bool, it will be set to true if any bytes at \p
/// dst have changed.
- void StoreRawBytes(void *dst, std::size_t size,
- bool *changed = nullptr) {
+ void StoreRawBytes(void *dst, std::size_t size, bool *changed = nullptr) {
CHECK(size % sizeof(CharT) == 0);
if (size > 0) {
std::size_t payloadSize{std::min(size, sizeof(CharT) * word_.size())};
@@ -65,8 +63,8 @@ public:
}
}
- private:
- Character word_;
+private:
+ Character word_;
};
} // namespace Fortran::evaluate
diff --git a/flang/include/flang/Evaluate/initial-image.h b/flang/include/flang/Evaluate/initial-image.h
index 5597bb0b3..2b4c89239 100644
--- a/flang/include/flang/Evaluate/initial-image.h
+++ b/flang/include/flang/Evaluate/initial-image.h
@@ -101,7 +101,7 @@ public:
} else {
Result result{OkNoChange};
for (auto at{x.lbounds()}; elements-- > 0; x.IncrementSubscripts(at)) {
- CharacterValue<KIND > scalar{x.At(at)};
+ CharacterValue<KIND> scalar{x.At(at)};
auto scalarBytes{scalar.size() * KIND};
if (scalarBytes != elementBytes) {
result = LengthMismatch;
@@ -109,7 +109,7 @@ public:
// TODO endianness
auto *to{&data_.at(offset)};
bool changed{false};
- scalar.StoreRawBytes( to, elementBytes, &changed);
+ scalar.StoreRawBytes(to, elementBytes, &changed);
if (changed && result == OkNoChange) {
result = Ok;
}
``````````
</details>
https://github.com/llvm/llvm-project/pull/212956
More information about the flang-commits
mailing list