Skip to content

[Flang][NFC] Move runtime library files to flang-rt. #110298

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 95 commits into from
Feb 16, 2025

Conversation

Meinersbur
Copy link
Member

@Meinersbur Meinersbur commented Sep 27, 2024

Mostly mechanical changes in preparation of extracting the Flang-RT "subproject" in #110217. This PR intends to only move pre-existing files to the new folder structure, with no behavioral change. Common files (headers, testing, cmake) shared by Flang-RT and Flang remain in flang/.

Some cosmetic changes and files paths were necessary:

  • Relative paths to the new path for the source files and add_subdirectory.
  • Add the new location's include directory to include_directories
  • The unittest/Evaluate directory has unitests for flang-rt and Flang. A new CMakeLists.txt was introduced for the flang-rt tests.
  • Change the #include paths relative to the include directive
  • clang-format on the #include directives
  • Since the paths are part if the copyright header and include guards, a script was used to canonicalize those
  • test/Runtime and runtime tests in test/Driver are moved, but the lit.cfg.py mechanism to execute the will only be added in [Flang] LLVM_ENABLE_RUNTIMES=flang-rt #110217.

Copy link

github-actions bot commented Sep 27, 2024

⚠️ C/C++ code formatter, clang-format found issues in your code. ⚠️

You can test this locally with the following command:
git-clang-format --diff 660cdace559a8dbe44ebf2222b854bf3f39a5f62 2f214660a5e6fe52f78d65e10744ff95e0f734e5 --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
View the diff from clang-format here.
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,

@Meinersbur
Copy link
Member Author

The formatting violations in #110298 (comment) are those already present in the current trunk. git clang-format checks all formatting violations in a moved file, even if the content itself has not changed.

@Meinersbur Meinersbur marked this pull request as ready for review October 7, 2024 20:56
@llvmbot
Copy link
Member

llvmbot commented Oct 7, 2024

@llvm/pr-subscribers-flang-runtime
@llvm/pr-subscribers-flang-driver
@llvm/pr-subscribers-flang-codegen

@llvm/pr-subscribers-flang-fir-hlfir

Author: Michael Kruse (Meinersbur)

Changes

Mostly mechanical changes in preparation of extracting the FortranRuntime "subproject" in #110217. This PR intends to only move pre-existing files to the new folder structure, with no behavioral change.

Common and Testing are the directories shared by FortranRuntime and Flang. Runtime and module are going to be used by FortranRuntime only. Files in Common that are used only by Flang are moved into Support.

Some cosmetic changes and files paths were necessary:

  • Relative paths to the new path for the source files and add_subdirectory.
  • Add the new location's include directory to include_directories
  • The unittest/Evaluate directory has unitests for FortranRuntime and Flang. A new CMakeLists.txt was introduced for the FortranRuntime tests.
  • Change the of the #include paths relative to the include directive
  • clang-format on the #include directives
  • Since the paths is part if the copyright header and include guards, a script was used to canonicalize those
  • test/Runtime and runtime tests in test/Driver are moved, but the lit.cfg.py mechanism to execute the will only be added in #110217.

Patch is 334.25 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/110298.diff

