[flang-commits] [flang] [llvm] This is a test-PR to find out why the Premerge-CI is failing (PR #127081)
via flang-commits
flang-commits at lists.llvm.org
Thu Feb 13 07:49:18 PST 2025
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 c6654806949f0498fdd2d009b66e62041c21de36 34df5c6a12357e468d2ee498e4223cba4f52199c --extensions cpp,h,c -- flang/include/flang/Runtime/allocatable.h flang/include/flang/Runtime/descriptor-consts.h flang/include/flang/Runtime/pointer.h flang-rt/examples/ExternalHelloWorld/external-hello.cpp flang-rt/include/flang-rt/runtime/allocator-registry.h flang-rt/include/flang-rt/runtime/array-constructor.h flang-rt/include/flang-rt/runtime/assign-impl.h flang-rt/include/flang-rt/runtime/buffer.h flang-rt/include/flang-rt/runtime/connection.h flang-rt/include/flang-rt/runtime/derived.h flang-rt/include/flang-rt/runtime/descriptor.h flang-rt/include/flang-rt/runtime/emit-encoded.h flang-rt/include/flang-rt/runtime/environment.h flang-rt/include/flang-rt/runtime/file.h flang-rt/include/flang-rt/runtime/format-implementation.h flang-rt/include/flang-rt/runtime/format.h flang-rt/include/flang-rt/runtime/internal-unit.h flang-rt/include/flang-rt/runtime/io-error.h flang-rt/include/flang-rt/runtime/io-stmt.h flang-rt/include/flang-rt/runtime/lock.h flang-rt/include/flang-rt/runtime/memory.h flang-rt/include/flang-rt/runtime/namelist.h flang-rt/include/flang-rt/runtime/non-tbp-dio.h flang-rt/include/flang-rt/runtime/numeric-templates.h flang-rt/include/flang-rt/runtime/random-templates.h flang-rt/include/flang-rt/runtime/reduction-templates.h flang-rt/include/flang-rt/runtime/stat.h flang-rt/include/flang-rt/runtime/terminator.h flang-rt/include/flang-rt/runtime/tools.h flang-rt/include/flang-rt/runtime/type-code.h flang-rt/include/flang-rt/runtime/type-info.h flang-rt/include/flang-rt/runtime/utf.h flang-rt/lib/cuda/allocatable.cpp flang-rt/lib/cuda/allocator.cpp flang-rt/lib/cuda/descriptor.cpp flang-rt/lib/cuda/init.cpp flang-rt/lib/cuda/kernel.cpp flang-rt/lib/cuda/memmove-function.cpp flang-rt/lib/cuda/memory.cpp flang-rt/lib/cuda/pointer.cpp flang-rt/lib/cuda/registration.cpp flang-rt/lib/quadmath/acos.cpp flang-rt/lib/quadmath/acosh.cpp flang-rt/lib/quadmath/asin.cpp flang-rt/lib/quadmath/asinh.cpp flang-rt/lib/quadmath/atan.cpp flang-rt/lib/quadmath/atan2.cpp flang-rt/lib/quadmath/atanh.cpp flang-rt/lib/quadmath/ceil.cpp flang-rt/lib/quadmath/complex-math.c flang-rt/lib/quadmath/complex-math.h flang-rt/lib/quadmath/cos.cpp flang-rt/lib/quadmath/cosh.cpp flang-rt/lib/quadmath/erf.cpp flang-rt/lib/quadmath/erfc.cpp flang-rt/lib/quadmath/exp.cpp flang-rt/lib/quadmath/exponent.cpp flang-rt/lib/quadmath/floor.cpp flang-rt/lib/quadmath/fma.cpp flang-rt/lib/quadmath/fraction.cpp flang-rt/lib/quadmath/hypot.cpp flang-rt/lib/quadmath/j0.cpp flang-rt/lib/quadmath/j1.cpp flang-rt/lib/quadmath/jn.cpp flang-rt/lib/quadmath/lgamma.cpp flang-rt/lib/quadmath/llround.cpp flang-rt/lib/quadmath/log.cpp flang-rt/lib/quadmath/log10.cpp flang-rt/lib/quadmath/lround.cpp flang-rt/lib/quadmath/math-entries.h flang-rt/lib/quadmath/mod-real.cpp flang-rt/lib/quadmath/modulo-real.cpp flang-rt/lib/quadmath/nearbyint.cpp flang-rt/lib/quadmath/nearest.cpp flang-rt/lib/quadmath/norm2.cpp flang-rt/lib/quadmath/numeric-template-specs.h flang-rt/lib/quadmath/pow.cpp flang-rt/lib/quadmath/random.cpp flang-rt/lib/quadmath/remainder.cpp flang-rt/lib/quadmath/round.cpp flang-rt/lib/quadmath/rrspacing.cpp flang-rt/lib/quadmath/scale.cpp flang-rt/lib/quadmath/set-exponent.cpp flang-rt/lib/quadmath/sin.cpp flang-rt/lib/quadmath/sinh.cpp flang-rt/lib/quadmath/spacing.cpp flang-rt/lib/quadmath/sqrt.cpp flang-rt/lib/quadmath/tan.cpp flang-rt/lib/quadmath/tanh.cpp flang-rt/lib/quadmath/tgamma.cpp flang-rt/lib/quadmath/trunc.cpp flang-rt/lib/quadmath/y0.cpp flang-rt/lib/quadmath/y1.cpp flang-rt/lib/quadmath/yn.cpp flang-rt/lib/runtime/ISO_Fortran_binding.cpp flang-rt/lib/runtime/ISO_Fortran_util.h flang-rt/lib/runtime/allocatable.cpp flang-rt/lib/runtime/allocator-registry.cpp flang-rt/lib/runtime/array-constructor.cpp flang-rt/lib/runtime/assign.cpp flang-rt/lib/runtime/buffer.cpp flang-rt/lib/runtime/character.cpp flang-rt/lib/runtime/command.cpp flang-rt/lib/runtime/complex-powi.cpp flang-rt/lib/runtime/complex-reduction.c flang-rt/lib/runtime/complex-reduction.h flang-rt/lib/runtime/connection.cpp flang-rt/lib/runtime/copy.cpp flang-rt/lib/runtime/copy.h flang-rt/lib/runtime/derived-api.cpp flang-rt/lib/runtime/derived.cpp flang-rt/lib/runtime/descriptor-io.cpp flang-rt/lib/runtime/descriptor-io.h flang-rt/lib/runtime/descriptor.cpp flang-rt/lib/runtime/dot-product.cpp flang-rt/lib/runtime/edit-input.cpp flang-rt/lib/runtime/edit-input.h flang-rt/lib/runtime/edit-output.cpp flang-rt/lib/runtime/edit-output.h flang-rt/lib/runtime/environment-default-list.h flang-rt/lib/runtime/environment.cpp flang-rt/lib/runtime/exceptions.cpp flang-rt/lib/runtime/execute.cpp flang-rt/lib/runtime/extensions.cpp flang-rt/lib/runtime/external-unit.cpp flang-rt/lib/runtime/extrema.cpp flang-rt/lib/runtime/file.cpp flang-rt/lib/runtime/findloc.cpp flang-rt/lib/runtime/format.cpp flang-rt/lib/runtime/inquiry.cpp flang-rt/lib/runtime/internal-unit.cpp flang-rt/lib/runtime/io-api-common.h flang-rt/lib/runtime/io-api-minimal.cpp flang-rt/lib/runtime/io-api.cpp flang-rt/lib/runtime/io-error.cpp flang-rt/lib/runtime/io-stmt.cpp flang-rt/lib/runtime/iostat.cpp flang-rt/lib/runtime/main.cpp flang-rt/lib/runtime/matmul-transpose.cpp flang-rt/lib/runtime/matmul.cpp flang-rt/lib/runtime/memory.cpp flang-rt/lib/runtime/misc-intrinsic.cpp flang-rt/lib/runtime/namelist.cpp flang-rt/lib/runtime/non-tbp-dio.cpp flang-rt/lib/runtime/numeric.cpp flang-rt/lib/runtime/pointer.cpp flang-rt/lib/runtime/product.cpp flang-rt/lib/runtime/pseudo-unit.cpp flang-rt/lib/runtime/ragged.cpp flang-rt/lib/runtime/random.cpp flang-rt/lib/runtime/reduce.cpp flang-rt/lib/runtime/reduction.cpp flang-rt/lib/runtime/stack.h flang-rt/lib/runtime/stat.cpp flang-rt/lib/runtime/stop.cpp flang-rt/lib/runtime/sum.cpp flang-rt/lib/runtime/support.cpp flang-rt/lib/runtime/temporary-stack.cpp flang-rt/lib/runtime/terminator.cpp flang-rt/lib/runtime/time-intrinsic.cpp flang-rt/lib/runtime/tools.cpp flang-rt/lib/runtime/transformational.cpp flang-rt/lib/runtime/type-code.cpp flang-rt/lib/runtime/type-info.cpp flang-rt/lib/runtime/unit-map.cpp flang-rt/lib/runtime/unit-map.h flang-rt/lib/runtime/unit.cpp flang-rt/lib/runtime/unit.h flang-rt/lib/runtime/utf.cpp flang-rt/test/Runtime/no-cpp-dep.c flang-rt/unittests/Evaluate/ISO-Fortran-binding.cpp flang-rt/unittests/Evaluate/reshape.cpp flang-rt/unittests/Runtime/AccessTest.cpp flang-rt/unittests/Runtime/Allocatable.cpp flang-rt/unittests/Runtime/ArrayConstructor.cpp flang-rt/unittests/Runtime/BufferTest.cpp flang-rt/unittests/Runtime/CUDA/Allocatable.cpp flang-rt/unittests/Runtime/CUDA/AllocatorCUF.cpp flang-rt/unittests/Runtime/CUDA/Memory.cpp flang-rt/unittests/Runtime/CharacterTest.cpp flang-rt/unittests/Runtime/CommandTest.cpp flang-rt/unittests/Runtime/Complex.cpp flang-rt/unittests/Runtime/CrashHandlerFixture.cpp flang-rt/unittests/Runtime/CrashHandlerFixture.h flang-rt/unittests/Runtime/Derived.cpp flang-rt/unittests/Runtime/ExternalIOTest.cpp flang-rt/unittests/Runtime/Format.cpp flang-rt/unittests/Runtime/Inquiry.cpp flang-rt/unittests/Runtime/ListInputTest.cpp flang-rt/unittests/Runtime/LogicalFormatTest.cpp flang-rt/unittests/Runtime/Matmul.cpp flang-rt/unittests/Runtime/MatmulTranspose.cpp flang-rt/unittests/Runtime/MiscIntrinsic.cpp flang-rt/unittests/Runtime/Namelist.cpp flang-rt/unittests/Runtime/Numeric.cpp flang-rt/unittests/Runtime/NumericalFormatTest.cpp flang-rt/unittests/Runtime/Pointer.cpp flang-rt/unittests/Runtime/Ragged.cpp flang-rt/unittests/Runtime/Random.cpp flang-rt/unittests/Runtime/Reduction.cpp flang-rt/unittests/Runtime/RuntimeCrashTest.cpp flang-rt/unittests/Runtime/Stop.cpp flang-rt/unittests/Runtime/Support.cpp flang-rt/unittests/Runtime/TemporaryStack.cpp flang-rt/unittests/Runtime/Time.cpp flang-rt/unittests/Runtime/Transformational.cpp flang-rt/unittests/Runtime/tools.h
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/flang-rt/include/flang-rt/runtime/environment.h b/flang-rt/include/flang-rt/runtime/environment.h
index 142add432b..443b2c6873 100644
--- a/flang-rt/include/flang-rt/runtime/environment.h
+++ b/flang-rt/include/flang-rt/runtime/environment.h
@@ -39,7 +39,7 @@ struct ExecutionEnvironment {
// FIXME: https://github.com/llvm/llvm-project/issues/84942
constexpr
#endif
- ExecutionEnvironment(){};
+ ExecutionEnvironment() {};
void Configure(int argc, const char *argv[], const char *envp[],
const EnvironmentDefaultList *envDefaults);
const char *GetEnv(
diff --git a/flang-rt/include/flang-rt/runtime/format.h b/flang-rt/include/flang-rt/runtime/format.h
index b169d63fa4..260f4e5ad8 100644
--- a/flang-rt/include/flang-rt/runtime/format.h
+++ b/flang-rt/include/flang-rt/runtime/format.h
@@ -35,8 +35,7 @@ enum EditingFlags {
struct MutableModes {
std::uint8_t editingFlags{0}; // BN, DP, SS
- enum decimal::FortranRounding round{
- executionEnvironment
+ enum decimal::FortranRounding round{executionEnvironment
.defaultOutputRoundingMode}; // RP/ROUND='PROCESSOR_DEFAULT'
bool pad{true}; // PAD= mode on READ
char delim{'\0'}; // DELIM=
diff --git a/flang-rt/include/flang-rt/runtime/reduction-templates.h b/flang-rt/include/flang-rt/runtime/reduction-templates.h
index 8c6f838b8d..0657fd37d2 100644
--- a/flang-rt/include/flang-rt/runtime/reduction-templates.h
+++ b/flang-rt/include/flang-rt/runtime/reduction-templates.h
@@ -57,7 +57,7 @@ inline RT_API_ATTRS void DoTotalReduction(const Descriptor &x, int dim,
SubscriptValue maskAt[maxRank];
mask->GetLowerBounds(maskAt);
for (auto elements{x.Elements()}; elements--;
- x.IncrementSubscripts(xAt), mask->IncrementSubscripts(maskAt)) {
+ x.IncrementSubscripts(xAt), mask->IncrementSubscripts(maskAt)) {
if (IsLogicalElementTrue(*mask, maskAt)) {
if (!accumulator.template AccumulateAt<TYPE>(xAt)) {
break;
@@ -161,7 +161,7 @@ inline RT_API_ATTRS void ReduceDimMaskToScalar(const Descriptor &x,
const auto &maskDim{mask.GetDimension(zeroBasedDim)};
SubscriptValue maskPos{maskDim.LowerBound()};
for (auto n{x.GetDimension(zeroBasedDim).Extent()}; n-- > 0;
- ++xPos, ++maskPos) {
+ ++xPos, ++maskPos) {
maskAt[zeroBasedDim] = maskPos;
if (IsLogicalElementTrue(mask, maskAt)) {
xAt[zeroBasedDim] = xPos;
diff --git a/flang-rt/lib/runtime/assign.cpp b/flang-rt/lib/runtime/assign.cpp
index a1f3715f27..597d3e0878 100644
--- a/flang-rt/lib/runtime/assign.cpp
+++ b/flang-rt/lib/runtime/assign.cpp
@@ -202,7 +202,7 @@ static RT_API_ATTRS void DoElementalDefinedAssignment(const Descriptor &to,
fromElementDesc.Establish(
derived, nullptr, 0, nullptr, CFI_attribute_pointer);
for (std::size_t toElements{to.Elements()}; toElements-- > 0;
- to.IncrementSubscripts(toAt), from.IncrementSubscripts(fromAt)) {
+ to.IncrementSubscripts(toAt), from.IncrementSubscripts(fromAt)) {
toElementDesc.set_base_addr(to.Element<char>(toAt));
fromElementDesc.set_base_addr(from.Element<char>(fromAt));
DoScalarDefinedAssignment(toElementDesc, fromElementDesc, special);
@@ -217,7 +217,7 @@ static RT_API_ATTRS void BlankPadCharacterAssignment(Descriptor &to,
std::size_t padding{(toElementBytes - fromElementBytes) / sizeof(CHAR)};
std::size_t copiedCharacters{fromElementBytes / sizeof(CHAR)};
for (; elements-- > 0;
- to.IncrementSubscripts(toAt), from.IncrementSubscripts(fromAt)) {
+ to.IncrementSubscripts(toAt), from.IncrementSubscripts(fromAt)) {
CHAR *p{to.Element<CHAR>(toAt)};
Fortran::runtime::memmove(
p, from.Element<std::add_const_t<CHAR>>(fromAt), fromElementBytes);
@@ -385,7 +385,7 @@ RT_API_ATTRS void Assign(Descriptor &to, const Descriptor &from,
const Descriptor &componentDesc{updatedToDerived->component()};
std::size_t numComponents{componentDesc.Elements()};
for (std::size_t j{0}; j < toElements;
- ++j, to.IncrementSubscripts(toAt), from.IncrementSubscripts(fromAt)) {
+ ++j, to.IncrementSubscripts(toAt), from.IncrementSubscripts(fromAt)) {
for (std::size_t k{0}; k < numComponents; ++k) {
const auto &comp{
*componentDesc.ZeroBasedIndexedElement<typeInfo::Component>(
@@ -493,7 +493,7 @@ RT_API_ATTRS void Assign(Descriptor &to, const Descriptor &from,
}
} else { // elemental copies, possibly with character truncation
for (std::size_t n{toElements}; n-- > 0;
- to.IncrementSubscripts(toAt), from.IncrementSubscripts(fromAt)) {
+ to.IncrementSubscripts(toAt), from.IncrementSubscripts(fromAt)) {
memmoveFct(to.Element<char>(toAt), from.Element<const char>(fromAt),
toElementBytes);
}
@@ -520,14 +520,14 @@ RT_API_ATTRS void DoFromSourceAssign(Descriptor &alloc,
alloc.GetLowerBounds(allocAt);
if (allocDerived) {
for (std::size_t n{alloc.Elements()}; n-- > 0;
- alloc.IncrementSubscripts(allocAt)) {
+ alloc.IncrementSubscripts(allocAt)) {
Descriptor allocElement{*Descriptor::Create(*allocDerived,
reinterpret_cast<void *>(alloc.Element<char>(allocAt)), 0)};
Assign(allocElement, source, terminator, NoAssignFlags, memmoveFct);
}
} else { // intrinsic type
for (std::size_t n{alloc.Elements()}; n-- > 0;
- alloc.IncrementSubscripts(allocAt)) {
+ alloc.IncrementSubscripts(allocAt)) {
memmoveFct(alloc.Element<char>(allocAt), source.raw().base_addr,
alloc.ElementBytes());
}
diff --git a/flang-rt/lib/runtime/character.cpp b/flang-rt/lib/runtime/character.cpp
index 10cf27c37c..072ad3e7c1 100644
--- a/flang-rt/lib/runtime/character.cpp
+++ b/flang-rt/lib/runtime/character.cpp
@@ -123,7 +123,7 @@ static RT_API_ATTRS void Compare(Descriptor &result, const Descriptor &x,
std::size_t xChars{x.ElementBytes() >> shift<CHAR>};
std::size_t yChars{y.ElementBytes() >> shift<char>};
for (SubscriptValue resultAt{0}; elements-- > 0;
- ++resultAt, x.IncrementSubscripts(xAt), y.IncrementSubscripts(yAt)) {
+ ++resultAt, x.IncrementSubscripts(xAt), y.IncrementSubscripts(yAt)) {
*result.OffsetElement<char>(resultAt) = CharacterScalarCompare<CHAR>(
x.Element<CHAR>(xAt), y.Element<CHAR>(yAt), xChars, yChars);
}
@@ -176,7 +176,7 @@ static RT_API_ATTRS void AdjustLRHelper(Descriptor &result,
terminator.Crash("ADJUSTL/R: could not allocate storage for result");
}
for (SubscriptValue resultAt{0}; elements-- > 0;
- resultAt += elementBytes, string.IncrementSubscripts(stringAt)) {
+ resultAt += elementBytes, string.IncrementSubscripts(stringAt)) {
Adjust<CHAR, ADJUSTR>(result.OffsetElement<CHAR>(resultAt),
string.Element<const CHAR>(stringAt), elementBytes >> shift<CHAR>);
}
@@ -231,7 +231,7 @@ static RT_API_ATTRS void LenTrim(Descriptor &result, const Descriptor &string,
}
std::size_t stringElementChars{string.ElementBytes() >> shift<CHAR>};
for (SubscriptValue resultAt{0}; elements-- > 0;
- resultAt += sizeof(INT), string.IncrementSubscripts(stringAt)) {
+ resultAt += sizeof(INT), string.IncrementSubscripts(stringAt)) {
*result.OffsetElement<INT>(resultAt) =
LenTrim(string.Element<CHAR>(stringAt), stringElementChars);
}
@@ -414,8 +414,8 @@ static RT_API_ATTRS void GeneralCharFunc(Descriptor &result,
std::size_t stringElementChars{string.ElementBytes() >> shift<CHAR>};
std::size_t argElementChars{arg.ElementBytes() >> shift<CHAR>};
for (SubscriptValue resultAt{0}; elements-- > 0; resultAt += sizeof(INT),
- string.IncrementSubscripts(stringAt), arg.IncrementSubscripts(argAt),
- back && back->IncrementSubscripts(backAt)) {
+ string.IncrementSubscripts(stringAt), arg.IncrementSubscripts(argAt),
+ back && back->IncrementSubscripts(backAt)) {
if constexpr (FUNC == CharFunc::Index) {
*result.OffsetElement<INT>(resultAt) =
Index<CHAR>(string.Element<CHAR>(stringAt), stringElementChars,
@@ -514,7 +514,7 @@ static RT_API_ATTRS void MaxMinHelper(Descriptor &accumulator,
RUNTIME_CHECK(terminator, accumulator.Allocate() == CFI_SUCCESS);
}
for (CHAR *result{accumulator.OffsetElement<CHAR>()}; elements-- > 0;
- accumData += accumChars, result += chars, x.IncrementSubscripts(xAt)) {
+ accumData += accumChars, result += chars, x.IncrementSubscripts(xAt)) {
const CHAR *xData{x.Element<CHAR>(xAt)};
int cmp{CharacterScalarCompare(accumData, xData, accumChars, xChars)};
if constexpr (ISMIN) {
@@ -595,7 +595,7 @@ void RTDEF(CharacterConcatenate)(Descriptor &accumulator,
char *to{static_cast<char *>(accumulator.raw().base_addr)};
from.GetLowerBounds(fromAt);
for (; elements-- > 0;
- to += newBytes, p += oldBytes, from.IncrementSubscripts(fromAt)) {
+ to += newBytes, p += oldBytes, from.IncrementSubscripts(fromAt)) {
std::memcpy(to, p, oldBytes);
std::memcpy(to + oldBytes, from.Element<char>(fromAt), fromBytes);
}
diff --git a/flang-rt/lib/runtime/derived-api.cpp b/flang-rt/lib/runtime/derived-api.cpp
index 884fa8ee7d..284f1135b6 100644
--- a/flang-rt/lib/runtime/derived-api.cpp
+++ b/flang-rt/lib/runtime/derived-api.cpp
@@ -154,7 +154,7 @@ bool RTDEF(ExtendsTypeOf)(const Descriptor &a, const Descriptor &mold) {
// true if and only if the dynamic type of A is an extension type of the
// dynamic type of MOLD.
for (const typeInfo::DerivedType *derivedTypeA{GetDerivedType(a)};
- derivedTypeA; derivedTypeA = derivedTypeA->GetParentType()) {
+ derivedTypeA; derivedTypeA = derivedTypeA->GetParentType()) {
if (CompareDerivedType(derivedTypeA, derivedTypeMold)) {
return true;
}
diff --git a/flang-rt/lib/runtime/derived.cpp b/flang-rt/lib/runtime/derived.cpp
index 87e4b29d08..53e49c5a70 100644
--- a/flang-rt/lib/runtime/derived.cpp
+++ b/flang-rt/lib/runtime/derived.cpp
@@ -233,14 +233,14 @@ static RT_API_ATTRS void CallFinalSubroutine(const Descriptor &descriptor,
elemDesc.raw().rank = 0;
auto *p{special->GetProc<void (*)(const Descriptor &)>()};
for (std::size_t j{0}; j++ < elements;
- descriptor.IncrementSubscripts(at)) {
+ descriptor.IncrementSubscripts(at)) {
elemDesc.set_base_addr(descriptor.Element<char>(at));
p(elemDesc);
}
} else {
auto *p{special->GetProc<void (*)(char *)>()};
for (std::size_t j{0}; j++ < elements;
- descriptor.IncrementSubscripts(at)) {
+ descriptor.IncrementSubscripts(at)) {
p(descriptor.Element<char>(at));
}
}
@@ -300,7 +300,7 @@ RT_API_ATTRS void Finalize(const Descriptor &descriptor,
for (auto k{recurse ? std::size_t{1}
/* skip first component, it's the parent */
: 0};
- k < myComponents; ++k) {
+ k < myComponents; ++k) {
const auto &comp{
*componentDesc.ZeroBasedIndexedElement<typeInfo::Component>(k)};
SubscriptValue at[maxRank];
@@ -310,7 +310,7 @@ RT_API_ATTRS void Finalize(const Descriptor &descriptor,
// Component may be polymorphic or unlimited polymorphic. Need to use the
// dynamic type to check whether finalization is needed.
for (std::size_t j{0}; j++ < elements;
- descriptor.IncrementSubscripts(at)) {
+ descriptor.IncrementSubscripts(at)) {
const Descriptor &compDesc{
*descriptor.ElementComponent<Descriptor>(at, comp.offset())};
if (compDesc.IsAllocated()) {
@@ -329,7 +329,7 @@ RT_API_ATTRS void Finalize(const Descriptor &descriptor,
if (const typeInfo::DerivedType * compType{comp.derivedType()}) {
if (!compType->noFinalizationNeeded()) {
for (std::size_t j{0}; j++ < elements;
- descriptor.IncrementSubscripts(at)) {
+ descriptor.IncrementSubscripts(at)) {
const Descriptor &compDesc{
*descriptor.ElementComponent<Descriptor>(at, comp.offset())};
if (compDesc.IsAllocated()) {
@@ -346,7 +346,7 @@ RT_API_ATTRS void Finalize(const Descriptor &descriptor,
Descriptor &compDesc{staticDescriptor.descriptor()};
const typeInfo::DerivedType &compType{*comp.derivedType()};
for (std::size_t j{0}; j++ < elements;
- descriptor.IncrementSubscripts(at)) {
+ descriptor.IncrementSubscripts(at)) {
compDesc.Establish(compType,
descriptor.ElementComponent<char>(at, comp.offset()), comp.rank(),
extents);
@@ -408,7 +408,7 @@ RT_API_ATTRS void Destroy(const Descriptor &descriptor, bool finalize,
Descriptor &compDesc{staticDescriptor.descriptor()};
const typeInfo::DerivedType &compType{*comp.derivedType()};
for (std::size_t j{0}; j++ < elements;
- descriptor.IncrementSubscripts(at)) {
+ descriptor.IncrementSubscripts(at)) {
compDesc.Establish(compType,
descriptor.ElementComponent<char>(at, comp.offset()), comp.rank(),
extents);
diff --git a/flang-rt/lib/runtime/descriptor-io.h b/flang-rt/lib/runtime/descriptor-io.h
index dd39916432..888bf43528 100644
--- a/flang-rt/lib/runtime/descriptor-io.h
+++ b/flang-rt/lib/runtime/descriptor-io.h
@@ -284,7 +284,7 @@ static RT_API_ATTRS bool DefaultComponentwiseFormattedIO(IoStatementState &io,
SubscriptValue at[maxRank];
compArray.GetLowerBounds(at);
for (std::size_t k{0}; k < numComponents;
- ++k, compArray.IncrementSubscripts(at)) {
+ ++k, compArray.IncrementSubscripts(at)) {
const typeInfo::Component &component{
*compArray.Element<typeInfo::Component>(at)};
if (!DefaultComponentIO<DIR>(
@@ -311,11 +311,11 @@ static RT_API_ATTRS bool DefaultComponentwiseUnformattedIO(IoStatementState &io,
SubscriptValue subscripts[maxRank];
descriptor.GetLowerBounds(subscripts);
for (std::size_t j{0}; j < numElements;
- ++j, descriptor.IncrementSubscripts(subscripts)) {
+ ++j, descriptor.IncrementSubscripts(subscripts)) {
SubscriptValue at[maxRank];
compArray.GetLowerBounds(at);
for (std::size_t k{0}; k < numComponents;
- ++k, compArray.IncrementSubscripts(at)) {
+ ++k, compArray.IncrementSubscripts(at)) {
const typeInfo::Component &component{
*compArray.Element<typeInfo::Component>(at)};
if (!DefaultComponentIO<DIR>(
@@ -370,7 +370,7 @@ static RT_API_ATTRS bool FormattedDerivedTypeIO(IoStatementState &io,
descriptor.GetLowerBounds(subscripts);
std::size_t numElements{descriptor.Elements()};
for (std::size_t j{0}; j < numElements;
- ++j, descriptor.IncrementSubscripts(subscripts)) {
+ ++j, descriptor.IncrementSubscripts(subscripts)) {
Fortran::common::optional<bool> result;
if (special) {
result = DefinedFormattedIo(io, descriptor, *type, *special, subscripts);
diff --git a/flang-rt/lib/runtime/descriptor.cpp b/flang-rt/lib/runtime/descriptor.cpp
index 8241a34a49..b893090ed2 100644
--- a/flang-rt/lib/runtime/descriptor.cpp
+++ b/flang-rt/lib/runtime/descriptor.cpp
@@ -141,9 +141,10 @@ RT_API_ATTRS OwningPtr<Descriptor> Descriptor::Create(
RT_API_ATTRS std::size_t Descriptor::SizeInBytes() const {
const DescriptorAddendum *addendum{Addendum()};
- std::size_t bytes{ sizeof *this - sizeof(Dimension) + raw_.rank * sizeof(Dimension) +
- (addendum ? addendum->SizeInBytes() : 0)};
- assert (bytes <= MaxDescriptorSizeInBytes(raw_.rank,addendum) && "Descriptor must fit compiler-allocated space");
+ std::size_t bytes{sizeof *this - sizeof(Dimension) +
+ raw_.rank * sizeof(Dimension) + (addendum ? addendum->SizeInBytes() : 0)};
+ assert(bytes <= MaxDescriptorSizeInBytes(raw_.rank, addendum) &&
+ "Descriptor must fit compiler-allocated space");
return bytes;
}
diff --git a/flang-rt/lib/runtime/edit-input.cpp b/flang-rt/lib/runtime/edit-input.cpp
index 99a266648f..fdeb5606ab 100644
--- a/flang-rt/lib/runtime/edit-input.cpp
+++ b/flang-rt/lib/runtime/edit-input.cpp
@@ -352,8 +352,8 @@ static RT_API_ATTRS ScannedRealInput ScanRealInput(
// NaN or infinity - convert to upper case
// Subtle: a blank field of digits could be followed by 'E' or 'D',
for (; next &&
- ((*next >= 'a' && *next <= 'z') || (*next >= 'A' && *next <= 'Z'));
- next = io.NextInField(remaining, edit)) {
+ ((*next >= 'a' && *next <= 'z') || (*next >= 'A' && *next <= 'Z'));
+ next = io.NextInField(remaining, edit)) {
if (*next >= 'a' && *next <= 'z') {
Put(*next - 'a' + 'A');
} else {
diff --git a/flang-rt/lib/runtime/edit-output.cpp b/flang-rt/lib/runtime/edit-output.cpp
index 36bbc638ff..5241da3b7b 100644
--- a/flang-rt/lib/runtime/edit-output.cpp
+++ b/flang-rt/lib/runtime/edit-output.cpp
@@ -644,8 +644,8 @@ RT_API_ATTRS bool RealOutputEditing<KIND>::EditListDirectedOutput(
// follows that precedent so as to avoid a gratuitous incompatibility.
template <int KIND>
RT_API_ATTRS auto RealOutputEditing<KIND>::ConvertToHexadecimal(
- int significantDigits, enum decimal::FortranRounding rounding,
- int flags) -> ConvertToHexadecimalResult {
+ int significantDigits, enum decimal::FortranRounding rounding, int flags)
+ -> ConvertToHexadecimalResult {
if (x_.IsNaN() || x_.IsInfinite()) {
auto converted{ConvertToDecimal(significantDigits, rounding, flags)};
return {converted.str, static_cast<int>(converted.length), 0};
diff --git a/flang-rt/lib/runtime/findloc.cpp b/flang-rt/lib/runtime/findloc.cpp
index 95986aefb8..ad7a06414e 100644
--- a/flang-rt/lib/runtime/findloc.cpp
+++ b/flang-rt/lib/runtime/findloc.cpp
@@ -149,8 +149,8 @@ struct TotalNumericFindlocHelper {
};
template <TypeCategory CAT,
- template <TypeCategory XCAT, int XKIND, TypeCategory TARGET_CAT>
- class HELPER>
+ template <TypeCategory XCAT, int XKIND,
+ TypeCategory TARGET_CAT> class HELPER>
struct NumericFindlocHelper {
template <int KIND> struct Functor {
RT_API_ATTRS void operator()(TypeCategory targetCat, int targetKind,
diff --git a/flang-rt/lib/runtime/io-api-common.h b/flang-rt/lib/runtime/io-api-common.h
index b91ff9ff16..279b9e23c1 100644
--- a/flang-rt/lib/runtime/io-api-common.h
+++ b/flang-rt/lib/runtime/io-api-common.h
@@ -22,8 +22,8 @@ static inline RT_API_ATTRS Cookie NoopUnit(const Terminator &terminator,
int unitNumber, enum Iostat iostat = IostatOk) {
Cookie cookie{&New<NoopStatementState>{terminator}(
terminator.sourceFileName(), terminator.sourceLine(), unitNumber)
- .release()
- ->ioStatementState()};
+ .release()
+ ->ioStatementState()};
if (iostat != IostatOk) {
cookie->GetIoErrorHandler().SetPendingError(iostat);
}
diff --git a/flang-rt/lib/runtime/io-stmt.cpp b/flang-rt/lib/runtime/io-stmt.cpp
index b0823ffd9e..c4350119d6 100644
--- a/flang-rt/lib/runtime/io-stmt.cpp
+++ b/flang-rt/lib/runtime/io-stmt.cpp
@@ -370,8 +370,8 @@ int NoUnitIoStatementState::EndIoStatement() {
template <Direction DIR>
ExternalIoStatementState<DIR>::ExternalIoStatementState(
ExternalFileUnit &unit, const char *sourceFile, int sourceLine)
- : ExternalIoStatementBase{unit, sourceFile, sourceLine}, mutableModes_{
- unit.modes} {
+ : ExternalIoStatementBase{unit, sourceFile, sourceLine},
+ mutableModes_{unit.modes} {
if constexpr (DIR == Direction::Output) {
// If the last statement was a non-advancing IO input statement, the unit
// furthestPositionInRecord was not advanced, but the positionInRecord may
@@ -990,9 +990,8 @@ ChildFormattedIoStatementState<DIR, CHAR>::ChildFormattedIoStatementState(
ChildIo &child, const CHAR *format, std::size_t formatLength,
const Descriptor *formatDescriptor, const char *sourceFile, int sourceLine)
: ChildIoStatementState<DIR>{child, sourceFile, sourceLine},
- mutableModes_{child.parent().mutableModes()}, format_{*this, format,
- formatLength,
- formatDescriptor} {}
+ mutableModes_{child.parent().mutableModes()},
+ format_{*this, format, formatLength, formatDescriptor} {}
template <Direction DIR, typename CHAR>
void ChildFormattedIoStatementState<DIR, CHAR>::CompleteOperation() {
@@ -1448,8 +1447,8 @@ bool InquireNoUnitState::Inquire(
InquireUnconnectedFileState::InquireUnconnectedFileState(
OwningPtr<char> &&path, const char *sourceFile, int sourceLine)
- : NoUnitIoStatementState{*this, sourceFile, sourceLine}, path_{std::move(
- path)} {}
+ : NoUnitIoStatementState{*this, sourceFile, sourceLine},
+ path_{std::move(path)} {}
bool InquireUnconnectedFileState::Inquire(
InquiryKeywordHash inquiry, char *result, std::size_t length) {
diff --git a/flang-rt/lib/runtime/non-tbp-dio.cpp b/flang-rt/lib/runtime/non-tbp-dio.cpp
index 72101b06e0..a4b709e2b4 100644
--- a/flang-rt/lib/runtime/non-tbp-dio.cpp
+++ b/flang-rt/lib/runtime/non-tbp-dio.cpp
@@ -19,7 +19,7 @@ const NonTbpDefinedIo *NonTbpDefinedIoTable::Find(
return p;
} else if (p->isDtvArgPolymorphic) {
for (const typeInfo::DerivedType *t{type.GetParentType()}; t;
- t = t->GetParentType()) {
+ t = t->GetParentType()) {
if (&p->derivedType == t && p->definedIo == definedIo) {
return p;
}
diff --git a/flang-rt/lib/runtime/ragged.cpp b/flang-rt/lib/runtime/ragged.cpp
index dddc3ccdfd..912d4e8665 100644
--- a/flang-rt/lib/runtime/ragged.cpp
+++ b/flang-rt/lib/runtime/ragged.cpp
@@ -55,7 +55,7 @@ RT_API_ATTRS void RaggedArrayDeallocate(RaggedArrayHeader *raggedArrayHeader) {
if (isIndirection(raggedArrayHeader)) {
std::size_t linearExtent{1u};
for (std::size_t counter{0u}; counter < end && linearExtent > 0;
- ++counter) {
+ ++counter) {
linearExtent *= raggedArrayHeader->extentPointer[counter];
}
for (std::size_t counter{0u}; counter < linearExtent; ++counter) {
diff --git a/flang-rt/lib/runtime/tools.cpp b/flang-rt/lib/runtime/tools.cpp
index b9d9ca4fc3..7a184190eb 100644
--- a/flang-rt/lib/runtime/tools.cpp
+++ b/flang-rt/lib/runtime/tools.cpp
@@ -121,7 +121,7 @@ RT_API_ATTRS void ShallowCopyDiscontiguousToDiscontiguous(
from.GetLowerBounds(fromAt);
std::size_t elementBytes{to.ElementBytes()};
for (std::size_t n{to.Elements()}; n-- > 0;
- to.IncrementSubscripts(toAt), from.IncrementSubscripts(fromAt)) {
+ to.IncrementSubscripts(toAt), from.IncrementSubscripts(fromAt)) {
std::memcpy(
to.Element<char>(toAt), from.Element<char>(fromAt), elementBytes);
}
@@ -134,7 +134,7 @@ RT_API_ATTRS void ShallowCopyDiscontiguousToContiguous(
from.GetLowerBounds(fromAt);
std::size_t elementBytes{to.ElementBytes()};
for (std::size_t n{to.Elements()}; n-- > 0;
- toAt += elementBytes, from.IncrementSubscripts(fromAt)) {
+ toAt += elementBytes, from.IncrementSubscripts(fromAt)) {
std::memcpy(toAt, from.Element<char>(fromAt), elementBytes);
}
}
@@ -146,7 +146,7 @@ RT_API_ATTRS void ShallowCopyContiguousToDiscontiguous(
char *fromAt{from.OffsetElement()};
std::size_t elementBytes{to.ElementBytes()};
for (std::size_t n{to.Elements()}; n-- > 0;
- to.IncrementSubscripts(toAt), fromAt += elementBytes) {
+ to.IncrementSubscripts(toAt), fromAt += elementBytes) {
std::memcpy(to.Element<char>(toAt), fromAt, elementBytes);
}
}
diff --git a/flang-rt/lib/runtime/transformational.cpp b/flang-rt/lib/runtime/transformational.cpp
index eb694a9f2c..8ede201f9b 100644
--- a/flang-rt/lib/runtime/transformational.cpp
+++ b/flang-rt/lib/runtime/transformational.cpp
@@ -861,7 +861,7 @@ void RTDEF(Transpose)(Descriptor &result, const Descriptor &matrix,
SubscriptValue matrixLB[2];
matrix.GetLowerBounds(matrixLB);
for (std::size_t n{result.Elements()}; n-- > 0;
- result.IncrementSubscripts(resultAt)) {
+ result.IncrementSubscripts(resultAt)) {
SubscriptValue matrixAt[2]{
matrixLB[0] + resultAt[1] - 1, matrixLB[1] + resultAt[0] - 1};
CopyElement(result, resultAt, matrix, matrixAt, terminator);
diff --git a/flang-rt/lib/runtime/type-info.cpp b/flang-rt/lib/runtime/type-info.cpp
index 82182696d7..e196478702 100644
--- a/flang-rt/lib/runtime/type-info.cpp
+++ b/flang-rt/lib/runtime/type-info.cpp
@@ -86,7 +86,7 @@ RT_API_ATTRS std::size_t Component::SizeInBytes(
} else if (category() == TypeCategory::Derived) {
const DerivedType *type{derivedType()};
return Descriptor::SizeInBytes(
- rank_, true, type ? type->LenParameters() : 0);
+ rank_, true, type ? type->LenParameters() : 0);
} else {
return Descriptor::SizeInBytes(rank_);
}
diff --git a/flang-rt/unittests/Runtime/Transformational.cpp b/flang-rt/unittests/Runtime/Transformational.cpp
index 06df96a3cc..89dd24b397 100644
--- a/flang-rt/unittests/Runtime/Transformational.cpp
+++ b/flang-rt/unittests/Runtime/Transformational.cpp
@@ -26,8 +26,8 @@ using BesselX0FuncType =
std::function<void(Descriptor &, int32_t, int32_t, const char *, int)>;
template <int KIND>
-constexpr CppTypeFor<TypeCategory::Real, KIND>
- besselEpsilon = CppTypeFor<TypeCategory::Real, KIND>(1e-4);
+constexpr CppTypeFor<TypeCategory::Real, KIND> besselEpsilon =
+ CppTypeFor<TypeCategory::Real, KIND>(1e-4);
template <int KIND>
static void testBesselJn(BesselFuncType<KIND> rtFunc, int32_t n1, int32_t n2,
``````````
</details>
https://github.com/llvm/llvm-project/pull/127081
More information about the flang-commits
mailing list