[flang] [llvm] Add print statements to lit for tracing purposes (PR #92694)

via llvm-commits llvm-commits at lists.llvm.org
Sun May 19 11:34:05 PDT 2024


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 9940620f6eab50deeaed0d976b2ea0afd007ba24 1c785a63d029dc55fc06ec236e55983729767e2f -- flang/unittests/Optimizer/Builder/ComplexTest.cpp flang/unittests/Optimizer/Builder/DoLoopHelperTest.cpp flang/unittests/Optimizer/Builder/FIRBuilderTest.cpp flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp flang/unittests/Optimizer/Builder/Runtime/CharacterTest.cpp flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp flang/unittests/Optimizer/FIRTypesTest.cpp flang/unittests/Optimizer/FortranVariableTest.cpp flang/unittests/Optimizer/InternalNamesTest.cpp flang/unittests/Runtime/CharacterTest.cpp flang/unittests/Runtime/CommandTest.cpp flang/unittests/Runtime/Complex.cpp flang/unittests/Runtime/ExternalIOTest.cpp flang/unittests/Runtime/Format.cpp flang/unittests/Runtime/ListInputTest.cpp flang/unittests/Runtime/MiscIntrinsic.cpp flang/unittests/Runtime/Numeric.cpp flang/unittests/Runtime/NumericalFormatTest.cpp flang/unittests/Runtime/Pointer.cpp flang/unittests/Runtime/RuntimeCrashTest.cpp flang/unittests/Runtime/Stop.cpp flang/unittests/Runtime/TemporaryStack.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/flang/unittests/Optimizer/Builder/ComplexTest.cpp b/flang/unittests/Optimizer/Builder/ComplexTest.cpp
index b17ef9ef2f..adc4d10690 100644
--- a/flang/unittests/Optimizer/Builder/ComplexTest.cpp
+++ b/flang/unittests/Optimizer/Builder/ComplexTest.cpp
@@ -70,10 +70,11 @@ public:
 //   EXPECT_TRUE(fir::isa_real(helper->getComplexPartType(cVal1)));
 //   EXPECT_TRUE(fir::isa_real(helper->getComplexPartType(cVal2)));
 
-//   mlir::Value real1 = helper->extractComplexPart(cVal1, /*isImagPart=*/false);
-//   mlir::Value imag1 = helper->extractComplexPart(cVal1, /*isImagPart=*/true);
-//   mlir::Value real2 = helper->extractComplexPart(cVal2, /*isImagPart=*/false);
-//   mlir::Value imag2 = helper->extractComplexPart(cVal2, /*isImagPart=*/true);
+//   mlir::Value real1 = helper->extractComplexPart(cVal1,
+//   /*isImagPart=*/false); mlir::Value imag1 =
+//   helper->extractComplexPart(cVal1, /*isImagPart=*/true); mlir::Value real2 =
+//   helper->extractComplexPart(cVal2, /*isImagPart=*/false); mlir::Value imag2
+//   = helper->extractComplexPart(cVal2, /*isImagPart=*/true);
 //   EXPECT_EQ(realTy1, real1.getType());
 //   EXPECT_EQ(realTy1, imag1.getType());
 //   EXPECT_EQ(realTy1, real2.getType());
diff --git a/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp b/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp
index 616045f275..7746528a2e 100644
--- a/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp
+++ b/flang/unittests/Optimizer/Builder/HLFIRToolsTest.cpp
@@ -137,10 +137,11 @@ TEST_F(HLFIRToolsTest, testScalarCharRoundTrip) {
 //   mlir::Type charType = fir::CharacterType::getUnknownLen(&context, 1);
 //   mlir::Type seqCharType = builder.getVarLenSeqTy(charType, 2);
 //   mlir::Type arrayCharType = builder.getRefType(seqCharType);
-//   mlir::Value arrayCharAddr = builder.create<fir::UndefOp>(loc, arrayCharType);
-//   fir::CharArrayBoxValue arrayChar{arrayCharAddr, len, extents, lbounds};
-//   hlfir::EntityWithAttributes arrayCharEntity(createDeclare(arrayChar));
-//   auto [arrayCharResult, cleanup] =
+//   mlir::Value arrayCharAddr = builder.create<fir::UndefOp>(loc,
+//   arrayCharType); fir::CharArrayBoxValue arrayChar{arrayCharAddr, len,
+//   extents, lbounds}; hlfir::EntityWithAttributes
+//   arrayCharEntity(createDeclare(arrayChar)); auto [arrayCharResult, cleanup]
+//   =
 //       hlfir::translateToExtendedValue(loc, builder, arrayCharEntity);
 //   auto *res = arrayCharResult.getBoxOf<fir::CharArrayBoxValue>();
 //   EXPECT_FALSE(cleanup.has_value());
diff --git a/flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp
index 57347e56b4..a850bcc1fa 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/CommandTest.cpp
@@ -12,8 +12,9 @@
 
 // TEST_F(RuntimeCallTest, genCommandArgumentCountTest) {
 //   mlir::Location loc = firBuilder->getUnknownLoc();
-//   mlir::Value result = fir::runtime::genCommandArgumentCount(*firBuilder, loc);
-//   checkCallOp(result.getDefiningOp(), "_FortranAArgumentCount", /*nbArgs=*/0,
+//   mlir::Value result = fir::runtime::genCommandArgumentCount(*firBuilder,
+//   loc); checkCallOp(result.getDefiningOp(), "_FortranAArgumentCount",
+//   /*nbArgs=*/0,
 //       /*addLocArgs=*/false);
 // }
 
diff --git a/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp b/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp
index 994e113da7..56cee0c818 100644
--- a/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp
+++ b/flang/unittests/Optimizer/Builder/Runtime/ReductionTest.cpp
@@ -351,7 +351,8 @@ TEST_F(RuntimeCallTest, genMaxvalCharTest) {
 
 // TEST_F(RuntimeCallTest, genMinvalCharTest) {
 //   checkGenMxxvalChar(
-//       *firBuilder, fir::runtime::genMinvalChar, "_FortranAMinvalCharacter", 3);
+//       *firBuilder, fir::runtime::genMinvalChar, "_FortranAMinvalCharacter",
+//       3);
 // }
 
 void checkGen4argsDim(fir::FirOpBuilder &builder,
diff --git a/flang/unittests/Runtime/Complex.cpp b/flang/unittests/Runtime/Complex.cpp
index f87b890c82..2fe09b3830 100644
--- a/flang/unittests/Runtime/Complex.cpp
+++ b/flang/unittests/Runtime/Complex.cpp
@@ -142,7 +142,8 @@ TEST(Complex, cpowk) {
 
 //   EXPECT_COMPLEX_DOUBLE_EQ(zpowi(3. + 4i, -2), -0.0112 - 0.0384i);
 //   EXPECT_COMPLEX_DOUBLE_EQ(zpowi(2. + 1i, 10), -237. - 3116i);
-//   EXPECT_COMPLEX_DOUBLE_EQ(zpowi(0.5 + 0.6i, -10), -9.32293628 - 7.29848564i);
+//   EXPECT_COMPLEX_DOUBLE_EQ(zpowi(0.5 + 0.6i, -10), -9.32293628
+//   - 7.29848564i);
 
 //   EXPECT_COMPLEX_DOUBLE_EQ(zpowi(2. + 1i, 5), -38. + 41i);
 //   EXPECT_COMPLEX_DOUBLE_EQ(zpowi(0.5 + 0.6i, -5), -1.12183773 + 3.25291503i);
diff --git a/flang/unittests/Runtime/ExternalIOTest.cpp b/flang/unittests/Runtime/ExternalIOTest.cpp
index 0f3da0784f..0d48924baa 100644
--- a/flang/unittests/Runtime/ExternalIOTest.cpp
+++ b/flang/unittests/Runtime/ExternalIOTest.cpp
@@ -591,9 +591,10 @@ TEST(ExternalIOTests, TestNonAvancingInput) {
 //   auto *io{IONAME(BeginOpenNewUnit)(__FILE__, __LINE__)};
 //   ASSERT_TRUE(IONAME(SetAccess)(io, "SEQUENTIAL", 10))
 //       << "SetAccess(SEQUENTIAL)";
-//   ASSERT_TRUE(IONAME(SetAction)(io, "READWRITE", 9)) << "SetAction(READWRITE)";
-//   ASSERT_TRUE(IONAME(SetForm)(io, "FORMATTED", 9)) << "SetForm(FORMATTED)";
-//   ASSERT_TRUE(IONAME(SetStatus)(io, "SCRATCH", 7)) << "SetStatus(SCRATCH)";
+//   ASSERT_TRUE(IONAME(SetAction)(io, "READWRITE", 9)) <<
+//   "SetAction(READWRITE)"; ASSERT_TRUE(IONAME(SetForm)(io, "FORMATTED", 9)) <<
+//   "SetForm(FORMATTED)"; ASSERT_TRUE(IONAME(SetStatus)(io, "SCRATCH", 7)) <<
+//   "SetStatus(SCRATCH)";
 
 //   int unit{-1};
 //   ASSERT_TRUE(IONAME(GetNewUnit)(io, unit)) << "GetNewUnit()";
@@ -637,7 +638,8 @@ TEST(ExternalIOTests, TestNonAvancingInput) {
 //     IONAME(EnableHandlers)(io, true, false, false, false, false);
 //     ASSERT_TRUE(IONAME(SetAdvance)(io, "NO", 2)) << "SetAdvance(NO)" << j;
 //     ASSERT_TRUE(
-//         IONAME(InputAscii)(io, inputItem.item.data(), inputItem.item.length()))
+//         IONAME(InputAscii)(io, inputItem.item.data(),
+//         inputItem.item.length()))
 //         << "InputAscii() " << j;
 //     ASSERT_EQ(IONAME(EndIoStatement)(io), inputItem.expectedIoStat)
 //         << "EndIoStatement() for Read " << j;
@@ -651,7 +653,8 @@ TEST(ExternalIOTests, TestNonAvancingInput) {
 //   // WRITE(UNIT=unit,FMT=fmt) record
 //   io = IONAME(BeginExternalFormattedOutput)(
 //       fmt.data(), fmt.length(), nullptr, unit, __FILE__, __LINE__);
-//   ASSERT_TRUE(IONAME(OutputAscii)(io, outputItem.data(), outputItem.length()))
+//   ASSERT_TRUE(IONAME(OutputAscii)(io, outputItem.data(),
+//   outputItem.length()))
 //       << "OutputAscii()";
 //   ASSERT_EQ(IONAME(EndIoStatement)(io), IostatOk)
 //       << "EndIoStatement() for OutputAscii";
diff --git a/flang/unittests/Runtime/ListInputTest.cpp b/flang/unittests/Runtime/ListInputTest.cpp
index c53a10a0af..5b8ec1b6e0 100644
--- a/flang/unittests/Runtime/ListInputTest.cpp
+++ b/flang/unittests/Runtime/ListInputTest.cpp
@@ -180,7 +180,8 @@ struct SimpleListInputTest : testing::TestWithParam<ParamTy> {};
 //   // Verify the calls to _InputInteger_ resulted in _expectedOutput_
 //   for (std::size_t j = 0; j < listInputLength; ++j) {
 //     ASSERT_EQ(actualOutput[j], expectedOutput[j])
-//         << "wanted actualOutput[" << j << "]==" << expectedOutput[j] << ", got "
+//         << "wanted actualOutput[" << j << "]==" << expectedOutput[j] << ",
+//         got "
 //         << actualOutput[j] << '\n';
 //   }
 // }
diff --git a/flang/unittests/Runtime/Numeric.cpp b/flang/unittests/Runtime/Numeric.cpp
index 98ec88abf9..64340e7e7f 100644
--- a/flang/unittests/Runtime/Numeric.cpp
+++ b/flang/unittests/Runtime/Numeric.cpp
@@ -231,8 +231,8 @@ TEST(Numeric, SelectedIntKind) {
 //                 __FILE__, __LINE__, &p[10], 2, &r[10], 4, &d[10], 8),
 //       -3);
 //   EXPECT_EQ(
-//       RTNAME(SelectedRealKind)(__FILE__, __LINE__, &p_s, 1, &r[0], 4, &d[0], 8),
-//       2);
+//       RTNAME(SelectedRealKind)(__FILE__, __LINE__, &p_s, 1, &r[0], 4, &d[0],
+//       8), 2);
 //   EXPECT_EQ(RTNAME(SelectedRealKind)(
 //                 __FILE__, __LINE__, nullptr, 0, &r[0], 4, &d[0], 8),
 //       2);
diff --git a/flang/unittests/Runtime/Pointer.cpp b/flang/unittests/Runtime/Pointer.cpp
index 30edf82fbc..80b144869d 100644
--- a/flang/unittests/Runtime/Pointer.cpp
+++ b/flang/unittests/Runtime/Pointer.cpp
@@ -66,7 +66,8 @@ TEST(Pointer, DeallocatePolymorphic) {
 
 // TEST(Pointer, AllocateFromScalarSource) {
 //   // REAL(4), POINTER :: p(:)
-//   auto p{Descriptor::Create(TypeCode{Fortran::common::TypeCategory::Real, 4}, 4,
+//   auto p{Descriptor::Create(TypeCode{Fortran::common::TypeCategory::Real, 4},
+//   4,
 //       nullptr, 1, nullptr, CFI_attribute_pointer)};
 //   // ALLOCATE(p(2:11), SOURCE=3.4)
 //   float sourecStorage{3.4F};
diff --git a/flang/unittests/Runtime/TemporaryStack.cpp b/flang/unittests/Runtime/TemporaryStack.cpp
index 8b9aac9930..445bc8f2e7 100644
--- a/flang/unittests/Runtime/TemporaryStack.cpp
+++ b/flang/unittests/Runtime/TemporaryStack.cpp
@@ -116,8 +116,8 @@ static unsigned max(unsigned x, unsigned y) {
 //         inputDescriptors.emplace_back(Descriptor::Create(code, elementBytes,
 //             nullptr, rank, extent, CFI_attribute_allocatable, adendum));
 
-//     // Descriptor::Establish doesn't initialise the extents if baseaddr is null
-//     for (unsigned dim = 0; dim < rank; ++dim) {
+//     // Descriptor::Establish doesn't initialise the extents if baseaddr is
+//     null for (unsigned dim = 0; dim < rank; ++dim) {
 //       Fortran::ISO::CFI_dim_t &boxDims = desc->raw().dim[dim];
 //       boxDims.lower_bound = 1;
 //       boxDims.extent = extent[dim];

``````````

</details>


https://github.com/llvm/llvm-project/pull/92694


More information about the llvm-commits mailing list