418 Files Affected:

  • (added) FortranRuntime/.clang-format (+21)
  • (renamed) FortranRuntime/cmake/config.h.cmake.in ()
  • (renamed) FortranRuntime/include/flang/Common/Fortran-consts.h ()
  • (renamed) FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h (+7-8)
  • (renamed) FortranRuntime/include/flang/Common/api-attrs.h (+5-6)
  • (renamed) FortranRuntime/include/flang/Common/binary-floating-point.h (+4-4)
  • (renamed) FortranRuntime/include/flang/Common/bit-population-count.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/constexpr-bitset.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/decimal.h (+5-6)
  • (renamed) FortranRuntime/include/flang/Common/enum-class.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/enum-set.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/fast-int-set.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Common/float128.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/format.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/idioms.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/leading-zero-bit-count.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/magic-numbers.h (+3-3)
  • (renamed) FortranRuntime/include/flang/Common/optional.h (+3-3)
  • (renamed) FortranRuntime/include/flang/Common/real.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/reference-wrapper.h (+3-3)
  • (renamed) FortranRuntime/include/flang/Common/restorer.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Common/target-rounding.h ()
  • (renamed) FortranRuntime/include/flang/Common/uint128.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Common/variant.h (+3-3)
  • (renamed) FortranRuntime/include/flang/Common/visit.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Common/windows-include.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/CUDA/allocator.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/CUDA/descriptor.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/allocatable.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/allocator-registry.h (+4-4)
  • (renamed) FortranRuntime/include/flang/Runtime/array-constructor.h (+3-3)
  • (renamed) FortranRuntime/include/flang/Runtime/assign.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/c-or-cpp.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/character.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/command.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/cpp-type.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/derived-api.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/descriptor.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/entry-names.h (+5-6)
  • (renamed) FortranRuntime/include/flang/Runtime/exceptions.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/execute.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/extensions.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/freestanding-tools.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/inquiry.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/io-api.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/iostat.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/main.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/matmul-instances.inc ()
  • (renamed) FortranRuntime/include/flang/Runtime/matmul-transpose.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/matmul.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/memory.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/misc-intrinsic.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/numeric.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/pointer.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/ragged.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/random.h (+5)
  • (renamed) FortranRuntime/include/flang/Runtime/reduce.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/reduction.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/stop.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/support.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/temporary-stack.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/time-intrinsic.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/transformational.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/type-code.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Testing/fp-testing.h (+11-3)
  • (renamed) FortranRuntime/include/flang/Testing/testing.h (+11-3)
  • (renamed) FortranRuntime/lib/Common/big-radix-floating-point.h (+6-6)
  • (renamed) FortranRuntime/lib/Common/binary-to-decimal.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Common/decimal-to-binary.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/CMakeLists.txt (+5-4)
  • (renamed) FortranRuntime/lib/Runtime/CUDA/CMakeLists.txt (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/CUDA/allocator.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/CUDA/descriptor.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/CMakeLists.txt (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/acos.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/acosh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/asin.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/asinh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/atan.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/atan2.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/atanh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/ceil.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/complex-math.c (+2-3)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/complex-math.h (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/cos.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/cosh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/erf.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/erfc.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/exp.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/exponent.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/floor.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/fma.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/fraction.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/hypot.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/j0.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/j1.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/jn.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/lgamma.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/llround.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/log.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/log10.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/lround.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/math-entries.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/mod-real.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/modulo-real.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/nearest.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/norm2.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/numeric-template-specs.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/pow.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/random.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/round.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/rrspacing.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/scale.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/set-exponent.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/sin.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/sinh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/spacing.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/sqrt.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/tan.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/tanh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/tgamma.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/trunc.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/y0.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/y1.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/yn.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/ISO_Fortran_binding.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/ISO_Fortran_util.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/allocatable.cpp (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/allocator-registry.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/array-constructor.cpp (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/assign-impl.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/assign.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/buffer.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/buffer.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/character.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/command.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/complex-powi.cpp (+7-8)
  • (renamed) FortranRuntime/lib/Runtime/complex-reduction.c (+2-3)
  • (renamed) FortranRuntime/lib/Runtime/complex-reduction.h (+3-4)
  • (renamed) FortranRuntime/lib/Runtime/connection.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/connection.h (+5-5)
  • (renamed) FortranRuntime/lib/Runtime/copy.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/copy.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/derived-api.cpp (+2-3)
  • (renamed) FortranRuntime/lib/Runtime/derived.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/derived.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/descriptor-io.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/descriptor-io.h (+6-6)
  • (renamed) FortranRuntime/lib/Runtime/descriptor.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/dot-product.cpp (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/edit-input.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/edit-input.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/edit-output.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/edit-output.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/emit-encoded.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/environment-default-list.h (+2-3)
  • (renamed) FortranRuntime/lib/Runtime/environment.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/environment.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/exceptions.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/execute.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/extensions.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/external-unit.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/extrema.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/file.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/file.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/findloc.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/format-implementation.h (+5-5)
  • (renamed) FortranRuntime/lib/Runtime/format.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/format.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/inquiry.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/internal-unit.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/internal-unit.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/io-api-common.h (+7-7)
  • (renamed) FortranRuntime/lib/Runtime/io-api-minimal.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/io-api.cpp (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/io-error.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/io-error.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/io-stmt.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/io-stmt.h (+5-5)
  • (renamed) FortranRuntime/lib/Runtime/iostat.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/iso_fortran_env_impl.f90 (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/lock.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/main.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/matmul-transpose.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/matmul.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/memory.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/misc-intrinsic.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/namelist.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/namelist.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/non-tbp-dio.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/non-tbp-dio.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/numeric-templates.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/numeric.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/pointer.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/product.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/pseudo-unit.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/ragged.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/random-templates.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/random.cpp (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/reduce.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/reduction-templates.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/reduction.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/stack.h (+5-5)
  • (renamed) FortranRuntime/lib/Runtime/stat.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/stat.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/stop.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/sum.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/support.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/temporary-stack.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/terminator.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/terminator.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/time-intrinsic.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/tools.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/tools.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/transformational.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/type-code.cpp (+2-1)
  • (renamed) FortranRuntime/lib/Runtime/type-info.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/type-info.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/unit-map.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/unit-map.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/unit.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/unit.h (+7-7)
  • (renamed) FortranRuntime/lib/Runtime/utf.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/utf.h (+2-2)
  • (renamed) FortranRuntime/lib/Testing/fp-testing.cpp (+10-2)
  • (renamed) FortranRuntime/lib/Testing/testing.cpp (+9-1)
  • (renamed) FortranRuntime/test/Driver/ctofortran.f90 ()
  • (renamed) FortranRuntime/test/Driver/exec.f90 ()
  • (renamed) FortranRuntime/test/Runtime/no-cpp-dep.c ()
  • (added) FortranRuntime/unittests/Common/CMakeLists.txt (+11)
  • (renamed) FortranRuntime/unittests/Common/FastIntSetTest.cpp (+2-2)
  • (added) FortranRuntime/unittests/Decimal/CMakeLists.txt (+18)
  • (renamed) FortranRuntime/unittests/Decimal/quick-sanity-test.cpp (+9-1)
  • (renamed) FortranRuntime/unittests/Decimal/thorough-test.cpp (+9-1)
  • (added) FortranRuntime/unittests/Evaluate/CMakeLists.txt (+14)
  • (renamed) FortranRuntime/unittests/Evaluate/ISO-Fortran-binding.cpp (+10-2)
  • (renamed) FortranRuntime/unittests/Evaluate/reshape.cpp (+9-1)
  • (renamed) FortranRuntime/unittests/Runtime/AccessTest.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/Allocatable.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/ArrayConstructor.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/BufferTest.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/CMakeLists.txt (+8)
  • (renamed) FortranRuntime/unittests/Runtime/CUDA/AllocatorCUF.cpp (+3-3)
  • (added) FortranRuntime/unittests/Runtime/CUDA/CMakeLists.txt (+23)
  • (renamed) FortranRuntime/unittests/Runtime/CharacterTest.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/CommandTest.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/Complex.cpp (+1-1)
  • (renamed) FortranRuntime/unittests/Runtime/CrashHandlerFixture.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/CrashHandlerFixture.h (+4-4)
  • (renamed) FortranRuntime/unittests/Runtime/Derived.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/ExternalIOTest.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/Format.cpp (+4-4)
  • (renamed) FortranRuntime/unittests/Runtime/Inquiry.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/ListInputTest.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/LogicalFormatTest.cpp (+1-1)
  • (renamed) FortranRuntime/unittests/Runtime/Matmul.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/MatmulTranspose.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/MiscIntrinsic.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/Namelist.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/Numeric.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/NumericalFormatTest.cpp (+1-1)
  • (renamed) FortranRuntime/unittests/Runtime/Pointer.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/Ragged.cpp (+1-1)
  • (renamed) FortranRuntime/unittests/Runtime/Random.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/Reduction.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/RuntimeCrashTest.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/Stop.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/Support.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/TemporaryStack.cpp (+4-4)
  • (renamed) FortranRuntime/unittests/Runtime/Time.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/Transformational.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/tools.h (+3-3)
  • (modified) flang/CMakeLists.txt (+3-2)
  • (modified) flang/include/flang/Evaluate/call.h (+3-3)
  • (modified) flang/include/flang/Evaluate/characteristics.h (+3-3)
  • (modified) flang/include/flang/Evaluate/common.h (+4-4)
  • (modified) flang/include/flang/Evaluate/constant.h (+2-2)
  • (modified) flang/include/flang/Evaluate/expression.h (+3-3)
  • (modified) flang/include/flang/Evaluate/formatting.h (+1-1)
  • (modified) flang/include/flang/Evaluate/intrinsics.h (+1-1)
  • (modified) flang/include/flang/Evaluate/shape.h (+1-1)
  • (modified) flang/include/flang/Evaluate/target.h (+1-1)
  • (modified) flang/include/flang/Evaluate/tools.h (+2-2)
  • (modified) flang/include/flang/Evaluate/traverse.h (+1-1)
  • (modified) flang/include/flang/Evaluate/type.h (+3-3)
  • (modified) flang/include/flang/Evaluate/variable.h (+2-2)
  • (modified) flang/include/flang/Frontend/FrontendOptions.h (+1-1)
  • (modified) flang/include/flang/ISO_Fortran_binding.h (+6-7)
  • (modified) flang/include/flang/Lower/AbstractConverter.h (+1-1)
  • (modified) flang/include/flang/Lower/Bridge.h (+1-1)
  • (modified) flang/include/flang/Lower/CallInterface.h (+1-1)
  • (modified) flang/include/flang/Lower/ConvertType.h (+1-1)
  • (modified) flang/include/flang/Lower/LoweringOptions.h (+1-1)
  • (modified) flang/include/flang/Lower/PFTBuilder.h (+2-2)
  • (modified) flang/include/flang/Lower/Support/Utils.h (+1-1)
  • (modified) flang/include/flang/Lower/SymbolMap.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Builder/FIRBuilder.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Builder/IntrinsicCall.h (+1)
  • (modified) flang/include/flang/Optimizer/Builder/PPCIntrinsicCall.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h (+1-1)
  • (modified) flang/include/flang/Optimizer/CodeGen/DescriptorModel.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Dialect/CUF/Attributes/CUFAttr.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Support/TypeCode.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Support/Utils.h (+1-1)
  • (modified) flang/include/flang/Parser/char-block.h (+1-1)
  • (modified) flang/include/flang/Parser/dump-parse-tree.h (+2-2)
  • (modified) flang/include/flang/Parser/message.h (+1-1)
  • (modified) flang/include/flang/Parser/parse-state.h (+1-1)
  • (modified) flang/include/flang/Parser/parse-tree.h (+2-2)
  • (modified) flang/include/flang/Parser/parsing.h (+1-1)
  • (modified) flang/include/flang/Parser/provenance.h (+1-1)
diff --git a/FortranRuntime/.clang-format b/FortranRuntime/.clang-format
new file mode 100644
index 00000000000000..c1dfe06fdf5782
--- /dev/null
+++ b/FortranRuntime/.clang-format
@@ -0,0 +1,21 @@
+---
+# See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
+BasedOnStyle: LLVM
+AlignAfterOpenBracket: DontAlign
+AlignEscapedNewlines: DontAlign
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignOperands: false
+AlignTrailingComments: false
+IncludeCategories:
+  - Regex:           '^<'
+    Priority:        4
+  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
+    Priority:        3
+  - Regex:           '^"(flang|\.\.)/'
+    Priority:        2
+  - Regex:           '.*'
+    Priority:        1
+...
+
+# vim:set filetype=yaml:
diff --git a/flang/runtime/config.h.cmake b/FortranRuntime/cmake/config.h.cmake.in
similarity index 100%
rename from flang/runtime/config.h.cmake
rename to FortranRuntime/cmake/config.h.cmake.in
diff --git a/flang/include/flang/Common/Fortran-consts.h b/FortranRuntime/include/flang/Common/Fortran-consts.h
similarity index 100%
rename from flang/include/flang/Common/Fortran-consts.h
rename to FortranRuntime/include/flang/Common/Fortran-consts.h
diff --git a/flang/include/flang/ISO_Fortran_binding_wrapper.h b/FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h
similarity index 70%
rename from flang/include/flang/ISO_Fortran_binding_wrapper.h
rename to FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h
index 37289bdbabd03c..2c0fdc123c8759 100644
--- a/flang/include/flang/ISO_Fortran_binding_wrapper.h
+++ b/FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h
@@ -1,14 +1,13 @@
-/*===-- include/flang/ISO_Fortran_binding_wrapper.h ---------------*- C++ -*-===
+/*===-- include/flang/Common/ISO_Fortran_binding_wrapper.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_ISO_FORTRAN_BINDING_WRAPPER_H_
-#define FORTRAN_ISO_FORTRAN_BINDING_WRAPPER_H_
+#ifndef FORTRAN_COMMON_ISO_FORTRAN_BINDING_WRAPPER_H_
+#define FORTRAN_COMMON_ISO_FORTRAN_BINDING_WRAPPER_H_
 
 /* A thin wrapper around flang/include/ISO_Fortran_binding.h
  * This header file must be included when ISO_Fortran_binding.h
@@ -23,17 +22,17 @@
 
 /* clang-format off */
 #include <stddef.h>
-#include "Common/api-attrs.h"
+#include "flang/Common/api-attrs.h" 
 #ifdef __cplusplus
 namespace Fortran {
 namespace ISO {
 #define FORTRAN_ISO_NAMESPACE_ ::Fortran::ISO
 #endif /* __cplusplus */
-#include "ISO_Fortran_binding.h"
+#include "flang/ISO_Fortran_binding.h"
 #ifdef __cplusplus
 } // namespace ISO
 } // namespace Fortran
 #endif /* __cplusplus */
 /* clang-format on */
 
-#endif /* FORTRAN_ISO_FORTRAN_BINDING_WRAPPER_H_ */
+#endif /* FORTRAN_COMMON_ISO_FORTRAN_BINDING_WRAPPER_H_ */
diff --git a/flang/include/flang/Common/api-attrs.h b/FortranRuntime/include/flang/Common/api-attrs.h
similarity index 97%
rename from flang/include/flang/Common/api-attrs.h
rename to FortranRuntime/include/flang/Common/api-attrs.h
index d73e60996bc81f..9a3001fb255c11 100644
--- a/flang/include/flang/Common/api-attrs.h
+++ b/FortranRuntime/include/flang/Common/api-attrs.h
@@ -1,11 +1,10 @@
-/*===-- include/flang/Common/api-attrs.h ---------------------------*- C -*-=//
+/*===-- include/flang/Common/api-attrs.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
  *
- *===------------------------------------------------------------------------===
- */
+ *===----------------------------------------------------------------------===*/
 
 /*
  * The file defines a set macros that can be used to apply
@@ -13,8 +12,8 @@
  * declared/defined/used in Flang runtime library.
  */
 
-#ifndef FORTRAN_RUNTIME_API_ATTRS_H_
-#define FORTRAN_RUNTIME_API_ATTRS_H_
+#ifndef FORTRAN_COMMON_API_ATTRS_H_
+#define FORTRAN_COMMON_API_ATTRS_H_
 
 /*
  * RT_EXT_API_GROUP_BEGIN/END pair is placed around definitions
@@ -178,4 +177,4 @@
 #define RT_DEVICE_NOINLINE_HOST_INLINE inline
 #endif
 
-#endif /* !FORTRAN_RUNTIME_API_ATTRS_H_ */
+#endif /* FORTRAN_COMMON_API_ATTRS_H_ */
diff --git a/flang/include/flang/Decimal/binary-floating-point.h b/FortranRuntime/include/flang/Common/binary-floating-point.h
similarity index 96%
rename from flang/include/flang/Decimal/binary-floating-point.h
rename to FortranRuntime/include/flang/Common/binary-floating-point.h
index 1e0cde97d98e61..705acc31bdfb21 100644
--- a/flang/include/flang/Decimal/binary-floating-point.h
+++ b/FortranRuntime/include/flang/Common/binary-floating-point.h
@@ -1,4 +1,4 @@
-//===-- include/flang/Decimal/binary-floating-point.h -----------*- C++ -*-===//
+//===-- include/flang/Common/binary-floating-point.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.
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef FORTRAN_DECIMAL_BINARY_FLOATING_POINT_H_
-#define FORTRAN_DECIMAL_BINARY_FLOATING_POINT_H_
+#ifndef FORTRAN_COMMON_BINARY_FLOATING_POINT_H_
+#define FORTRAN_COMMON_BINARY_FLOATING_POINT_H_
 
 // Access and manipulate the fields of an IEEE-754 binary
 // floating-point value via a generalized template.
@@ -208,4 +208,4 @@ template <int BINARY_PRECISION> class BinaryFloatingPointNumber {
   RawType raw_{0};
 };
 } // namespace Fortran::decimal
-#endif
+#endif /* FORTRAN_COMMON_BINARY_FLOATING_POINT_H_ */
diff --git a/flang/include/flang/Common/bit-population-count.h b/FortranRuntime/include/flang/Common/bit-population-count.h
similarity index 98%
rename from flang/include/flang/Common/bit-population-count.h
rename to FortranRuntime/include/flang/Common/bit-population-count.h
index e1aeb78f9a3765..59ade914d14d85 100644
--- a/flang/include/flang/Common/bit-population-count.h
+++ b/FortranRuntime/include/flang/Common/bit-population-count.h
@@ -93,4 +93,4 @@ template <typename INT> inline constexpr int TrailingZeroBitCount(INT x) {
   }
 }
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_BIT_POPULATION_COUNT_H_
+#endif /* FORTRAN_COMMON_BIT_POPULATION_COUNT_H_ */
diff --git a/flang/include/flang/Common/constexpr-bitset.h b/FortranRuntime/include/flang/Common/constexpr-bitset.h
similarity index 98%
rename from flang/include/flang/Common/constexpr-bitset.h
rename to FortranRuntime/include/flang/Common/constexpr-bitset.h
index 1aafb6eff84c61..093b247b5f4eff 100644
--- a/flang/include/flang/Common/constexpr-bitset.h
+++ b/FortranRuntime/include/flang/Common/constexpr-bitset.h
@@ -144,4 +144,4 @@ template <int BITS> class BitSet {
   Word bits_{0};
 };
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_CONSTEXPR_BITSET_H_
+#endif /* FORTRAN_COMMON_CONSTEXPR_BITSET_H_ */
diff --git a/flang/include/flang/Decimal/decimal.h b/FortranRuntime/include/flang/Common/decimal.h
similarity index 95%
rename from flang/include/flang/Decimal/decimal.h
rename to FortranRuntime/include/flang/Common/decimal.h
index 443163d058e28b..c086f97129f6a5 100644
--- a/flang/include/flang/Decimal/decimal.h
+++ b/FortranRuntime/include/flang/Common/decimal.h
@@ -1,16 +1,15 @@
-/*===-- include/flang/Decimal/decimal.h ---------------------------*- C++ -*-===
+/*===-- include/flang/Common/decimal.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
  *
- * ===-----------------------------------------------------------------------===
- */
+ *===----------------------------------------------------------------------===*/
 
 /* C and C++ API for binary-to/from-decimal conversion package. */
 
-#ifndef FORTRAN_DECIMAL_DECIMAL_H_
-#define FORTRAN_DECIMAL_DECIMAL_H_
+#ifndef FORTRAN_COMMON_DECIMAL_H_
+#define FORTRAN_COMMON_DECIMAL_H_
 
 #include "flang/Common/api-attrs.h"
 #include <stddef.h>
@@ -137,4 +136,4 @@ RT_API_ATTRS enum NS(ConversionResultFlags) ConvertDecimalToLongDouble(
 #ifdef __cplusplus
 } // extern "C"
 #endif
-#endif
+#endif /* FORTRAN_COMMON_DECIMAL_H_ */
diff --git a/flang/include/flang/Common/enum-class.h b/FortranRuntime/include/flang/Common/enum-class.h
similarity index 98%
rename from flang/include/flang/Common/enum-class.h
rename to FortranRuntime/include/flang/Common/enum-class.h
index 41575d45091a8d..787648ffec48e8 100644
--- a/flang/include/flang/Common/enum-class.h
+++ b/FortranRuntime/include/flang/Common/enum-class.h
@@ -69,4 +69,4 @@ constexpr std::array<std::string_view, ITEMS> EnumNames(const char *p) {
   }
 
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_ENUM_CLASS_H_
+#endif /* FORTRAN_COMMON_ENUM_CLASS_H_ */
diff --git a/flang/include/flang/Common/enum-set.h b/FortranRuntime/include/flang/Common/enum-set.h
similarity index 99%
rename from flang/include/flang/Common/enum-set.h
rename to FortranRuntime/include/flang/Common/enum-set.h
index 5290b76debee88..6100fc5e2e31c5 100644
--- a/flang/include/flang/Common/enum-set.h
+++ b/FortranRuntime/include/flang/Common/enum-set.h
@@ -228,4 +228,4 @@ struct std::hash<Fortran::common::EnumSet<ENUM, values>> {
     return std::hash(x.bitset());
   }
 };
-#endif // FORTRAN_COMMON_ENUM_SET_H_
+#endif /* FORTRAN_COMMON_ENUM_SET_H_ */
diff --git a/flang/include/flang/Common/fast-int-set.h b/FortranRuntime/include/flang/Common/fast-int-set.h
similarity index 97%
rename from flang/include/flang/Common/fast-int-set.h
rename to FortranRuntime/include/flang/Common/fast-int-set.h
index d1c9c756a44a65..323ee4dc7e94d9 100644
--- a/flang/include/flang/Common/fast-int-set.h
+++ b/FortranRuntime/include/flang/Common/fast-int-set.h
@@ -1,4 +1,4 @@
-//===-- include/flang/Common/fast-int-set.h --------------------*- C++ -*-===//
+//===-- include/flang/Common/fast-int-set.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.
@@ -103,4 +103,4 @@ template <int N> class FastIntSet {
   bool isFullyInitialized_{false}; // memory was cleared
 };
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_FAST_INT_SET_H_
+#endif /* FORTRAN_COMMON_FAST_INT_SET_H_ */
diff --git a/flang/include/flang/Common/float128.h b/FortranRuntime/include/flang/Common/float128.h
similarity index 96%
rename from flang/include/flang/Common/float128.h
rename to FortranRuntime/include/flang/Common/float128.h
index 2e76bc0a162e61..a7036bf679e5ae 100644
--- a/flang/include/flang/Common/float128.h
+++ b/FortranRuntime/include/flang/Common/float128.h
@@ -1,4 +1,4 @@
-/*===-- flang/Common/float128.h ----------------------------------*- C -*-===
+/*===-- include/flang/Common/float128.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.
diff --git a/flang/include/flang/Common/format.h b/FortranRuntime/include/flang/Common/format.h
similarity index 99%
rename from flang/include/flang/Common/format.h
rename to FortranRuntime/include/flang/Common/format.h
index 138e84b72b733d..6f4dfc8d2376b7 100644
--- a/flang/include/flang/Common/format.h
+++ b/FortranRuntime/include/flang/Common/format.h
@@ -901,4 +901,4 @@ template <typename CHAR> bool FormatValidator<CHAR>::Check() {
 }
 
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_FORMAT_H_
+#endif /* FORTRAN_COMMON_FORMAT_H_ */
diff --git a/flang/include/flang/Common/idioms.h b/FortranRuntime/include/flang/Common/idioms.h
similarity index 99%
rename from flang/include/flang/Common/idioms.h
rename to FortranRuntime/include/flang/Common/idioms.h
index 99f383ec75b999..1ae0c0b35112e9 100644
--- a/flang/include/flang/Common/idioms.h
+++ b/FortranRuntime/include/flang/Common/idioms.h
@@ -150,4 +150,4 @@ template <typename A, typename... B>
 using IfNoLvalue = std::enable_if_t<(... && !std::is_lvalue_reference_v<B>), A>;
 template <typename... RVREF> using NoLvalue = IfNoLvalue<void, RVREF...>;
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_IDIOMS_H_
+#endif /* FORTRAN_COMMON_IDIOMS_H_ */
diff --git a/flang/include/flang/Common/leading-zero-bit-count.h b/FortranRuntime/include/flang/Common/leading-zero-bit-count.h
similarity index 98%
rename from flang/include/flang/Common/leading-zero-bit-count.h
rename to FortranRuntime/include/flang/Common/leading-zero-bit-count.h
index a296e0b446917f..e788bfa9bcfd08 100644
--- a/flang/include/flang/Common/leading-zero-bit-count.h
+++ b/FortranRuntime/include/flang/Common/leading-zero-bit-count.h
@@ -93,4 +93,4 @@ template <typename A> inline constexpr int BitsNeededFor(A x) {
   return 8 * sizeof x - LeadingZeroBitCount(x);
 }
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_LEADING_ZERO_BIT_COUNT_H_
+#endif /* FORTRAN_COMMON_LEADING_ZERO_BIT_COUNT_H_ */
diff --git a/flang/include/flang/Runtime/magic-numbers.h b/FortranRuntime/include/flang/Common/magic-numbers.h
similarity index 98%
rename from flang/include/flang/Runtime/magic-numbers.h
rename to FortranRuntime/include/flang/Common/magic-numbers.h
index bab0e9ae05299a..931df690766219 100644
--- a/flang/include/flang/Runtime/magic-numbers.h
+++ b/FortranRuntime/include/flang/Common/magic-numbers.h
@@ -1,10 +1,10 @@
-#if 0 /*===-- include/flang/Runtime/magic-numbers.h -----------------------===*/
-/*
+#if 0 /*===-- include/flang/Runtime/magic-numbers.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
  *
- *===----------------------------------------------------------------------===*/
+/*===----------------------------------------------------------------------===*/
 #endif
 #if 0
 This header can be included into both Fortran and C.
diff --git a/flang/include/flang/Common/optional.h b/FortranRuntime/include/flang/Common/optional.h
similarity index 98%
rename from flang/include/flang/Common/optional.h
rename to FortranRuntime/include/flang/Common/optional.h
index c0f4278009f40a..c3db3b1329a2fd 100644
--- a/flang/include/flang/Common/optional.h
+++ b/FortranRuntime/include/flang/Common/optional.h
@@ -23,8 +23,8 @@
 //   * cuda:: namespace need to be forced for all std:: references.
 //
 //===----------------------------------------------------------------------===//
-#ifndef FORTRAN_COMMON_OPTIONAL_H
-#define FORTRAN_COMMON_OPTIONAL_H
+#ifndef FORTRAN_COMMON_OPTIONAL_H_
+#define FORTRAN_COMMON_OPTIONAL_H_
 
 #include "flang/Common/api-attrs.h"
 #include <optional>
@@ -240,4 +240,4 @@ using std::optional;
 
 } // namespace Fortran::common
 
-#endif // FORTRAN_COMMON_OPTIONAL_H
+#endif /* FORTRAN_COMMON_OPTIONAL_H_ */
diff --git a/flang/include/flang/Common/real.h b/FortranRuntime/include/flang/Common/real.h
similarity index 99%
rename from flang/include/flang/Common/real.h
rename to FortranRuntime/include/flang/Common/real.h
index b527deda0e3b4f..dc9a2404731e70 100644
--- a/flang/include/flang/Common/real.h
+++ b/FortranRuntime/include/flang/Common/real.h
@@ -141,4 +141,4 @@ class RealCharacteristics {
 };
 
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_REAL_H_
+#endif /* FORTRAN_COMMON_REAL_H_ */
diff --git a/flang/include/flang/Common/reference-wrapper.h b/FortranRuntime/include/flang/Common/reference-wrapper.h
similarity index 96%
rename from flang/include/flang/Common/reference-wrapper.h
rename to FortranRuntime/include/flang/Common/reference-wrapper.h
index 2983754108f95a..6822fb335f398c 100644
--- a/flang/include/flang/Common/reference-wrapper.h
+++ b/FortranRuntime/include/flang/Common/reference-wrapper.h
@@ -22,8 +22,8 @@
 //
 // clang-format on
 
-#ifndef FORTRAN_COMMON_REFERENCE_WRAPPER_H
-#define FORTRAN_COMMON_REFERENCE_WRAPPER_H
+#ifndef FORTRAN_COMMON_REFERENCE_WRAPPER_H_
+#define FORTRAN_COMMON_REFERENCE_WRAPPER_H_
 
 #include "flang/Common/api-attrs.h"
 #include <functional>
@@ -111,4 +111,4 @@ using std::reference_wrapper;
 
 } // namespace Fortran::common
 
-#endif // FORTRAN_COMMON_REFERENCE_WRAPPER_H
+#endif /* FORTRAN_COMMON_REFERENCE_WRAPPER_H_ */
diff --git a/flang/include/flang/Common/restorer.h b/FortranRuntime/include/flang/Common/restorer.h
similarity index 97%
rename from flang/include/flang/Common/restorer.h
rename to FortranRuntime/include/flang/Common/restorer.h
index 0f1bc48620d37e..a5c5ebe7344a1b 100644
--- a/flang/include/flang/Common/restorer.h
+++ b/FortranRuntime/include/flang/Common/restorer.h
@@ -18,8 +18,8 @@
 
 #ifndef FORTRAN_COMMON_RESTORER_H_
 #define FORTRAN_COMMON_RESTORER_H_
-#include "idioms.h"
 #include "flang/Common/api-attrs.h"
+#include "idioms.h"
 namespace Fortran::common {
 template <typename A> class Restorer {
 public:
@@ -53,4 +53,4 @@ RT_API_ATTRS common::IfNoLvalue<Restorer<A>, B> ScopedSet(
   return Restorer<A>{to, std::move(original)};
 }
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_RESTORER_H_
+#endif /* FORTRAN_COMMON_RESTORER_H_ */
diff --git a/flang/include/flang/Common/target-rounding.h b/FortranRuntime/include/flang/Common/target-rounding.h
similarity index 100%
rename from flang/include/flang/Common/target-rounding.h
rename to FortranRuntime/include/flang/Common/target-rounding.h
diff --git a/flang/include/flang/Common/uint128.h b/FortranRuntime/include/flang/Common/uint128.h
similarity index 99%
rename from flang/include/flang/Common/uint128.h
rename to FortranRuntime/include/flang/Common/uint128.h
index 821c8c3b08a52f..1b2ee6a2c14b87 100644
--- a/flang/include/flang/Common/uint128.h
+++ b/FortranRuntime/include/flang/Common/uint128.h
@@ -19,8 +19,8 @@
 #define AVOID_NATIVE_UINT128_T 0
 #endif
 
-#include "leading-zero-bit-count.h"
 #include "flang/Common/api-attrs.h"
+#include "leading-zero-bit-count.h"
 #include <cstdint>
 #include <type_traits>
 
@@ -303,4 +303,4 @@ template <int BITS>
 using HostSignedIntType = typename HostSignedIntTypeHelper<BITS>::type;
 
 } // namespace Fortran::common
-#endif
+#endif /* FORTRAN_COMMON_UINT128_H_ */
diff --git a/flang/include/flang/Common/variant.h b/FortranRuntime/include/flang/Common/variant.h
similarity index 89%
rename from flang/include/flang/Common/variant.h
rename to FortranRuntime/include/flang/Common/variant.h
index 1af85876afac00..ff9b1aed4eba91 100644
--- a/flang/include/flang/Common/variant.h
+++ b/FortranRuntime/include/flang/Common/variant.h
@@ -11,8 +11,8 @@
 // and the related names become available, though, they may correspond
 // to alternative definitions (e.g. from cuda::std namespace).
 
-#ifndef FORTRAN_COMMON_VARIANT_H
-#define FORTRAN_COMMON_VARIANT_H
+#ifndef FORTRAN_COMMON_VARIANT_H_
+#define FORTRAN_COMMON_VARIANT_H_
 
 #if RT_USE_LIBCUDACXX
 #include <cuda/std/variant>
@@ -27,4 +27,4 @@ using cuda::std::visit;
 #include <variant>
 #endif // !RT_USE_LIBCUDACXX
 
-#endif // FORTRAN_COMMON_VARIANT_H
+#endif /* FORTRAN_COMMON_VARIANT_H_ */
diff --git a/flang/include/flang/Common/visit.h b/FortranRuntime/include/flang/Common/visit.h
similarity index 98%
rename from flang/include/flang/Common/visit.h
rename to FortranRuntime/include/flang/Common/visit.h
index ad66297650b093..8030ac9be173c3 100644
--- a/flang/include/flang/Common/visit.h
+++ b/FortranRuntime/include/flang/Common/visit.h
@@ -21,8 +21,8 @@
 #ifndef FORTRAN_COMMON_VISIT_H_
 #define FORTRAN_COMMON_VISIT_H_
 
-#include "variant.h"
 #include "flang/Common/api-attrs.h"
+#include "variant.h"
 #include <type_traits>
 
 namespace Fortran::common {
@@ -100,4 +100,4 @@ using Fortran::common::log2visit::visit;
 #endif
 
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_VISIT_H_
+#endif /* FORTRAN_COMMON_VISIT_H_ */
diff --git a/flang/include/flang/Common/windows-include.h b/FortranRuntime/include/flang/Common/windows-include.h
similarity index 93%
rename from flang/includ...
[truncated]

@llvmbot
Copy link
Member

llvmbot commented Oct 7, 2024

@llvm/pr-subscribers-flang-parser

Author: Michael Kruse (Meinersbur)

Changes

Mostly mechanical changes in preparation of extracting the FortranRuntime "subproject" in #110217. This PR intends to only move pre-existing files to the new folder structure, with no behavioral change.

Common and Testing are the directories shared by FortranRuntime and Flang. Runtime and module are going to be used by FortranRuntime only. Files in Common that are used only by Flang are moved into Support.

Some cosmetic changes and files paths were necessary:

  • Relative paths to the new path for the source files and add_subdirectory.
  • Add the new location's include directory to include_directories
  • The unittest/Evaluate directory has unitests for FortranRuntime and Flang. A new CMakeLists.txt was introduced for the FortranRuntime tests.
  • Change the of the #include paths relative to the include directive
  • clang-format on the #include directives
  • Since the paths is part if the copyright header and include guards, a script was used to canonicalize those
  • test/Runtime and runtime tests in test/Driver are moved, but the lit.cfg.py mechanism to execute the will only be added in #110217.

Patch is 334.25 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/110298.diff

418 Files Affected:

  • (added) FortranRuntime/.clang-format (+21)
  • (renamed) FortranRuntime/cmake/config.h.cmake.in ()
  • (renamed) FortranRuntime/include/flang/Common/Fortran-consts.h ()
  • (renamed) FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h (+7-8)
  • (renamed) FortranRuntime/include/flang/Common/api-attrs.h (+5-6)
  • (renamed) FortranRuntime/include/flang/Common/binary-floating-point.h (+4-4)
  • (renamed) FortranRuntime/include/flang/Common/bit-population-count.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/constexpr-bitset.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/decimal.h (+5-6)
  • (renamed) FortranRuntime/include/flang/Common/enum-class.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/enum-set.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/fast-int-set.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Common/float128.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/format.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/idioms.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/leading-zero-bit-count.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/magic-numbers.h (+3-3)
  • (renamed) FortranRuntime/include/flang/Common/optional.h (+3-3)
  • (renamed) FortranRuntime/include/flang/Common/real.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/reference-wrapper.h (+3-3)
  • (renamed) FortranRuntime/include/flang/Common/restorer.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Common/target-rounding.h ()
  • (renamed) FortranRuntime/include/flang/Common/uint128.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Common/variant.h (+3-3)
  • (renamed) FortranRuntime/include/flang/Common/visit.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Common/windows-include.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/CUDA/allocator.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/CUDA/descriptor.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/allocatable.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/allocator-registry.h (+4-4)
  • (renamed) FortranRuntime/include/flang/Runtime/array-constructor.h (+3-3)
  • (renamed) FortranRuntime/include/flang/Runtime/assign.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/c-or-cpp.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/character.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/command.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/cpp-type.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/derived-api.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/descriptor.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/entry-names.h (+5-6)
  • (renamed) FortranRuntime/include/flang/Runtime/exceptions.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/execute.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/extensions.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/freestanding-tools.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/inquiry.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/io-api.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/iostat.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/main.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/matmul-instances.inc ()
  • (renamed) FortranRuntime/include/flang/Runtime/matmul-transpose.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/matmul.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/memory.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/misc-intrinsic.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/numeric.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/pointer.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/ragged.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/random.h (+5)
  • (renamed) FortranRuntime/include/flang/Runtime/reduce.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/reduction.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/stop.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/support.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/temporary-stack.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/time-intrinsic.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/transformational.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/type-code.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Testing/fp-testing.h (+11-3)
  • (renamed) FortranRuntime/include/flang/Testing/testing.h (+11-3)
  • (renamed) FortranRuntime/lib/Common/big-radix-floating-point.h (+6-6)
  • (renamed) FortranRuntime/lib/Common/binary-to-decimal.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Common/decimal-to-binary.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/CMakeLists.txt (+5-4)
  • (renamed) FortranRuntime/lib/Runtime/CUDA/CMakeLists.txt (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/CUDA/allocator.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/CUDA/descriptor.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/CMakeLists.txt (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/acos.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/acosh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/asin.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/asinh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/atan.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/atan2.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/atanh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/ceil.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/complex-math.c (+2-3)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/complex-math.h (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/cos.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/cosh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/erf.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/erfc.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/exp.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/exponent.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/floor.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/fma.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/fraction.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/hypot.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/j0.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/j1.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/jn.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/lgamma.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/llround.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/log.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/log10.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/lround.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/math-entries.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/mod-real.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/modulo-real.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/nearest.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/norm2.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/numeric-template-specs.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/pow.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/random.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/round.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/rrspacing.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/scale.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/set-exponent.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/sin.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/sinh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/spacing.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/sqrt.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/tan.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/tanh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/tgamma.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/trunc.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/y0.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/y1.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/yn.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/ISO_Fortran_binding.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/ISO_Fortran_util.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/allocatable.cpp (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/allocator-registry.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/array-constructor.cpp (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/assign-impl.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/assign.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/buffer.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/buffer.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/character.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/command.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/complex-powi.cpp (+7-8)
  • (renamed) FortranRuntime/lib/Runtime/complex-reduction.c (+2-3)
  • (renamed) FortranRuntime/lib/Runtime/complex-reduction.h (+3-4)
  • (renamed) FortranRuntime/lib/Runtime/connection.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/connection.h (+5-5)
  • (renamed) FortranRuntime/lib/Runtime/copy.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/copy.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/derived-api.cpp (+2-3)
  • (renamed) FortranRuntime/lib/Runtime/derived.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/derived.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/descriptor-io.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/descriptor-io.h (+6-6)
  • (renamed) FortranRuntime/lib/Runtime/descriptor.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/dot-product.cpp (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/edit-input.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/edit-input.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/edit-output.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/edit-output.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/emit-encoded.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/environment-default-list.h (+2-3)
  • (renamed) FortranRuntime/lib/Runtime/environment.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/environment.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/exceptions.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/execute.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/extensions.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/external-unit.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/extrema.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/file.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/file.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/findloc.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/format-implementation.h (+5-5)
  • (renamed) FortranRuntime/lib/Runtime/format.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/format.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/inquiry.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/internal-unit.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/internal-unit.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/io-api-common.h (+7-7)
  • (renamed) FortranRuntime/lib/Runtime/io-api-minimal.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/io-api.cpp (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/io-error.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/io-error.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/io-stmt.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/io-stmt.h (+5-5)
  • (renamed) FortranRuntime/lib/Runtime/iostat.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/iso_fortran_env_impl.f90 (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/lock.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/main.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/matmul-transpose.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/matmul.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/memory.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/misc-intrinsic.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/namelist.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/namelist.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/non-tbp-dio.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/non-tbp-dio.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/numeric-templates.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/numeric.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/pointer.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/product.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/pseudo-unit.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/ragged.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/random-templates.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/random.cpp (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/reduce.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/reduction-templates.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/reduction.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/stack.h (+5-5)
  • (renamed) FortranRuntime/lib/Runtime/stat.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/stat.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/stop.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/sum.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/support.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/temporary-stack.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/terminator.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/terminator.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/time-intrinsic.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/tools.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/tools.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/transformational.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/type-code.cpp (+2-1)
  • (renamed) FortranRuntime/lib/Runtime/type-info.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/type-info.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/unit-map.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/unit-map.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/unit.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/unit.h (+7-7)
  • (renamed) FortranRuntime/lib/Runtime/utf.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/utf.h (+2-2)
  • (renamed) FortranRuntime/lib/Testing/fp-testing.cpp (+10-2)
  • (renamed) FortranRuntime/lib/Testing/testing.cpp (+9-1)
  • (renamed) FortranRuntime/test/Driver/ctofortran.f90 ()
  • (renamed) FortranRuntime/test/Driver/exec.f90 ()
  • (renamed) FortranRuntime/test/Runtime/no-cpp-dep.c ()
  • (added) FortranRuntime/unittests/Common/CMakeLists.txt (+11)
  • (renamed) FortranRuntime/unittests/Common/FastIntSetTest.cpp (+2-2)
  • (added) FortranRuntime/unittests/Decimal/CMakeLists.txt (+18)
  • (renamed) FortranRuntime/unittests/Decimal/quick-sanity-test.cpp (+9-1)
  • (renamed) FortranRuntime/unittests/Decimal/thorough-test.cpp (+9-1)
  • (added) FortranRuntime/unittests/Evaluate/CMakeLists.txt (+14)
  • (renamed) FortranRuntime/unittests/Evaluate/ISO-Fortran-binding.cpp (+10-2)
  • (renamed) FortranRuntime/unittests/Evaluate/reshape.cpp (+9-1)
  • (renamed) FortranRuntime/unittests/Runtime/AccessTest.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/Allocatable.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/ArrayConstructor.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/BufferTest.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/CMakeLists.txt (+8)
  • (renamed) FortranRuntime/unittests/Runtime/CUDA/AllocatorCUF.cpp (+3-3)
  • (added) FortranRuntime/unittests/Runtime/CUDA/CMakeLists.txt (+23)
  • (renamed) FortranRuntime/unittests/Runtime/CharacterTest.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/CommandTest.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/Complex.cpp (+1-1)
  • (renamed) FortranRuntime/unittests/Runtime/CrashHandlerFixture.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/CrashHandlerFixture.h (+4-4)
  • (renamed) FortranRuntime/unittests/Runtime/Derived.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/ExternalIOTest.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/Format.cpp (+4-4)
  • (renamed) FortranRuntime/unittests/Runtime/Inquiry.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/ListInputTest.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/LogicalFormatTest.cpp (+1-1)
  • (renamed) FortranRuntime/unittests/Runtime/Matmul.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/MatmulTranspose.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/MiscIntrinsic.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/Namelist.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/Numeric.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/NumericalFormatTest.cpp (+1-1)
  • (renamed) FortranRuntime/unittests/Runtime/Pointer.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/Ragged.cpp (+1-1)
  • (renamed) FortranRuntime/unittests/Runtime/Random.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/Reduction.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/RuntimeCrashTest.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/Stop.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/Support.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/TemporaryStack.cpp (+4-4)
  • (renamed) FortranRuntime/unittests/Runtime/Time.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/Transformational.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/tools.h (+3-3)
  • (modified) flang/CMakeLists.txt (+3-2)
  • (modified) flang/include/flang/Evaluate/call.h (+3-3)
  • (modified) flang/include/flang/Evaluate/characteristics.h (+3-3)
  • (modified) flang/include/flang/Evaluate/common.h (+4-4)
  • (modified) flang/include/flang/Evaluate/constant.h (+2-2)
  • (modified) flang/include/flang/Evaluate/expression.h (+3-3)
  • (modified) flang/include/flang/Evaluate/formatting.h (+1-1)
  • (modified) flang/include/flang/Evaluate/intrinsics.h (+1-1)
  • (modified) flang/include/flang/Evaluate/shape.h (+1-1)
  • (modified) flang/include/flang/Evaluate/target.h (+1-1)
  • (modified) flang/include/flang/Evaluate/tools.h (+2-2)
  • (modified) flang/include/flang/Evaluate/traverse.h (+1-1)
  • (modified) flang/include/flang/Evaluate/type.h (+3-3)
  • (modified) flang/include/flang/Evaluate/variable.h (+2-2)
  • (modified) flang/include/flang/Frontend/FrontendOptions.h (+1-1)
  • (modified) flang/include/flang/ISO_Fortran_binding.h (+6-7)
  • (modified) flang/include/flang/Lower/AbstractConverter.h (+1-1)
  • (modified) flang/include/flang/Lower/Bridge.h (+1-1)
  • (modified) flang/include/flang/Lower/CallInterface.h (+1-1)
  • (modified) flang/include/flang/Lower/ConvertType.h (+1-1)
  • (modified) flang/include/flang/Lower/LoweringOptions.h (+1-1)
  • (modified) flang/include/flang/Lower/PFTBuilder.h (+2-2)
  • (modified) flang/include/flang/Lower/Support/Utils.h (+1-1)
  • (modified) flang/include/flang/Lower/SymbolMap.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Builder/FIRBuilder.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Builder/IntrinsicCall.h (+1)
  • (modified) flang/include/flang/Optimizer/Builder/PPCIntrinsicCall.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h (+1-1)
  • (modified) flang/include/flang/Optimizer/CodeGen/DescriptorModel.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Dialect/CUF/Attributes/CUFAttr.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Support/TypeCode.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Support/Utils.h (+1-1)
  • (modified) flang/include/flang/Parser/char-block.h (+1-1)
  • (modified) flang/include/flang/Parser/dump-parse-tree.h (+2-2)
  • (modified) flang/include/flang/Parser/message.h (+1-1)
  • (modified) flang/include/flang/Parser/parse-state.h (+1-1)
  • (modified) flang/include/flang/Parser/parse-tree.h (+2-2)
  • (modified) flang/include/flang/Parser/parsing.h (+1-1)
  • (modified) flang/include/flang/Parser/provenance.h (+1-1)
diff --git a/FortranRuntime/.clang-format b/FortranRuntime/.clang-format
new file mode 100644
index 00000000000000..c1dfe06fdf5782
--- /dev/null
+++ b/FortranRuntime/.clang-format
@@ -0,0 +1,21 @@
+---
+# See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
+BasedOnStyle: LLVM
+AlignAfterOpenBracket: DontAlign
+AlignEscapedNewlines: DontAlign
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignOperands: false
+AlignTrailingComments: false
+IncludeCategories:
+  - Regex:           '^<'
+    Priority:        4
+  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
+    Priority:        3
+  - Regex:           '^"(flang|\.\.)/'
+    Priority:        2
+  - Regex:           '.*'
+    Priority:        1
+...
+
+# vim:set filetype=yaml:
diff --git a/flang/runtime/config.h.cmake b/FortranRuntime/cmake/config.h.cmake.in
similarity index 100%
rename from flang/runtime/config.h.cmake
rename to FortranRuntime/cmake/config.h.cmake.in
diff --git a/flang/include/flang/Common/Fortran-consts.h b/FortranRuntime/include/flang/Common/Fortran-consts.h
similarity index 100%
rename from flang/include/flang/Common/Fortran-consts.h
rename to FortranRuntime/include/flang/Common/Fortran-consts.h
diff --git a/flang/include/flang/ISO_Fortran_binding_wrapper.h b/FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h
similarity index 70%
rename from flang/include/flang/ISO_Fortran_binding_wrapper.h
rename to FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h
index 37289bdbabd03c..2c0fdc123c8759 100644
--- a/flang/include/flang/ISO_Fortran_binding_wrapper.h
+++ b/FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h
@@ -1,14 +1,13 @@
-/*===-- include/flang/ISO_Fortran_binding_wrapper.h ---------------*- C++ -*-===
+/*===-- include/flang/Common/ISO_Fortran_binding_wrapper.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_ISO_FORTRAN_BINDING_WRAPPER_H_
-#define FORTRAN_ISO_FORTRAN_BINDING_WRAPPER_H_
+#ifndef FORTRAN_COMMON_ISO_FORTRAN_BINDING_WRAPPER_H_
+#define FORTRAN_COMMON_ISO_FORTRAN_BINDING_WRAPPER_H_
 
 /* A thin wrapper around flang/include/ISO_Fortran_binding.h
  * This header file must be included when ISO_Fortran_binding.h
@@ -23,17 +22,17 @@
 
 /* clang-format off */
 #include <stddef.h>
-#include "Common/api-attrs.h"
+#include "flang/Common/api-attrs.h" 
 #ifdef __cplusplus
 namespace Fortran {
 namespace ISO {
 #define FORTRAN_ISO_NAMESPACE_ ::Fortran::ISO
 #endif /* __cplusplus */
-#include "ISO_Fortran_binding.h"
+#include "flang/ISO_Fortran_binding.h"
 #ifdef __cplusplus
 } // namespace ISO
 } // namespace Fortran
 #endif /* __cplusplus */
 /* clang-format on */
 
-#endif /* FORTRAN_ISO_FORTRAN_BINDING_WRAPPER_H_ */
+#endif /* FORTRAN_COMMON_ISO_FORTRAN_BINDING_WRAPPER_H_ */
diff --git a/flang/include/flang/Common/api-attrs.h b/FortranRuntime/include/flang/Common/api-attrs.h
similarity index 97%
rename from flang/include/flang/Common/api-attrs.h
rename to FortranRuntime/include/flang/Common/api-attrs.h
index d73e60996bc81f..9a3001fb255c11 100644
--- a/flang/include/flang/Common/api-attrs.h
+++ b/FortranRuntime/include/flang/Common/api-attrs.h
@@ -1,11 +1,10 @@
-/*===-- include/flang/Common/api-attrs.h ---------------------------*- C -*-=//
+/*===-- include/flang/Common/api-attrs.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
  *
- *===------------------------------------------------------------------------===
- */
+ *===----------------------------------------------------------------------===*/
 
 /*
  * The file defines a set macros that can be used to apply
@@ -13,8 +12,8 @@
  * declared/defined/used in Flang runtime library.
  */
 
-#ifndef FORTRAN_RUNTIME_API_ATTRS_H_
-#define FORTRAN_RUNTIME_API_ATTRS_H_
+#ifndef FORTRAN_COMMON_API_ATTRS_H_
+#define FORTRAN_COMMON_API_ATTRS_H_
 
 /*
  * RT_EXT_API_GROUP_BEGIN/END pair is placed around definitions
@@ -178,4 +177,4 @@
 #define RT_DEVICE_NOINLINE_HOST_INLINE inline
 #endif
 
-#endif /* !FORTRAN_RUNTIME_API_ATTRS_H_ */
+#endif /* FORTRAN_COMMON_API_ATTRS_H_ */
diff --git a/flang/include/flang/Decimal/binary-floating-point.h b/FortranRuntime/include/flang/Common/binary-floating-point.h
similarity index 96%
rename from flang/include/flang/Decimal/binary-floating-point.h
rename to FortranRuntime/include/flang/Common/binary-floating-point.h
index 1e0cde97d98e61..705acc31bdfb21 100644
--- a/flang/include/flang/Decimal/binary-floating-point.h
+++ b/FortranRuntime/include/flang/Common/binary-floating-point.h
@@ -1,4 +1,4 @@
-//===-- include/flang/Decimal/binary-floating-point.h -----------*- C++ -*-===//
+//===-- include/flang/Common/binary-floating-point.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.
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef FORTRAN_DECIMAL_BINARY_FLOATING_POINT_H_
-#define FORTRAN_DECIMAL_BINARY_FLOATING_POINT_H_
+#ifndef FORTRAN_COMMON_BINARY_FLOATING_POINT_H_
+#define FORTRAN_COMMON_BINARY_FLOATING_POINT_H_
 
 // Access and manipulate the fields of an IEEE-754 binary
 // floating-point value via a generalized template.
@@ -208,4 +208,4 @@ template <int BINARY_PRECISION> class BinaryFloatingPointNumber {
   RawType raw_{0};
 };
 } // namespace Fortran::decimal
-#endif
+#endif /* FORTRAN_COMMON_BINARY_FLOATING_POINT_H_ */
diff --git a/flang/include/flang/Common/bit-population-count.h b/FortranRuntime/include/flang/Common/bit-population-count.h
similarity index 98%
rename from flang/include/flang/Common/bit-population-count.h
rename to FortranRuntime/include/flang/Common/bit-population-count.h
index e1aeb78f9a3765..59ade914d14d85 100644
--- a/flang/include/flang/Common/bit-population-count.h
+++ b/FortranRuntime/include/flang/Common/bit-population-count.h
@@ -93,4 +93,4 @@ template <typename INT> inline constexpr int TrailingZeroBitCount(INT x) {
   }
 }
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_BIT_POPULATION_COUNT_H_
+#endif /* FORTRAN_COMMON_BIT_POPULATION_COUNT_H_ */
diff --git a/flang/include/flang/Common/constexpr-bitset.h b/FortranRuntime/include/flang/Common/constexpr-bitset.h
similarity index 98%
rename from flang/include/flang/Common/constexpr-bitset.h
rename to FortranRuntime/include/flang/Common/constexpr-bitset.h
index 1aafb6eff84c61..093b247b5f4eff 100644
--- a/flang/include/flang/Common/constexpr-bitset.h
+++ b/FortranRuntime/include/flang/Common/constexpr-bitset.h
@@ -144,4 +144,4 @@ template <int BITS> class BitSet {
   Word bits_{0};
 };
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_CONSTEXPR_BITSET_H_
+#endif /* FORTRAN_COMMON_CONSTEXPR_BITSET_H_ */
diff --git a/flang/include/flang/Decimal/decimal.h b/FortranRuntime/include/flang/Common/decimal.h
similarity index 95%
rename from flang/include/flang/Decimal/decimal.h
rename to FortranRuntime/include/flang/Common/decimal.h
index 443163d058e28b..c086f97129f6a5 100644
--- a/flang/include/flang/Decimal/decimal.h
+++ b/FortranRuntime/include/flang/Common/decimal.h
@@ -1,16 +1,15 @@
-/*===-- include/flang/Decimal/decimal.h ---------------------------*- C++ -*-===
+/*===-- include/flang/Common/decimal.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
  *
- * ===-----------------------------------------------------------------------===
- */
+ *===----------------------------------------------------------------------===*/
 
 /* C and C++ API for binary-to/from-decimal conversion package. */
 
-#ifndef FORTRAN_DECIMAL_DECIMAL_H_
-#define FORTRAN_DECIMAL_DECIMAL_H_
+#ifndef FORTRAN_COMMON_DECIMAL_H_
+#define FORTRAN_COMMON_DECIMAL_H_
 
 #include "flang/Common/api-attrs.h"
 #include <stddef.h>
@@ -137,4 +136,4 @@ RT_API_ATTRS enum NS(ConversionResultFlags) ConvertDecimalToLongDouble(
 #ifdef __cplusplus
 } // extern "C"
 #endif
-#endif
+#endif /* FORTRAN_COMMON_DECIMAL_H_ */
diff --git a/flang/include/flang/Common/enum-class.h b/FortranRuntime/include/flang/Common/enum-class.h
similarity index 98%
rename from flang/include/flang/Common/enum-class.h
rename to FortranRuntime/include/flang/Common/enum-class.h
index 41575d45091a8d..787648ffec48e8 100644
--- a/flang/include/flang/Common/enum-class.h
+++ b/FortranRuntime/include/flang/Common/enum-class.h
@@ -69,4 +69,4 @@ constexpr std::array<std::string_view, ITEMS> EnumNames(const char *p) {
   }
 
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_ENUM_CLASS_H_
+#endif /* FORTRAN_COMMON_ENUM_CLASS_H_ */
diff --git a/flang/include/flang/Common/enum-set.h b/FortranRuntime/include/flang/Common/enum-set.h
similarity index 99%
rename from flang/include/flang/Common/enum-set.h
rename to FortranRuntime/include/flang/Common/enum-set.h
index 5290b76debee88..6100fc5e2e31c5 100644
--- a/flang/include/flang/Common/enum-set.h
+++ b/FortranRuntime/include/flang/Common/enum-set.h
@@ -228,4 +228,4 @@ struct std::hash<Fortran::common::EnumSet<ENUM, values>> {
     return std::hash(x.bitset());
   }
 };
-#endif // FORTRAN_COMMON_ENUM_SET_H_
+#endif /* FORTRAN_COMMON_ENUM_SET_H_ */
diff --git a/flang/include/flang/Common/fast-int-set.h b/FortranRuntime/include/flang/Common/fast-int-set.h
similarity index 97%
rename from flang/include/flang/Common/fast-int-set.h
rename to FortranRuntime/include/flang/Common/fast-int-set.h
index d1c9c756a44a65..323ee4dc7e94d9 100644
--- a/flang/include/flang/Common/fast-int-set.h
+++ b/FortranRuntime/include/flang/Common/fast-int-set.h
@@ -1,4 +1,4 @@
-//===-- include/flang/Common/fast-int-set.h --------------------*- C++ -*-===//
+//===-- include/flang/Common/fast-int-set.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.
@@ -103,4 +103,4 @@ template <int N> class FastIntSet {
   bool isFullyInitialized_{false}; // memory was cleared
 };
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_FAST_INT_SET_H_
+#endif /* FORTRAN_COMMON_FAST_INT_SET_H_ */
diff --git a/flang/include/flang/Common/float128.h b/FortranRuntime/include/flang/Common/float128.h
similarity index 96%
rename from flang/include/flang/Common/float128.h
rename to FortranRuntime/include/flang/Common/float128.h
index 2e76bc0a162e61..a7036bf679e5ae 100644
--- a/flang/include/flang/Common/float128.h
+++ b/FortranRuntime/include/flang/Common/float128.h
@@ -1,4 +1,4 @@
-/*===-- flang/Common/float128.h ----------------------------------*- C -*-===
+/*===-- include/flang/Common/float128.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.
diff --git a/flang/include/flang/Common/format.h b/FortranRuntime/include/flang/Common/format.h
similarity index 99%
rename from flang/include/flang/Common/format.h
rename to FortranRuntime/include/flang/Common/format.h
index 138e84b72b733d..6f4dfc8d2376b7 100644
--- a/flang/include/flang/Common/format.h
+++ b/FortranRuntime/include/flang/Common/format.h
@@ -901,4 +901,4 @@ template <typename CHAR> bool FormatValidator<CHAR>::Check() {
 }
 
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_FORMAT_H_
+#endif /* FORTRAN_COMMON_FORMAT_H_ */
diff --git a/flang/include/flang/Common/idioms.h b/FortranRuntime/include/flang/Common/idioms.h
similarity index 99%
rename from flang/include/flang/Common/idioms.h
rename to FortranRuntime/include/flang/Common/idioms.h
index 99f383ec75b999..1ae0c0b35112e9 100644
--- a/flang/include/flang/Common/idioms.h
+++ b/FortranRuntime/include/flang/Common/idioms.h
@@ -150,4 +150,4 @@ template <typename A, typename... B>
 using IfNoLvalue = std::enable_if_t<(... && !std::is_lvalue_reference_v<B>), A>;
 template <typename... RVREF> using NoLvalue = IfNoLvalue<void, RVREF...>;
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_IDIOMS_H_
+#endif /* FORTRAN_COMMON_IDIOMS_H_ */
diff --git a/flang/include/flang/Common/leading-zero-bit-count.h b/FortranRuntime/include/flang/Common/leading-zero-bit-count.h
similarity index 98%
rename from flang/include/flang/Common/leading-zero-bit-count.h
rename to FortranRuntime/include/flang/Common/leading-zero-bit-count.h
index a296e0b446917f..e788bfa9bcfd08 100644
--- a/flang/include/flang/Common/leading-zero-bit-count.h
+++ b/FortranRuntime/include/flang/Common/leading-zero-bit-count.h
@@ -93,4 +93,4 @@ template <typename A> inline constexpr int BitsNeededFor(A x) {
   return 8 * sizeof x - LeadingZeroBitCount(x);
 }
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_LEADING_ZERO_BIT_COUNT_H_
+#endif /* FORTRAN_COMMON_LEADING_ZERO_BIT_COUNT_H_ */
diff --git a/flang/include/flang/Runtime/magic-numbers.h b/FortranRuntime/include/flang/Common/magic-numbers.h
similarity index 98%
rename from flang/include/flang/Runtime/magic-numbers.h
rename to FortranRuntime/include/flang/Common/magic-numbers.h
index bab0e9ae05299a..931df690766219 100644
--- a/flang/include/flang/Runtime/magic-numbers.h
+++ b/FortranRuntime/include/flang/Common/magic-numbers.h
@@ -1,10 +1,10 @@
-#if 0 /*===-- include/flang/Runtime/magic-numbers.h -----------------------===*/
-/*
+#if 0 /*===-- include/flang/Runtime/magic-numbers.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
  *
- *===----------------------------------------------------------------------===*/
+/*===----------------------------------------------------------------------===*/
 #endif
 #if 0
 This header can be included into both Fortran and C.
diff --git a/flang/include/flang/Common/optional.h b/FortranRuntime/include/flang/Common/optional.h
similarity index 98%
rename from flang/include/flang/Common/optional.h
rename to FortranRuntime/include/flang/Common/optional.h
index c0f4278009f40a..c3db3b1329a2fd 100644
--- a/flang/include/flang/Common/optional.h
+++ b/FortranRuntime/include/flang/Common/optional.h
@@ -23,8 +23,8 @@
 //   * cuda:: namespace need to be forced for all std:: references.
 //
 //===----------------------------------------------------------------------===//
-#ifndef FORTRAN_COMMON_OPTIONAL_H
-#define FORTRAN_COMMON_OPTIONAL_H
+#ifndef FORTRAN_COMMON_OPTIONAL_H_
+#define FORTRAN_COMMON_OPTIONAL_H_
 
 #include "flang/Common/api-attrs.h"
 #include <optional>
@@ -240,4 +240,4 @@ using std::optional;
 
 } // namespace Fortran::common
 
-#endif // FORTRAN_COMMON_OPTIONAL_H
+#endif /* FORTRAN_COMMON_OPTIONAL_H_ */
diff --git a/flang/include/flang/Common/real.h b/FortranRuntime/include/flang/Common/real.h
similarity index 99%
rename from flang/include/flang/Common/real.h
rename to FortranRuntime/include/flang/Common/real.h
index b527deda0e3b4f..dc9a2404731e70 100644
--- a/flang/include/flang/Common/real.h
+++ b/FortranRuntime/include/flang/Common/real.h
@@ -141,4 +141,4 @@ class RealCharacteristics {
 };
 
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_REAL_H_
+#endif /* FORTRAN_COMMON_REAL_H_ */
diff --git a/flang/include/flang/Common/reference-wrapper.h b/FortranRuntime/include/flang/Common/reference-wrapper.h
similarity index 96%
rename from flang/include/flang/Common/reference-wrapper.h
rename to FortranRuntime/include/flang/Common/reference-wrapper.h
index 2983754108f95a..6822fb335f398c 100644
--- a/flang/include/flang/Common/reference-wrapper.h
+++ b/FortranRuntime/include/flang/Common/reference-wrapper.h
@@ -22,8 +22,8 @@
 //
 // clang-format on
 
-#ifndef FORTRAN_COMMON_REFERENCE_WRAPPER_H
-#define FORTRAN_COMMON_REFERENCE_WRAPPER_H
+#ifndef FORTRAN_COMMON_REFERENCE_WRAPPER_H_
+#define FORTRAN_COMMON_REFERENCE_WRAPPER_H_
 
 #include "flang/Common/api-attrs.h"
 #include <functional>
@@ -111,4 +111,4 @@ using std::reference_wrapper;
 
 } // namespace Fortran::common
 
-#endif // FORTRAN_COMMON_REFERENCE_WRAPPER_H
+#endif /* FORTRAN_COMMON_REFERENCE_WRAPPER_H_ */
diff --git a/flang/include/flang/Common/restorer.h b/FortranRuntime/include/flang/Common/restorer.h
similarity index 97%
rename from flang/include/flang/Common/restorer.h
rename to FortranRuntime/include/flang/Common/restorer.h
index 0f1bc48620d37e..a5c5ebe7344a1b 100644
--- a/flang/include/flang/Common/restorer.h
+++ b/FortranRuntime/include/flang/Common/restorer.h
@@ -18,8 +18,8 @@
 
 #ifndef FORTRAN_COMMON_RESTORER_H_
 #define FORTRAN_COMMON_RESTORER_H_
-#include "idioms.h"
 #include "flang/Common/api-attrs.h"
+#include "idioms.h"
 namespace Fortran::common {
 template <typename A> class Restorer {
 public:
@@ -53,4 +53,4 @@ RT_API_ATTRS common::IfNoLvalue<Restorer<A>, B> ScopedSet(
   return Restorer<A>{to, std::move(original)};
 }
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_RESTORER_H_
+#endif /* FORTRAN_COMMON_RESTORER_H_ */
diff --git a/flang/include/flang/Common/target-rounding.h b/FortranRuntime/include/flang/Common/target-rounding.h
similarity index 100%
rename from flang/include/flang/Common/target-rounding.h
rename to FortranRuntime/include/flang/Common/target-rounding.h
diff --git a/flang/include/flang/Common/uint128.h b/FortranRuntime/include/flang/Common/uint128.h
similarity index 99%
rename from flang/include/flang/Common/uint128.h
rename to FortranRuntime/include/flang/Common/uint128.h
index 821c8c3b08a52f..1b2ee6a2c14b87 100644
--- a/flang/include/flang/Common/uint128.h
+++ b/FortranRuntime/include/flang/Common/uint128.h
@@ -19,8 +19,8 @@
 #define AVOID_NATIVE_UINT128_T 0
 #endif
 
-#include "leading-zero-bit-count.h"
 #include "flang/Common/api-attrs.h"
+#include "leading-zero-bit-count.h"
 #include <cstdint>
 #include <type_traits>
 
@@ -303,4 +303,4 @@ template <int BITS>
 using HostSignedIntType = typename HostSignedIntTypeHelper<BITS>::type;
 
 } // namespace Fortran::common
-#endif
+#endif /* FORTRAN_COMMON_UINT128_H_ */
diff --git a/flang/include/flang/Common/variant.h b/FortranRuntime/include/flang/Common/variant.h
similarity index 89%
rename from flang/include/flang/Common/variant.h
rename to FortranRuntime/include/flang/Common/variant.h
index 1af85876afac00..ff9b1aed4eba91 100644
--- a/flang/include/flang/Common/variant.h
+++ b/FortranRuntime/include/flang/Common/variant.h
@@ -11,8 +11,8 @@
 // and the related names become available, though, they may correspond
 // to alternative definitions (e.g. from cuda::std namespace).
 
-#ifndef FORTRAN_COMMON_VARIANT_H
-#define FORTRAN_COMMON_VARIANT_H
+#ifndef FORTRAN_COMMON_VARIANT_H_
+#define FORTRAN_COMMON_VARIANT_H_
 
 #if RT_USE_LIBCUDACXX
 #include <cuda/std/variant>
@@ -27,4 +27,4 @@ using cuda::std::visit;
 #include <variant>
 #endif // !RT_USE_LIBCUDACXX
 
-#endif // FORTRAN_COMMON_VARIANT_H
+#endif /* FORTRAN_COMMON_VARIANT_H_ */
diff --git a/flang/include/flang/Common/visit.h b/FortranRuntime/include/flang/Common/visit.h
similarity index 98%
rename from flang/include/flang/Common/visit.h
rename to FortranRuntime/include/flang/Common/visit.h
index ad66297650b093..8030ac9be173c3 100644
--- a/flang/include/flang/Common/visit.h
+++ b/FortranRuntime/include/flang/Common/visit.h
@@ -21,8 +21,8 @@
 #ifndef FORTRAN_COMMON_VISIT_H_
 #define FORTRAN_COMMON_VISIT_H_
 
-#include "variant.h"
 #include "flang/Common/api-attrs.h"
+#include "variant.h"
 #include <type_traits>
 
 namespace Fortran::common {
@@ -100,4 +100,4 @@ using Fortran::common::log2visit::visit;
 #endif
 
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_VISIT_H_
+#endif /* FORTRAN_COMMON_VISIT_H_ */
diff --git a/flang/include/flang/Common/windows-include.h b/FortranRuntime/include/flang/Common/windows-include.h
similarity index 93%
rename from flang/includ...
[truncated]

@llvmbot
Copy link
Member

llvmbot commented Oct 7, 2024

@llvm/pr-subscribers-flang-semantics

Author: Michael Kruse (Meinersbur)

Changes

Mostly mechanical changes in preparation of extracting the FortranRuntime "subproject" in #110217. This PR intends to only move pre-existing files to the new folder structure, with no behavioral change.

Common and Testing are the directories shared by FortranRuntime and Flang. Runtime and module are going to be used by FortranRuntime only. Files in Common that are used only by Flang are moved into Support.

Some cosmetic changes and files paths were necessary:

  • Relative paths to the new path for the source files and add_subdirectory.
  • Add the new location's include directory to include_directories
  • The unittest/Evaluate directory has unitests for FortranRuntime and Flang. A new CMakeLists.txt was introduced for the FortranRuntime tests.
  • Change the of the #include paths relative to the include directive
  • clang-format on the #include directives
  • Since the paths is part if the copyright header and include guards, a script was used to canonicalize those
  • test/Runtime and runtime tests in test/Driver are moved, but the lit.cfg.py mechanism to execute the will only be added in #110217.

Patch is 334.25 KiB, truncated to 20.00 KiB below, full version: https://github.com/llvm/llvm-project/pull/110298.diff

418 Files Affected:

  • (added) FortranRuntime/.clang-format (+21)
  • (renamed) FortranRuntime/cmake/config.h.cmake.in ()
  • (renamed) FortranRuntime/include/flang/Common/Fortran-consts.h ()
  • (renamed) FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h (+7-8)
  • (renamed) FortranRuntime/include/flang/Common/api-attrs.h (+5-6)
  • (renamed) FortranRuntime/include/flang/Common/binary-floating-point.h (+4-4)
  • (renamed) FortranRuntime/include/flang/Common/bit-population-count.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/constexpr-bitset.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/decimal.h (+5-6)
  • (renamed) FortranRuntime/include/flang/Common/enum-class.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/enum-set.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/fast-int-set.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Common/float128.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/format.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/idioms.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/leading-zero-bit-count.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/magic-numbers.h (+3-3)
  • (renamed) FortranRuntime/include/flang/Common/optional.h (+3-3)
  • (renamed) FortranRuntime/include/flang/Common/real.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Common/reference-wrapper.h (+3-3)
  • (renamed) FortranRuntime/include/flang/Common/restorer.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Common/target-rounding.h ()
  • (renamed) FortranRuntime/include/flang/Common/uint128.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Common/variant.h (+3-3)
  • (renamed) FortranRuntime/include/flang/Common/visit.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Common/windows-include.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/CUDA/allocator.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/CUDA/descriptor.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/allocatable.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/allocator-registry.h (+4-4)
  • (renamed) FortranRuntime/include/flang/Runtime/array-constructor.h (+3-3)
  • (renamed) FortranRuntime/include/flang/Runtime/assign.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/c-or-cpp.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/character.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/command.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/cpp-type.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/derived-api.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/descriptor.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/entry-names.h (+5-6)
  • (renamed) FortranRuntime/include/flang/Runtime/exceptions.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/execute.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/extensions.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/freestanding-tools.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/inquiry.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/io-api.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/iostat.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/main.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/matmul-instances.inc ()
  • (renamed) FortranRuntime/include/flang/Runtime/matmul-transpose.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/matmul.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/memory.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/misc-intrinsic.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/numeric.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/pointer.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/ragged.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/random.h (+5)
  • (renamed) FortranRuntime/include/flang/Runtime/reduce.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/reduction.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/stop.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/support.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Runtime/temporary-stack.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/time-intrinsic.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/transformational.h (+1-1)
  • (renamed) FortranRuntime/include/flang/Runtime/type-code.h (+2-2)
  • (renamed) FortranRuntime/include/flang/Testing/fp-testing.h (+11-3)
  • (renamed) FortranRuntime/include/flang/Testing/testing.h (+11-3)
  • (renamed) FortranRuntime/lib/Common/big-radix-floating-point.h (+6-6)
  • (renamed) FortranRuntime/lib/Common/binary-to-decimal.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Common/decimal-to-binary.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/CMakeLists.txt (+5-4)
  • (renamed) FortranRuntime/lib/Runtime/CUDA/CMakeLists.txt (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/CUDA/allocator.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/CUDA/descriptor.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/CMakeLists.txt (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/acos.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/acosh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/asin.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/asinh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/atan.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/atan2.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/atanh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/ceil.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/complex-math.c (+2-3)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/complex-math.h (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/cos.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/cosh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/erf.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/erfc.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/exp.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/exponent.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/floor.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/fma.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/fraction.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/hypot.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/j0.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/j1.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/jn.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/lgamma.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/llround.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/log.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/log10.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/lround.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/math-entries.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/mod-real.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/modulo-real.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/nearest.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/norm2.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/numeric-template-specs.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/pow.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/random.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/round.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/rrspacing.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/scale.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/set-exponent.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/sin.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/sinh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/spacing.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/sqrt.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/tan.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/tanh.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/tgamma.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/trunc.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/y0.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/y1.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/Float128Math/yn.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/ISO_Fortran_binding.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/ISO_Fortran_util.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/allocatable.cpp (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/allocator-registry.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/array-constructor.cpp (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/assign-impl.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/assign.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/buffer.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/buffer.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/character.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/command.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/complex-powi.cpp (+7-8)
  • (renamed) FortranRuntime/lib/Runtime/complex-reduction.c (+2-3)
  • (renamed) FortranRuntime/lib/Runtime/complex-reduction.h (+3-4)
  • (renamed) FortranRuntime/lib/Runtime/connection.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/connection.h (+5-5)
  • (renamed) FortranRuntime/lib/Runtime/copy.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/copy.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/derived-api.cpp (+2-3)
  • (renamed) FortranRuntime/lib/Runtime/derived.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/derived.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/descriptor-io.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/descriptor-io.h (+6-6)
  • (renamed) FortranRuntime/lib/Runtime/descriptor.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/dot-product.cpp (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/edit-input.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/edit-input.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/edit-output.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/edit-output.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/emit-encoded.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/environment-default-list.h (+2-3)
  • (renamed) FortranRuntime/lib/Runtime/environment.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/environment.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/exceptions.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/execute.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/extensions.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/external-unit.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/extrema.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/file.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/file.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/findloc.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/format-implementation.h (+5-5)
  • (renamed) FortranRuntime/lib/Runtime/format.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/format.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/inquiry.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/internal-unit.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/internal-unit.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/io-api-common.h (+7-7)
  • (renamed) FortranRuntime/lib/Runtime/io-api-minimal.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/io-api.cpp (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/io-error.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/io-error.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/io-stmt.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/io-stmt.h (+5-5)
  • (renamed) FortranRuntime/lib/Runtime/iostat.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/iso_fortran_env_impl.f90 (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/lock.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/main.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/matmul-transpose.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/matmul.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/memory.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/misc-intrinsic.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/namelist.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/namelist.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/non-tbp-dio.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/non-tbp-dio.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/numeric-templates.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/numeric.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/pointer.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/product.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/pseudo-unit.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/ragged.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/random-templates.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/random.cpp (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/reduce.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/reduction-templates.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/reduction.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/stack.h (+5-5)
  • (renamed) FortranRuntime/lib/Runtime/stat.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/stat.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/stop.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/sum.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/support.cpp (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/temporary-stack.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/terminator.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/terminator.h (+2-2)
  • (renamed) FortranRuntime/lib/Runtime/time-intrinsic.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/tools.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/tools.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/transformational.cpp (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/type-code.cpp (+2-1)
  • (renamed) FortranRuntime/lib/Runtime/type-info.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/type-info.h (+3-3)
  • (renamed) FortranRuntime/lib/Runtime/unit-map.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/unit-map.h (+4-4)
  • (renamed) FortranRuntime/lib/Runtime/unit.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/unit.h (+7-7)
  • (renamed) FortranRuntime/lib/Runtime/utf.cpp (+1-1)
  • (renamed) FortranRuntime/lib/Runtime/utf.h (+2-2)
  • (renamed) FortranRuntime/lib/Testing/fp-testing.cpp (+10-2)
  • (renamed) FortranRuntime/lib/Testing/testing.cpp (+9-1)
  • (renamed) FortranRuntime/test/Driver/ctofortran.f90 ()
  • (renamed) FortranRuntime/test/Driver/exec.f90 ()
  • (renamed) FortranRuntime/test/Runtime/no-cpp-dep.c ()
  • (added) FortranRuntime/unittests/Common/CMakeLists.txt (+11)
  • (renamed) FortranRuntime/unittests/Common/FastIntSetTest.cpp (+2-2)
  • (added) FortranRuntime/unittests/Decimal/CMakeLists.txt (+18)
  • (renamed) FortranRuntime/unittests/Decimal/quick-sanity-test.cpp (+9-1)
  • (renamed) FortranRuntime/unittests/Decimal/thorough-test.cpp (+9-1)
  • (added) FortranRuntime/unittests/Evaluate/CMakeLists.txt (+14)
  • (renamed) FortranRuntime/unittests/Evaluate/ISO-Fortran-binding.cpp (+10-2)
  • (renamed) FortranRuntime/unittests/Evaluate/reshape.cpp (+9-1)
  • (renamed) FortranRuntime/unittests/Runtime/AccessTest.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/Allocatable.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/ArrayConstructor.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/BufferTest.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/CMakeLists.txt (+8)
  • (renamed) FortranRuntime/unittests/Runtime/CUDA/AllocatorCUF.cpp (+3-3)
  • (added) FortranRuntime/unittests/Runtime/CUDA/CMakeLists.txt (+23)
  • (renamed) FortranRuntime/unittests/Runtime/CharacterTest.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/CommandTest.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/Complex.cpp (+1-1)
  • (renamed) FortranRuntime/unittests/Runtime/CrashHandlerFixture.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/CrashHandlerFixture.h (+4-4)
  • (renamed) FortranRuntime/unittests/Runtime/Derived.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/ExternalIOTest.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/Format.cpp (+4-4)
  • (renamed) FortranRuntime/unittests/Runtime/Inquiry.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/ListInputTest.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/LogicalFormatTest.cpp (+1-1)
  • (renamed) FortranRuntime/unittests/Runtime/Matmul.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/MatmulTranspose.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/MiscIntrinsic.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/Namelist.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/Numeric.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/NumericalFormatTest.cpp (+1-1)
  • (renamed) FortranRuntime/unittests/Runtime/Pointer.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/Ragged.cpp (+1-1)
  • (renamed) FortranRuntime/unittests/Runtime/Random.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/Reduction.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/RuntimeCrashTest.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/Stop.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/Support.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/TemporaryStack.cpp (+4-4)
  • (renamed) FortranRuntime/unittests/Runtime/Time.cpp (+2-2)
  • (renamed) FortranRuntime/unittests/Runtime/Transformational.cpp (+3-3)
  • (renamed) FortranRuntime/unittests/Runtime/tools.h (+3-3)
  • (modified) flang/CMakeLists.txt (+3-2)
  • (modified) flang/include/flang/Evaluate/call.h (+3-3)
  • (modified) flang/include/flang/Evaluate/characteristics.h (+3-3)
  • (modified) flang/include/flang/Evaluate/common.h (+4-4)
  • (modified) flang/include/flang/Evaluate/constant.h (+2-2)
  • (modified) flang/include/flang/Evaluate/expression.h (+3-3)
  • (modified) flang/include/flang/Evaluate/formatting.h (+1-1)
  • (modified) flang/include/flang/Evaluate/intrinsics.h (+1-1)
  • (modified) flang/include/flang/Evaluate/shape.h (+1-1)
  • (modified) flang/include/flang/Evaluate/target.h (+1-1)
  • (modified) flang/include/flang/Evaluate/tools.h (+2-2)
  • (modified) flang/include/flang/Evaluate/traverse.h (+1-1)
  • (modified) flang/include/flang/Evaluate/type.h (+3-3)
  • (modified) flang/include/flang/Evaluate/variable.h (+2-2)
  • (modified) flang/include/flang/Frontend/FrontendOptions.h (+1-1)
  • (modified) flang/include/flang/ISO_Fortran_binding.h (+6-7)
  • (modified) flang/include/flang/Lower/AbstractConverter.h (+1-1)
  • (modified) flang/include/flang/Lower/Bridge.h (+1-1)
  • (modified) flang/include/flang/Lower/CallInterface.h (+1-1)
  • (modified) flang/include/flang/Lower/ConvertType.h (+1-1)
  • (modified) flang/include/flang/Lower/LoweringOptions.h (+1-1)
  • (modified) flang/include/flang/Lower/PFTBuilder.h (+2-2)
  • (modified) flang/include/flang/Lower/Support/Utils.h (+1-1)
  • (modified) flang/include/flang/Lower/SymbolMap.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Builder/FIRBuilder.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Builder/IntrinsicCall.h (+1)
  • (modified) flang/include/flang/Optimizer/Builder/PPCIntrinsicCall.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Builder/Runtime/RTBuilder.h (+1-1)
  • (modified) flang/include/flang/Optimizer/CodeGen/DescriptorModel.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Dialect/CUF/Attributes/CUFAttr.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Support/TypeCode.h (+1-1)
  • (modified) flang/include/flang/Optimizer/Support/Utils.h (+1-1)
  • (modified) flang/include/flang/Parser/char-block.h (+1-1)
  • (modified) flang/include/flang/Parser/dump-parse-tree.h (+2-2)
  • (modified) flang/include/flang/Parser/message.h (+1-1)
  • (modified) flang/include/flang/Parser/parse-state.h (+1-1)
  • (modified) flang/include/flang/Parser/parse-tree.h (+2-2)
  • (modified) flang/include/flang/Parser/parsing.h (+1-1)
  • (modified) flang/include/flang/Parser/provenance.h (+1-1)
diff --git a/FortranRuntime/.clang-format b/FortranRuntime/.clang-format
new file mode 100644
index 00000000000000..c1dfe06fdf5782
--- /dev/null
+++ b/FortranRuntime/.clang-format
@@ -0,0 +1,21 @@
+---
+# See: https://clang.llvm.org/docs/ClangFormatStyleOptions.html
+BasedOnStyle: LLVM
+AlignAfterOpenBracket: DontAlign
+AlignEscapedNewlines: DontAlign
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignOperands: false
+AlignTrailingComments: false
+IncludeCategories:
+  - Regex:           '^<'
+    Priority:        4
+  - Regex:           '^"(llvm|llvm-c|clang|clang-c)/'
+    Priority:        3
+  - Regex:           '^"(flang|\.\.)/'
+    Priority:        2
+  - Regex:           '.*'
+    Priority:        1
+...
+
+# vim:set filetype=yaml:
diff --git a/flang/runtime/config.h.cmake b/FortranRuntime/cmake/config.h.cmake.in
similarity index 100%
rename from flang/runtime/config.h.cmake
rename to FortranRuntime/cmake/config.h.cmake.in
diff --git a/flang/include/flang/Common/Fortran-consts.h b/FortranRuntime/include/flang/Common/Fortran-consts.h
similarity index 100%
rename from flang/include/flang/Common/Fortran-consts.h
rename to FortranRuntime/include/flang/Common/Fortran-consts.h
diff --git a/flang/include/flang/ISO_Fortran_binding_wrapper.h b/FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h
similarity index 70%
rename from flang/include/flang/ISO_Fortran_binding_wrapper.h
rename to FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h
index 37289bdbabd03c..2c0fdc123c8759 100644
--- a/flang/include/flang/ISO_Fortran_binding_wrapper.h
+++ b/FortranRuntime/include/flang/Common/ISO_Fortran_binding_wrapper.h
@@ -1,14 +1,13 @@
-/*===-- include/flang/ISO_Fortran_binding_wrapper.h ---------------*- C++ -*-===
+/*===-- include/flang/Common/ISO_Fortran_binding_wrapper.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_ISO_FORTRAN_BINDING_WRAPPER_H_
-#define FORTRAN_ISO_FORTRAN_BINDING_WRAPPER_H_
+#ifndef FORTRAN_COMMON_ISO_FORTRAN_BINDING_WRAPPER_H_
+#define FORTRAN_COMMON_ISO_FORTRAN_BINDING_WRAPPER_H_
 
 /* A thin wrapper around flang/include/ISO_Fortran_binding.h
  * This header file must be included when ISO_Fortran_binding.h
@@ -23,17 +22,17 @@
 
 /* clang-format off */
 #include <stddef.h>
-#include "Common/api-attrs.h"
+#include "flang/Common/api-attrs.h" 
 #ifdef __cplusplus
 namespace Fortran {
 namespace ISO {
 #define FORTRAN_ISO_NAMESPACE_ ::Fortran::ISO
 #endif /* __cplusplus */
-#include "ISO_Fortran_binding.h"
+#include "flang/ISO_Fortran_binding.h"
 #ifdef __cplusplus
 } // namespace ISO
 } // namespace Fortran
 #endif /* __cplusplus */
 /* clang-format on */
 
-#endif /* FORTRAN_ISO_FORTRAN_BINDING_WRAPPER_H_ */
+#endif /* FORTRAN_COMMON_ISO_FORTRAN_BINDING_WRAPPER_H_ */
diff --git a/flang/include/flang/Common/api-attrs.h b/FortranRuntime/include/flang/Common/api-attrs.h
similarity index 97%
rename from flang/include/flang/Common/api-attrs.h
rename to FortranRuntime/include/flang/Common/api-attrs.h
index d73e60996bc81f..9a3001fb255c11 100644
--- a/flang/include/flang/Common/api-attrs.h
+++ b/FortranRuntime/include/flang/Common/api-attrs.h
@@ -1,11 +1,10 @@
-/*===-- include/flang/Common/api-attrs.h ---------------------------*- C -*-=//
+/*===-- include/flang/Common/api-attrs.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
  *
- *===------------------------------------------------------------------------===
- */
+ *===----------------------------------------------------------------------===*/
 
 /*
  * The file defines a set macros that can be used to apply
@@ -13,8 +12,8 @@
  * declared/defined/used in Flang runtime library.
  */
 
-#ifndef FORTRAN_RUNTIME_API_ATTRS_H_
-#define FORTRAN_RUNTIME_API_ATTRS_H_
+#ifndef FORTRAN_COMMON_API_ATTRS_H_
+#define FORTRAN_COMMON_API_ATTRS_H_
 
 /*
  * RT_EXT_API_GROUP_BEGIN/END pair is placed around definitions
@@ -178,4 +177,4 @@
 #define RT_DEVICE_NOINLINE_HOST_INLINE inline
 #endif
 
-#endif /* !FORTRAN_RUNTIME_API_ATTRS_H_ */
+#endif /* FORTRAN_COMMON_API_ATTRS_H_ */
diff --git a/flang/include/flang/Decimal/binary-floating-point.h b/FortranRuntime/include/flang/Common/binary-floating-point.h
similarity index 96%
rename from flang/include/flang/Decimal/binary-floating-point.h
rename to FortranRuntime/include/flang/Common/binary-floating-point.h
index 1e0cde97d98e61..705acc31bdfb21 100644
--- a/flang/include/flang/Decimal/binary-floating-point.h
+++ b/FortranRuntime/include/flang/Common/binary-floating-point.h
@@ -1,4 +1,4 @@
-//===-- include/flang/Decimal/binary-floating-point.h -----------*- C++ -*-===//
+//===-- include/flang/Common/binary-floating-point.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.
@@ -6,8 +6,8 @@
 //
 //===----------------------------------------------------------------------===//
 
-#ifndef FORTRAN_DECIMAL_BINARY_FLOATING_POINT_H_
-#define FORTRAN_DECIMAL_BINARY_FLOATING_POINT_H_
+#ifndef FORTRAN_COMMON_BINARY_FLOATING_POINT_H_
+#define FORTRAN_COMMON_BINARY_FLOATING_POINT_H_
 
 // Access and manipulate the fields of an IEEE-754 binary
 // floating-point value via a generalized template.
@@ -208,4 +208,4 @@ template <int BINARY_PRECISION> class BinaryFloatingPointNumber {
   RawType raw_{0};
 };
 } // namespace Fortran::decimal
-#endif
+#endif /* FORTRAN_COMMON_BINARY_FLOATING_POINT_H_ */
diff --git a/flang/include/flang/Common/bit-population-count.h b/FortranRuntime/include/flang/Common/bit-population-count.h
similarity index 98%
rename from flang/include/flang/Common/bit-population-count.h
rename to FortranRuntime/include/flang/Common/bit-population-count.h
index e1aeb78f9a3765..59ade914d14d85 100644
--- a/flang/include/flang/Common/bit-population-count.h
+++ b/FortranRuntime/include/flang/Common/bit-population-count.h
@@ -93,4 +93,4 @@ template <typename INT> inline constexpr int TrailingZeroBitCount(INT x) {
   }
 }
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_BIT_POPULATION_COUNT_H_
+#endif /* FORTRAN_COMMON_BIT_POPULATION_COUNT_H_ */
diff --git a/flang/include/flang/Common/constexpr-bitset.h b/FortranRuntime/include/flang/Common/constexpr-bitset.h
similarity index 98%
rename from flang/include/flang/Common/constexpr-bitset.h
rename to FortranRuntime/include/flang/Common/constexpr-bitset.h
index 1aafb6eff84c61..093b247b5f4eff 100644
--- a/flang/include/flang/Common/constexpr-bitset.h
+++ b/FortranRuntime/include/flang/Common/constexpr-bitset.h
@@ -144,4 +144,4 @@ template <int BITS> class BitSet {
   Word bits_{0};
 };
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_CONSTEXPR_BITSET_H_
+#endif /* FORTRAN_COMMON_CONSTEXPR_BITSET_H_ */
diff --git a/flang/include/flang/Decimal/decimal.h b/FortranRuntime/include/flang/Common/decimal.h
similarity index 95%
rename from flang/include/flang/Decimal/decimal.h
rename to FortranRuntime/include/flang/Common/decimal.h
index 443163d058e28b..c086f97129f6a5 100644
--- a/flang/include/flang/Decimal/decimal.h
+++ b/FortranRuntime/include/flang/Common/decimal.h
@@ -1,16 +1,15 @@
-/*===-- include/flang/Decimal/decimal.h ---------------------------*- C++ -*-===
+/*===-- include/flang/Common/decimal.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
  *
- * ===-----------------------------------------------------------------------===
- */
+ *===----------------------------------------------------------------------===*/
 
 /* C and C++ API for binary-to/from-decimal conversion package. */
 
-#ifndef FORTRAN_DECIMAL_DECIMAL_H_
-#define FORTRAN_DECIMAL_DECIMAL_H_
+#ifndef FORTRAN_COMMON_DECIMAL_H_
+#define FORTRAN_COMMON_DECIMAL_H_
 
 #include "flang/Common/api-attrs.h"
 #include <stddef.h>
@@ -137,4 +136,4 @@ RT_API_ATTRS enum NS(ConversionResultFlags) ConvertDecimalToLongDouble(
 #ifdef __cplusplus
 } // extern "C"
 #endif
-#endif
+#endif /* FORTRAN_COMMON_DECIMAL_H_ */
diff --git a/flang/include/flang/Common/enum-class.h b/FortranRuntime/include/flang/Common/enum-class.h
similarity index 98%
rename from flang/include/flang/Common/enum-class.h
rename to FortranRuntime/include/flang/Common/enum-class.h
index 41575d45091a8d..787648ffec48e8 100644
--- a/flang/include/flang/Common/enum-class.h
+++ b/FortranRuntime/include/flang/Common/enum-class.h
@@ -69,4 +69,4 @@ constexpr std::array<std::string_view, ITEMS> EnumNames(const char *p) {
   }
 
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_ENUM_CLASS_H_
+#endif /* FORTRAN_COMMON_ENUM_CLASS_H_ */
diff --git a/flang/include/flang/Common/enum-set.h b/FortranRuntime/include/flang/Common/enum-set.h
similarity index 99%
rename from flang/include/flang/Common/enum-set.h
rename to FortranRuntime/include/flang/Common/enum-set.h
index 5290b76debee88..6100fc5e2e31c5 100644
--- a/flang/include/flang/Common/enum-set.h
+++ b/FortranRuntime/include/flang/Common/enum-set.h
@@ -228,4 +228,4 @@ struct std::hash<Fortran::common::EnumSet<ENUM, values>> {
     return std::hash(x.bitset());
   }
 };
-#endif // FORTRAN_COMMON_ENUM_SET_H_
+#endif /* FORTRAN_COMMON_ENUM_SET_H_ */
diff --git a/flang/include/flang/Common/fast-int-set.h b/FortranRuntime/include/flang/Common/fast-int-set.h
similarity index 97%
rename from flang/include/flang/Common/fast-int-set.h
rename to FortranRuntime/include/flang/Common/fast-int-set.h
index d1c9c756a44a65..323ee4dc7e94d9 100644
--- a/flang/include/flang/Common/fast-int-set.h
+++ b/FortranRuntime/include/flang/Common/fast-int-set.h
@@ -1,4 +1,4 @@
-//===-- include/flang/Common/fast-int-set.h --------------------*- C++ -*-===//
+//===-- include/flang/Common/fast-int-set.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.
@@ -103,4 +103,4 @@ template <int N> class FastIntSet {
   bool isFullyInitialized_{false}; // memory was cleared
 };
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_FAST_INT_SET_H_
+#endif /* FORTRAN_COMMON_FAST_INT_SET_H_ */
diff --git a/flang/include/flang/Common/float128.h b/FortranRuntime/include/flang/Common/float128.h
similarity index 96%
rename from flang/include/flang/Common/float128.h
rename to FortranRuntime/include/flang/Common/float128.h
index 2e76bc0a162e61..a7036bf679e5ae 100644
--- a/flang/include/flang/Common/float128.h
+++ b/FortranRuntime/include/flang/Common/float128.h
@@ -1,4 +1,4 @@
-/*===-- flang/Common/float128.h ----------------------------------*- C -*-===
+/*===-- include/flang/Common/float128.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.
diff --git a/flang/include/flang/Common/format.h b/FortranRuntime/include/flang/Common/format.h
similarity index 99%
rename from flang/include/flang/Common/format.h
rename to FortranRuntime/include/flang/Common/format.h
index 138e84b72b733d..6f4dfc8d2376b7 100644
--- a/flang/include/flang/Common/format.h
+++ b/FortranRuntime/include/flang/Common/format.h
@@ -901,4 +901,4 @@ template <typename CHAR> bool FormatValidator<CHAR>::Check() {
 }
 
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_FORMAT_H_
+#endif /* FORTRAN_COMMON_FORMAT_H_ */
diff --git a/flang/include/flang/Common/idioms.h b/FortranRuntime/include/flang/Common/idioms.h
similarity index 99%
rename from flang/include/flang/Common/idioms.h
rename to FortranRuntime/include/flang/Common/idioms.h
index 99f383ec75b999..1ae0c0b35112e9 100644
--- a/flang/include/flang/Common/idioms.h
+++ b/FortranRuntime/include/flang/Common/idioms.h
@@ -150,4 +150,4 @@ template <typename A, typename... B>
 using IfNoLvalue = std::enable_if_t<(... && !std::is_lvalue_reference_v<B>), A>;
 template <typename... RVREF> using NoLvalue = IfNoLvalue<void, RVREF...>;
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_IDIOMS_H_
+#endif /* FORTRAN_COMMON_IDIOMS_H_ */
diff --git a/flang/include/flang/Common/leading-zero-bit-count.h b/FortranRuntime/include/flang/Common/leading-zero-bit-count.h
similarity index 98%
rename from flang/include/flang/Common/leading-zero-bit-count.h
rename to FortranRuntime/include/flang/Common/leading-zero-bit-count.h
index a296e0b446917f..e788bfa9bcfd08 100644
--- a/flang/include/flang/Common/leading-zero-bit-count.h
+++ b/FortranRuntime/include/flang/Common/leading-zero-bit-count.h
@@ -93,4 +93,4 @@ template <typename A> inline constexpr int BitsNeededFor(A x) {
   return 8 * sizeof x - LeadingZeroBitCount(x);
 }
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_LEADING_ZERO_BIT_COUNT_H_
+#endif /* FORTRAN_COMMON_LEADING_ZERO_BIT_COUNT_H_ */
diff --git a/flang/include/flang/Runtime/magic-numbers.h b/FortranRuntime/include/flang/Common/magic-numbers.h
similarity index 98%
rename from flang/include/flang/Runtime/magic-numbers.h
rename to FortranRuntime/include/flang/Common/magic-numbers.h
index bab0e9ae05299a..931df690766219 100644
--- a/flang/include/flang/Runtime/magic-numbers.h
+++ b/FortranRuntime/include/flang/Common/magic-numbers.h
@@ -1,10 +1,10 @@
-#if 0 /*===-- include/flang/Runtime/magic-numbers.h -----------------------===*/
-/*
+#if 0 /*===-- include/flang/Runtime/magic-numbers.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
  *
- *===----------------------------------------------------------------------===*/
+/*===----------------------------------------------------------------------===*/
 #endif
 #if 0
 This header can be included into both Fortran and C.
diff --git a/flang/include/flang/Common/optional.h b/FortranRuntime/include/flang/Common/optional.h
similarity index 98%
rename from flang/include/flang/Common/optional.h
rename to FortranRuntime/include/flang/Common/optional.h
index c0f4278009f40a..c3db3b1329a2fd 100644
--- a/flang/include/flang/Common/optional.h
+++ b/FortranRuntime/include/flang/Common/optional.h
@@ -23,8 +23,8 @@
 //   * cuda:: namespace need to be forced for all std:: references.
 //
 //===----------------------------------------------------------------------===//
-#ifndef FORTRAN_COMMON_OPTIONAL_H
-#define FORTRAN_COMMON_OPTIONAL_H
+#ifndef FORTRAN_COMMON_OPTIONAL_H_
+#define FORTRAN_COMMON_OPTIONAL_H_
 
 #include "flang/Common/api-attrs.h"
 #include <optional>
@@ -240,4 +240,4 @@ using std::optional;
 
 } // namespace Fortran::common
 
-#endif // FORTRAN_COMMON_OPTIONAL_H
+#endif /* FORTRAN_COMMON_OPTIONAL_H_ */
diff --git a/flang/include/flang/Common/real.h b/FortranRuntime/include/flang/Common/real.h
similarity index 99%
rename from flang/include/flang/Common/real.h
rename to FortranRuntime/include/flang/Common/real.h
index b527deda0e3b4f..dc9a2404731e70 100644
--- a/flang/include/flang/Common/real.h
+++ b/FortranRuntime/include/flang/Common/real.h
@@ -141,4 +141,4 @@ class RealCharacteristics {
 };
 
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_REAL_H_
+#endif /* FORTRAN_COMMON_REAL_H_ */
diff --git a/flang/include/flang/Common/reference-wrapper.h b/FortranRuntime/include/flang/Common/reference-wrapper.h
similarity index 96%
rename from flang/include/flang/Common/reference-wrapper.h
rename to FortranRuntime/include/flang/Common/reference-wrapper.h
index 2983754108f95a..6822fb335f398c 100644
--- a/flang/include/flang/Common/reference-wrapper.h
+++ b/FortranRuntime/include/flang/Common/reference-wrapper.h
@@ -22,8 +22,8 @@
 //
 // clang-format on
 
-#ifndef FORTRAN_COMMON_REFERENCE_WRAPPER_H
-#define FORTRAN_COMMON_REFERENCE_WRAPPER_H
+#ifndef FORTRAN_COMMON_REFERENCE_WRAPPER_H_
+#define FORTRAN_COMMON_REFERENCE_WRAPPER_H_
 
 #include "flang/Common/api-attrs.h"
 #include <functional>
@@ -111,4 +111,4 @@ using std::reference_wrapper;
 
 } // namespace Fortran::common
 
-#endif // FORTRAN_COMMON_REFERENCE_WRAPPER_H
+#endif /* FORTRAN_COMMON_REFERENCE_WRAPPER_H_ */
diff --git a/flang/include/flang/Common/restorer.h b/FortranRuntime/include/flang/Common/restorer.h
similarity index 97%
rename from flang/include/flang/Common/restorer.h
rename to FortranRuntime/include/flang/Common/restorer.h
index 0f1bc48620d37e..a5c5ebe7344a1b 100644
--- a/flang/include/flang/Common/restorer.h
+++ b/FortranRuntime/include/flang/Common/restorer.h
@@ -18,8 +18,8 @@
 
 #ifndef FORTRAN_COMMON_RESTORER_H_
 #define FORTRAN_COMMON_RESTORER_H_
-#include "idioms.h"
 #include "flang/Common/api-attrs.h"
+#include "idioms.h"
 namespace Fortran::common {
 template <typename A> class Restorer {
 public:
@@ -53,4 +53,4 @@ RT_API_ATTRS common::IfNoLvalue<Restorer<A>, B> ScopedSet(
   return Restorer<A>{to, std::move(original)};
 }
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_RESTORER_H_
+#endif /* FORTRAN_COMMON_RESTORER_H_ */
diff --git a/flang/include/flang/Common/target-rounding.h b/FortranRuntime/include/flang/Common/target-rounding.h
similarity index 100%
rename from flang/include/flang/Common/target-rounding.h
rename to FortranRuntime/include/flang/Common/target-rounding.h
diff --git a/flang/include/flang/Common/uint128.h b/FortranRuntime/include/flang/Common/uint128.h
similarity index 99%
rename from flang/include/flang/Common/uint128.h
rename to FortranRuntime/include/flang/Common/uint128.h
index 821c8c3b08a52f..1b2ee6a2c14b87 100644
--- a/flang/include/flang/Common/uint128.h
+++ b/FortranRuntime/include/flang/Common/uint128.h
@@ -19,8 +19,8 @@
 #define AVOID_NATIVE_UINT128_T 0
 #endif
 
-#include "leading-zero-bit-count.h"
 #include "flang/Common/api-attrs.h"
+#include "leading-zero-bit-count.h"
 #include <cstdint>
 #include <type_traits>
 
@@ -303,4 +303,4 @@ template <int BITS>
 using HostSignedIntType = typename HostSignedIntTypeHelper<BITS>::type;
 
 } // namespace Fortran::common
-#endif
+#endif /* FORTRAN_COMMON_UINT128_H_ */
diff --git a/flang/include/flang/Common/variant.h b/FortranRuntime/include/flang/Common/variant.h
similarity index 89%
rename from flang/include/flang/Common/variant.h
rename to FortranRuntime/include/flang/Common/variant.h
index 1af85876afac00..ff9b1aed4eba91 100644
--- a/flang/include/flang/Common/variant.h
+++ b/FortranRuntime/include/flang/Common/variant.h
@@ -11,8 +11,8 @@
 // and the related names become available, though, they may correspond
 // to alternative definitions (e.g. from cuda::std namespace).
 
-#ifndef FORTRAN_COMMON_VARIANT_H
-#define FORTRAN_COMMON_VARIANT_H
+#ifndef FORTRAN_COMMON_VARIANT_H_
+#define FORTRAN_COMMON_VARIANT_H_
 
 #if RT_USE_LIBCUDACXX
 #include <cuda/std/variant>
@@ -27,4 +27,4 @@ using cuda::std::visit;
 #include <variant>
 #endif // !RT_USE_LIBCUDACXX
 
-#endif // FORTRAN_COMMON_VARIANT_H
+#endif /* FORTRAN_COMMON_VARIANT_H_ */
diff --git a/flang/include/flang/Common/visit.h b/FortranRuntime/include/flang/Common/visit.h
similarity index 98%
rename from flang/include/flang/Common/visit.h
rename to FortranRuntime/include/flang/Common/visit.h
index ad66297650b093..8030ac9be173c3 100644
--- a/flang/include/flang/Common/visit.h
+++ b/FortranRuntime/include/flang/Common/visit.h
@@ -21,8 +21,8 @@
 #ifndef FORTRAN_COMMON_VISIT_H_
 #define FORTRAN_COMMON_VISIT_H_
 
-#include "variant.h"
 #include "flang/Common/api-attrs.h"
+#include "variant.h"
 #include <type_traits>
 
 namespace Fortran::common {
@@ -100,4 +100,4 @@ using Fortran::common::log2visit::visit;
 #endif
 
 } // namespace Fortran::common
-#endif // FORTRAN_COMMON_VISIT_H_
+#endif /* FORTRAN_COMMON_VISIT_H_ */
diff --git a/flang/include/flang/Common/windows-include.h b/FortranRuntime/include/flang/Common/windows-include.h
similarity index 93%
rename from flang/includ...
[truncated]

Copy link
Contributor

@tblah tblah left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@klausler klausler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a gigantic change and I don't understand why it's being made. Why is so much code moving out of flang/ ?

@clementval
Copy link
Contributor

How recent is your latest rebase? They are missing files in this PR.

@Meinersbur
Copy link
Member Author

This is a gigantic change and I don't understand why it's being made. Why is so much code moving out of flang/ ?

As explained in the summary, this is in preparation of #110217.

#110217 changes the libFortranRuntime build to use the LLVM_ENABLE_RUNTIMES build system, like all the other LLVM runtimes do (compiler-rt, libc, libcxx, libcxxabi, offload, openmp, libunwind). LLVM_ENABLE_RUNTIMES was introduced to compile the runtimes for the target triple(s) instead of the host platform. This will be needed to support cross-compilation with Flang. Flang is an LLVM project, it should follow LLVM conventions.

The LLVM_ENABLE_RUNTIMES system assumes that each runtime library has a top-level directory in the repository root, so that's where I moved the files to. Moving the common files too was result of a discussion result in the RFC.

While it would be possible to only have a FortranRuntime/CMakeLists.txt and leave all the other files in flang/, I strongly believe this is a bad idea. It is the norm for LLVM runtimes to have separate sources. Coupling of runtime and compiler also introduces problems since both are built differently. It should be clear which files (also) belong to the runtime which has different build requirements. For instance, one must use fortran::common::optional<T> instead of std::optional<T> since otherwise the CUDA version fails building. With git being able to track renames, the renaming itself should be the least issues, much less than it would be to accumulate technical debt.

@Meinersbur
Copy link
Member Author

How recent is your latest rebase? They are missing files in this PR.

I did not do a rebase since I started working on this PR, maybe 3 weeks ago. With new files added/removed upstream and at the same time reviewers probably asking to change the move location, keeping the PR stack current all the time, and also ensure that every change is part of the correct PR, is a bit of a hassle. I intend to start updating to main only after the directional discussion of #110217 concluded (which may for instance decide to rename FortranRuntime to flang-rt). I hope this is understandable.

In the past I also often forgot that I should only merge main into the first patch of the sequence, then iteratively update all other in the sequence. If you don't do that GitHub considers the upsteam commits as part of the PR, and runs some bots which automatically add a lot of reviewers and subscribers for each touched file in the upstream commits. Since then I am careful to rebase patch sequences.

@clementval
Copy link
Contributor

How recent is your latest rebase? They are missing files in this PR.

I did not do a rebase since I started working on this PR, maybe 3 weeks ago. With new files added/removed upstream and at the same time reviewers probably asking to change the move location, keeping the PR stack current all the time, and also ensure that every change is part of the correct PR, is a bit of a hassle. I intend to start updating to main only after the directional discussion of #110217 concluded (which may for instance decide to rename FortranRuntime to flang-rt). I hope this is understandable.

In the past I also often forgot that I should only merge main into the first patch of the sequence, then iteratively update all other in the sequence. If you don't do that GitHub considers the upsteam commits as part of the PR, and runs some bots which automatically add a lot of reviewers and subscribers for each touched file in the upstream commits. Since then I am careful to rebase patch sequences.

Ok, just wanted to make sure you are aware of new files.

@klausler
Copy link
Contributor

klausler commented Oct 9, 2024

While it would be possible to only have a FortranRuntime/CMakeLists.txt and leave all the other files in flang/, I strongly believe this is a bad idea. It is the norm for LLVM runtimes to have separate sources.

A Fortran compiler and its runtime are tightly coupled; the compiler can only work with this runtime, this runtime can only be used by this compiler, and they share common API definitions and data structures.

I don't mind if you move the sources and headers that are used only by the runtime into a new top-level directory, if you must. But moving common headers and sources used by both the compiler and the runtime builds out of the compiler tree makes no sense to me.

@Meinersbur
Copy link
Member Author

A Fortran compiler and its runtime are tightly coupled; the compiler can only work with this runtime, this runtime can only be used by this compiler, and they share common API definitions and data structures.

So is c C/C++ compiler and its runtime(s). There is still a need to support cross-compilation and other build modes like FLANG_EXPERIMENTAL_CUDA_RUNTIME.

I don't mind if you move the sources and headers that are used only by the runtime into a new top-level directory, if you must. But moving common headers and sources used by both the compiler and the runtime builds out of the compiler tree makes no sense to me.

As said, this was the result of the RFC. I can update the PR and leave them in flang/.

@klausler
Copy link
Contributor

A Fortran compiler and its runtime are tightly coupled; the compiler can only work with this runtime, this runtime can only be used by this compiler, and they share common API definitions and data structures.

So is c C/C++ compiler and its runtime(s). There is still a need to support cross-compilation and other build modes like FLANG_EXPERIMENTAL_CUDA_RUNTIME.

I don't mind if you move the sources and headers that are used only by the runtime into a new top-level directory, if you must. But moving common headers and sources used by both the compiler and the runtime builds out of the compiler tree makes no sense to me.

As said, this was the result of the RFC. I can update the PR and leave them in flang/.

I am not in disagreement with your objectives. But I think that you will be able to achieve them without scrambling the source locations so much that I won't be able to continue maintaining them upstream.

@Meinersbur Meinersbur changed the title [Flang] Move runtime library files to FortranRuntime. NFC [Flang] Move runtime library files to clang-rt. NFC Oct 16, 2024
Copy link
Contributor

@clementval clementval left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See comment inlined

Base automatically changed from users/meinersbur/flang_runtime_flang_rt to main February 8, 2025 17:02
@Meinersbur
Copy link
Member Author

@clementval You agreed to a new folder structure in https://discourse.llvm.org/t/rfc-names-for-flang-rt-libraries/84321/4. Could you please review this PR again?

The "Check code formatting" stage does not pass by design. For moved/renamed files it requires a complete reformatting, I only clang-formatted the #includes, thus will complain about anything that it not formatted before this PR.

@clementval
Copy link
Contributor

@clementval You agreed to a new folder structure in https://discourse.llvm.org/t/rfc-names-for-flang-rt-libraries/84321/4. Could you please review this PR again?

The "Check code formatting" stage does not pass by design. For moved/renamed files it requires a complete reformatting, I only clang-formatted the #includes, thus will complain about anything that it not formatted before this PR.

I see only one header file in include/flang-rt/cuda but we currently have about 10 files in include/flang/Runtime/CUDA. Did you miss them?

@Meinersbur
Copy link
Member Author

Meinersbur commented Feb 10, 2025

The intention was to leave the files included in both (runtime and compiler) inside the flang/ subtree. This leaves cross-project include-dependencies only in one direction: "flang-rt" -> "flang/include". This applies header files in "flang/include/Common" and "flang/include/Runtime". Moving them would have just caused for the cross-dependence includes to go the other way around "flang" -> "flang-rt/include" which does not provide a clear benefit and having "flang-rt" and "flang" include header files of each other would make things even more complicated.

This applies to most of the files in "flang/include/Runtime" (including "/CUDA") as well. These forward-declare functions which do not exist in the compiler executable, hence should be used only in the runtime (calling it from the compiler will result in a link error), but they are also used do derive the MLIR argument types when the compiler generates calls to them1. These are the function decorated by RTNAME/RTDECL to ensure Fortran calling conventions.

I still moved files to which this does not apply, which cannot and should not be used from the compiler, to flang-rt. An example is descriptor.h which includes the definition of class Descriptor. Its memory layout (and sizeof(Descriptor)) is target-dependent, hence must not be used from the compiler since it would errornously assume the ABI of the compiler host, which might be different from the compilation target.

When introduced in 1417633, allocator.h did not contain any RTNAME/RTDECL declarations, hence the move. This has changed in 4c1dbbe which I seem to have missed, hence I think I will move back the file.

Note that there are still declarations that should not be used from the compiler, and ideally be moved to other header files not in flang/include (but flang-rt/include which means they can still be used by e.g. unittests), since not relevant to the compiler, and do not define the runtime API:

  • CUFAllocPinned
  • CUFFreePinned
  • CUFAllocDevice
  • CUFFreeDevice
  • CUFAllocManaged
  • CUFFreeManaged
  • CUDA_REPORT_IF_ERROR (now in common.h)

Footnotes

  1. This is a bad idea anyway since C types correspond to different ABI types depending on the compilation target. E.g. size_t can be unsigned int, unsigned long, or unsigned long long. The type resolution to MLIR types is done using templates, on some targets (i.e.: 32-bit platforms) the template specilization template<> TypeBuilderFunc getModel<size_t> will be ambiguous with template<> TypeBuilderFunc getModel<unsigned int>, and error-out the compiler. Will eventually need to be replaced with a table-gen approach, like libc does.

@clementval
Copy link
Contributor

Ok. Thanks for the explanation. This look ok for me. I'll let @jeanPerier give the final approval since he has followed this work more closely.

Copy link
Contributor

@jeanPerier jeanPerier left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Works with my testing, thanks.

@Meinersbur Meinersbur merged commit 54f3713 into main Feb 16, 2025
7 of 8 checks passed
@Meinersbur Meinersbur deleted the users/meinersbur/flang_runtime_move-files branch February 16, 2025 12:25
@llvm-ci
Copy link
Collaborator

llvm-ci commented Feb 16, 2025

LLVM Buildbot has detected a new failure on builder flang-aarch64-libcxx running on linaro-flang-aarch64-libcxx while building flang-rt,flang at step 5 "build-unified-tree".

Full details are available at: https://lab.llvm.org/buildbot/#/builders/89/builds/16706

Here is the relevant piece of the build log for the reference
Step 5 (build-unified-tree) failure: build (failure)
...
319.396 [4/68/7269] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/norm2.cpp.o
319.408 [4/67/7270] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/tools.cpp.o
319.424 [4/66/7271] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/pseudo-unit.cpp.o
319.427 [4/65/7272] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/modulo-real.cpp.o
319.471 [4/64/7273] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/log10.cpp.o
319.480 [4/63/7274] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/asinh.cpp.o
319.496 [4/62/7275] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/nearest.cpp.o
319.519 [4/61/7276] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/erfc.cpp.o
319.537 [4/60/7277] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/unit-map.cpp.o
319.548 [4/59/7278] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/io-api-minimal.cpp.o
FAILED: tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/io-api-minimal.cpp.o 
/usr/local/bin/c++ -DFLANG_INCLUDE_TESTS=1 -DFLANG_LITTLE_ENDIAN=1 -DGTEST_HAS_RTTI=0 -D_DEBUG -D_GLIBCXX_ASSERTIONS -D_GNU_SOURCE -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS -I/home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/tools/flang/runtime -I/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/runtime -I/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/../flang-rt/include -I/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/include -I/home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/tools/flang/include -I/home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/include -I/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/llvm/include -isystem /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang/../mlir/include -isystem /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/tools/mlir/include -isystem /home/tcwg-buildbot/worker/flang-aarch64-libcxx/build/tools/clang/include -isystem /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/llvm/../clang/include -stdlib=libc++ -fPIC -fno-semantic-interposition -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wc++98-compat-extra-semi -Wimplicit-fallthrough -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wsuggest-override -Wstring-conversion -Wmisleading-indentation -Wctad-maybe-unsupported -fdiagnostics-color -ffunction-sections -fdata-sections -Werror -Wno-deprecated-copy -Wno-string-conversion -Wno-ctad-maybe-unsupported -Wno-unused-command-line-argument -Wstring-conversion           -Wcovered-switch-default -Wno-nested-anon-types -fno-lto -fno-exceptions -fno-rtti -O3 -DNDEBUG -std=c++17 -fPIC   -U_GLIBCXX_ASSERTIONS -U_LIBCPP_ENABLE_ASSERTIONS -UNDEBUG  -fno-exceptions -funwind-tables -fno-rtti -MD -MT tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/io-api-minimal.cpp.o -MF tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/io-api-minimal.cpp.o.d -o tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/io-api-minimal.cpp.o -c /home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/io-api-minimal.cpp
../llvm-project/flang-rt/lib/runtime/io-api-minimal.cpp:153:11: error: exception specification in declaration does not match previous declaration
  153 | void std::__libcpp_verbose_abort(char const *format, ...) noexcept {
      |           ^
/usr/local/clang+llvm-18.1.8-aarch64-linux-gnu/bin/../include/c++/v1/__verbose_abort:25:53: note: previous declaration is here
   25 |     _LIBCPP_ATTRIBUTE_FORMAT(__printf__, 1, 2) void __libcpp_verbose_abort(const char* __format, ...);
      |                                                     ^
1 error generated.
319.556 [4/58/7279] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/stat.cpp.o
319.572 [4/57/7280] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/inquiry.cpp.o
319.655 [4/56/7281] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/random.cpp.o
319.769 [4/55/7282] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/edit-input.cpp.o
319.807 [4/54/7283] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/atan2.cpp.o
319.841 [4/53/7284] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/sinh.cpp.o
320.175 [4/52/7285] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/j0.cpp.o
320.260 [4/51/7286] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/rrspacing.cpp.o
320.300 [4/50/7287] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/y1.cpp.o
320.361 [4/49/7288] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/utf.cpp.o
320.370 [4/48/7289] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/reshape.test.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/unittests/Evaluate/reshape.cpp.o
320.391 [4/47/7290] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/sin.cpp.o
320.486 [4/46/7291] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/exp.cpp.o
320.555 [4/45/7292] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/unit.cpp.o
320.777 [4/44/7293] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/tgamma.cpp.o
320.819 [4/43/7294] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/erf.cpp.o
320.821 [4/42/7295] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/remainder.cpp.o
320.884 [4/41/7296] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/j1.cpp.o
320.990 [4/40/7297] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/round.cpp.o
321.007 [4/39/7298] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/format.cpp.o
321.031 [4/38/7299] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/edit-output.cpp.o
321.067 [4/37/7300] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/atan.cpp.o
321.294 [4/36/7301] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/allocator-registry.cpp.o
321.321 [4/35/7302] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/pow.cpp.o
321.346 [4/34/7303] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/exponent.cpp.o
321.351 [4/33/7304] Building CXX object tools/flang/unittests/Evaluate/CMakeFiles/ISO-Fortran-binding.test.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/unittests/Evaluate/ISO-Fortran-binding.cpp.o
321.408 [4/32/7305] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/acosh.cpp.o
321.410 [4/31/7306] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/sum.cpp.o
321.441 [4/30/7307] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/runtime/product.cpp.o
321.465 [4/29/7308] Building CXX object tools/flang/runtime/CMakeFiles/flang_rt.runtime.dir/home/tcwg-buildbot/worker/flang-aarch64-libcxx/llvm-project/flang-rt/lib/quadmath/floor.cpp.o

sivan-shani pushed a commit to sivan-shani/llvm-project that referenced this pull request Feb 24, 2025
Mostly mechanical changes in preparation of extracting the Flang-RT
"subproject" in llvm#110217. This PR intends to only move pre-existing files
to the new folder structure, with no behavioral change. Common files
(headers, testing, cmake) shared by Flang-RT and Flang remain in
`flang/`.

Some cosmetic changes and files paths were necessary:
* Relative paths to the new path for the source files and
`add_subdirectory`.
 * Add the new location's include directory to `include_directories`
* The unittest/Evaluate directory has unitests for flang-rt and Flang. A
new `CMakeLists.txt` was introduced for the flang-rt tests.
 * Change the `#include` paths relative to the include directive
 * clang-format on the `#include` directives
* Since the paths are part if the copyright header and include guards, a
script was used to canonicalize those
* `test/Runtime` and runtime tests in `test/Driver` are moved, but the
lit.cfg.py mechanism to execute the will only be added in llvm#110217.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants